Skip to content

Commit 044eb1d

Browse files
committed
Fix skulls dropping the item instead of it being picked up
1 parent 1f265df commit 044eb1d

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import net.minecraft.block.Block;
1818
import net.minecraft.block.BlockLiquid;
19+
import net.minecraft.block.BlockSkull;
1920
import net.minecraft.block.state.IBlockState;
2021
import net.minecraft.client.resources.I18n;
2122
import net.minecraft.entity.item.EntityItem;
@@ -191,14 +192,27 @@ protected void addToInventoryOrDropItems(@NotNull List<ItemStack> drops, @NotNul
191192
@NotNull EntityPlayer entityPlayer) {
192193
TileEntity tileEntity = world.getTileEntity(lookingAtPos);
193194
Block block = blockState.getBlock();
194-
boolean result = block.removedByPlayer(blockState, world, lookingAtPos, entityPlayer, true);
195-
if (result) {
196-
world.playEvent(null, 2001, lookingAtPos, Block.getStateId(blockState));
197-
block.onPlayerDestroy(world, lookingAtPos, blockState);
198-
195+
if (block instanceof BlockSkull) {
199196
BlockUtility.startCaptureDrops();
200-
block.harvestBlock(world, entityPlayer, lookingAtPos, blockState, tileEntity, ItemStack.EMPTY);
201-
return BlockUtility.stopCaptureDrops();
197+
boolean result = block.removedByPlayer(blockState, world, lookingAtPos, entityPlayer, true);
198+
List<ItemStack> drops = BlockUtility.stopCaptureDrops();
199+
200+
if (result) {
201+
world.playEvent(null, 2001, lookingAtPos, Block.getStateId(blockState));
202+
block.onPlayerDestroy(world, lookingAtPos, blockState);
203+
204+
block.harvestBlock(world, entityPlayer, lookingAtPos, blockState, tileEntity, ItemStack.EMPTY);
205+
return drops;
206+
}
207+
} else {
208+
if (block.removedByPlayer(blockState, world, lookingAtPos, entityPlayer, true)) {
209+
world.playEvent(null, 2001, lookingAtPos, Block.getStateId(blockState));
210+
block.onPlayerDestroy(world, lookingAtPos, blockState);
211+
212+
BlockUtility.startCaptureDrops();
213+
block.harvestBlock(world, entityPlayer, lookingAtPos, blockState, tileEntity, ItemStack.EMPTY);
214+
return BlockUtility.stopCaptureDrops();
215+
}
202216
}
203217

204218
return Collections.emptyList();

0 commit comments

Comments
 (0)