mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
parent
7cf6b9ac5b
commit
413d0dc6fa
1 changed files with 9 additions and 2 deletions
|
@ -27,6 +27,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.play.client.CPacketPlayerDigging;
|
import net.minecraft.network.play.client.CPacketPlayerDigging;
|
||||||
import net.minecraft.network.play.server.SPacketBlockChange;
|
import net.minecraft.network.play.server.SPacketBlockChange;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -163,8 +164,14 @@ public final class WorldUtil{
|
||||||
try{
|
try{
|
||||||
if(world instanceof WorldServer){
|
if(world instanceof WorldServer){
|
||||||
FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer)world);
|
FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer)world);
|
||||||
stack.onItemUse(fake, world, offsetPos, fake.getActiveHand(), side.getOpposite(), 0.5F, 0.5F, 0.5F);
|
ItemStack heldBefore = fake.getHeldItemMainhand();
|
||||||
return stack;
|
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){
|
catch(Exception e){
|
||||||
|
|
Loading…
Reference in a new issue