summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-20 20:36:16 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-20 20:36:16 +0100
commita100d988f275c9ae434d641437e4807c1287a25f (patch)
tree3cf62a6c59331f76ef0d0203df9eefc1a3ee34aa /src/main/java
parente82ca08db0ec95130dd152fd8720c82adb82c89e (diff)
downloadfunny-teleporters-a100d988f275c9ae434d641437e4807c1287a25f.tar.gz
funny-teleporters-a100d988f275c9ae434d641437e4807c1287a25f.tar.bz2
funny-teleporters-a100d988f275c9ae434d641437e4807c1287a25f.zip
Make block drop osmething
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/moe/nea/funnyteleporters/FunnyDataGenerator.java1
-rw-r--r--src/main/java/moe/nea/funnyteleporters/FunnyDropTableProvider.java18
-rw-r--r--src/main/java/moe/nea/funnyteleporters/FunnyRegistry.java7
3 files changed, 24 insertions, 2 deletions
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()