From fe3b2348e78cec55a0fd08b422ba9a064e3f793c Mon Sep 17 00:00:00 2001 From: Philipp Date: Thu, 10 Oct 2024 11:24:50 +0200 Subject: [PATCH] fix: drop items --- .../signals/blocks/BasicBlock.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/troblecodings/signals/blocks/BasicBlock.java b/src/main/java/com/troblecodings/signals/blocks/BasicBlock.java index bac211eb4..8ebfdf72d 100644 --- a/src/main/java/com/troblecodings/signals/blocks/BasicBlock.java +++ b/src/main/java/com/troblecodings/signals/blocks/BasicBlock.java @@ -1,7 +1,9 @@ package com.troblecodings.signals.blocks; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -9,17 +11,21 @@ import com.troblecodings.signals.core.TileEntitySupplierWrapper; import net.minecraft.core.BlockPos; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.storage.loot.LootContext; public class BasicBlock extends Block implements EntityBlock { private static final Map BLOCK_NAMES = new HashMap<>(); - private static final Map> BLOCK_SUPPLIER = new HashMap<>(); - public static final Map> BLOCK_ENTITYS = new HashMap<>(); + private static final Map> BLOCK_SUPPLIER = + new HashMap<>(); + public static final Map> BLOCK_ENTITYS = + new HashMap<>(); public BasicBlock(final Properties properties) { super(properties); @@ -63,4 +69,11 @@ public static void prepare() { public BlockEntity newBlockEntity(final BlockPos pos, final BlockState state) { return getSupplierWrapper().map(type -> type.create(pos, state)).orElse(null); } + + @Override + public List getDrops(final BlockState state, final LootContext.Builder builder) { + List drops = new ArrayList(); + drops.add(new ItemStack(this.asBlock().asItem())); + return drops; + } } \ No newline at end of file