diff options
4 files changed, 44 insertions, 2 deletions
diff --git a/src/main/generated/data/funny-teleporters/loot_table/blocks/coloured_chest.json b/src/main/generated/data/funny-teleporters/loot_table/blocks/coloured_chest.json new file mode 100644 index 0000000..c682fb4 --- /dev/null +++ b/src/main/generated/data/funny-teleporters/loot_table/blocks/coloured_chest.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "funny-teleporters:coloured_chest" + } + ], + "rolls": 1.0 + } + ] +}
\ No newline at end of file diff --git a/src/main/java/moe/nea/funnyteleporters/FunnyDataGenerator.java b/src/main/java/moe/nea/funnyteleporters/FunnyDataGenerator.java index 195723e..f57cc28 100644 --- a/src/main/java/moe/nea/funnyteleporters/FunnyDataGenerator.java +++ b/src/main/java/moe/nea/funnyteleporters/FunnyDataGenerator.java @@ -8,6 +8,7 @@ public class FunnyDataGenerator implements DataGeneratorEntrypoint { public void onInitializeDataGenerator(FabricDataGenerator dataGenerator) { var pack = dataGenerator.createPack(); pack.addProvider(FunnyRecipeProvider::new); + pack.addProvider(FunnyDropTableProvider::new); } } diff --git a/src/main/java/moe/nea/funnyteleporters/FunnyDropTableProvider.java b/src/main/java/moe/nea/funnyteleporters/FunnyDropTableProvider.java new file mode 100644 index 0000000..cf2643a --- /dev/null +++ b/src/main/java/moe/nea/funnyteleporters/FunnyDropTableProvider.java @@ -0,0 +1,18 @@ +package moe.nea.funnyteleporters; + +import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider; +import net.minecraft.registry.RegistryWrapper; + +import java.util.concurrent.CompletableFuture; + +public class FunnyDropTableProvider extends FabricBlockLootTableProvider { + protected FunnyDropTableProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup) { + super(dataOutput, registryLookup); + } + + @Override + public void generate() { + addDrop(FunnyRegistry.COLOURED_CHEST); + } +} diff --git a/src/main/java/moe/nea/funnyteleporters/FunnyRegistry.java b/src/main/java/moe/nea/funnyteleporters/FunnyRegistry.java index a7fb40b..498adf5 100644 --- a/src/main/java/moe/nea/funnyteleporters/FunnyRegistry.java +++ b/src/main/java/moe/nea/funnyteleporters/FunnyRegistry.java @@ -6,6 +6,7 @@ import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.block.piston.PistonBehavior; import net.minecraft.item.Item; import net.minecraft.item.Items; import net.minecraft.registry.Registries; @@ -13,11 +14,13 @@ import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; public class FunnyRegistry { - public static Block COLOURED_CHEST = registerBlock("coloured_chest", new ColouredChestBlock(AbstractBlock.Settings.create()), Items.RED_WOOL); + public static Block COLOURED_CHEST = registerBlock("coloured_chest", new ColouredChestBlock(AbstractBlock.Settings.create() + .pistonBehavior(PistonBehavior.PUSH_ONLY) + .strength(50.0F, 1200.0F)), Items.REINFORCED_DEEPSLATE); public static BlockEntityType<ColouredChestBlockEntity> COLOURED_CHEST_ENTITY = registerBlockEntity("coloured_chest", BlockEntityType.Builder.create(ColouredChestBlockEntity::new, COLOURED_CHEST)); - private static <T extends BlockEntity> BlockEntityType<T> registerBlockEntity(String name, BlockEntityType.Builder<T> builder, Block... blocks) { + private static <T extends BlockEntity> BlockEntityType<T> registerBlockEntity(String name, BlockEntityType.Builder<T> builder) { var be = Registry.register(Registries.BLOCK_ENTITY_TYPE, Identifier.of(FunnyTeleporters.MOD_ID, name), builder.build() |