From 413d0dc6fa58f929152b6d467daac270e214ca40 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 5 Dec 2016 14:11:20 +0100 Subject: [PATCH] Fix the placer not working Closes #451 --- .../ellpeck/actuallyadditions/mod/util/WorldUtil.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java index b158b9ee2..1c6edf728 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java @@ -27,6 +27,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.network.play.client.CPacketPlayerDigging; import net.minecraft.network.play.server.SPacketBlockChange; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; @@ -163,8 +164,14 @@ public final class WorldUtil{ try{ if(world instanceof WorldServer){ FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer)world); - stack.onItemUse(fake, world, offsetPos, fake.getActiveHand(), side.getOpposite(), 0.5F, 0.5F, 0.5F); - return stack; + ItemStack heldBefore = fake.getHeldItemMainhand(); + fake.setHeldItem(EnumHand.MAIN_HAND, stack.copy()); + + fake.getHeldItemMainhand().onItemUse(fake, world, offsetPos, fake.getActiveHand(), side.getOpposite(), 0.5F, 0.5F, 0.5F); + + ItemStack result = fake.getHeldItem(EnumHand.MAIN_HAND); + fake.setHeldItem(EnumHand.MAIN_HAND, heldBefore); + return result; } } catch(Exception e){