Properly send these events

This commit is contained in:
Shadows_of_Fire 2018-06-28 18:24:51 -04:00
parent 85038e9628
commit 3953c8b3b2

View file

@ -190,17 +190,13 @@ public final class WorldUtil {
//Everything else
try {
if (world instanceof WorldServer) {
FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer) world);
ItemStack heldBefore = fake.getHeldItemMainhand();
setHandItemWithoutAnnoyingSound(fake, EnumHand.MAIN_HAND, stack.copy());
fake.getHeldItemMainhand().onItemUse(fake, world, offsetPos, fake.getActiveHand(), side.getOpposite(), 0.5F, 0.5F, 0.5F);
fake.interactionManager.processRightClickBlock(fake, world, fake.getHeldItemMainhand(), EnumHand.MAIN_HAND, offsetPos, side.getOpposite(), 0.5F, 0.5F, 0.5F);
ItemStack result = fake.getHeldItem(EnumHand.MAIN_HAND);
setHandItemWithoutAnnoyingSound(fake, EnumHand.MAIN_HAND, heldBefore);
return result;
}
} catch (Exception e) {
ActuallyAdditions.LOGGER.error("Something that places Blocks at " + offsetPos.getX() + ", " + offsetPos.getY() + ", " + offsetPos.getZ() + " in World " + world.provider.getDimension() + " threw an Exception! Don't let that happen again!", e);
}