friendlyhj/ZenUtils

Using `world.getFakePlayer().simulateRightClickItem()` causing error

Closed this issue · 1 comments

My code:

val player = world.getFakePlayer();
player.simulateRightClickItem(item, crafttweaker.entity.IEntityEquipmentSlot.mainHand());

error written in crafttweaker.log:

[SERVER_STARTED][SERVER][ERROR] null
java.lang.NullPointerException
	at net.minecraft.entity.player.EntityPlayerMP.func_71110_a(EntityPlayerMP.java:989)
	at net.minecraft.entity.player.EntityPlayerMP.func_71120_a(EntityPlayerMP.java:984)
	at net.minecraft.server.management.PlayerInteractionManager.func_187250_a(PlayerInteractionManager.java:391)
	at youyihj.zenutils.impl.util.PlayerInteractionSimulation.lambda$simulateRightClickItem$0(PlayerInteractionSimulation.java:36)
	at youyihj.zenutils.impl.util.PlayerInteractionSimulation.ghostItemOperation(PlayerInteractionSimulation.java:113)
	at youyihj.zenutils.impl.util.PlayerInteractionSimulation.simulateRightClickItem(PlayerInteractionSimulation.java:34)
	at youyihj.zenutils.api.player.ZenUtilsPlayer.simulateRightClickItem(ZenUtilsPlayer.java:65)
	at CrafttweakerReloadablemods\Betteranimalsplus_event109.handle(mods\betteranimalsplus_event.zs:32)

Thank you! I would test it soon.