Posted May 3, 201510 yr Every time I use an item I get the normal PlayerInteractEvent and immedeatly another playerinteract event that has blockpos 0 0 0, facing null and it really serves no purpose except its annoying to have to account for it. A simple check with if(pos.getY() != 0) suffices, but it got me wondering why its even in there or what the purpose of this "null" event is? I traced it back to MinecraftServer.java at line 726 with public void updateTimeLightAndEntities() { this.theProfiler.startSection("jobs"); Queue queue = this.futureTaskQueue; synchronized (this.futureTaskQueue) { while (!this.futureTaskQueue.isEmpty()) { try { /*----->*/ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.futureTaskQueue.poll())); } catch (Throwable throwable2) { logger.fatal(throwable2); } } } I decided to purposely throw a wrench in the works to find it. [19:18:35] [server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.entity.player.PlayerInteractEvent@8ffdc7: java.lang.NullPointerException at net.minecraft.util.BlockPos.offset(BlockPos.java:209) ~[blockPos.class:?] at net.minecraft.util.BlockPos.offset(BlockPos.java:198) ~[blockPos.class:?] at tschallacka.whotookmycookies.events.BlockEventListeners.itemUsedEventHandler(BlockEventListeners.java:124) ~[blockEventListeners.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_9_BlockEventListeners_itemUsedEventHandler_PlayerInteractEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?] at net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(ForgeEventFactory.java:120) [ForgeEventFactory.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:604) [NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:67) [C08PacketPlayerBlockPlacement.class:?] at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:114) [C08PacketPlayerBlockPlacement.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) [PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [?:1.7.0_65] at java.util.concurrent.FutureTask.run(FutureTask.java:262) [?:1.7.0_65] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) [FMLCommonHandler.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.7.0_65] [19:18:35] [server thread/ERROR] [FML]: Index: 1 Listeners: [19:18:35] [server thread/ERROR] [FML]: 0: NORMAL [19:18:35] [server thread/ERROR] [FML]: 1: ASM: tschallacka.whotookmycookies.events.BlockEventListeners@748834 itemUsedEventHandler(Lnet/minecraftforge/event/entity/player/PlayerInteractEvent;)V So to recap, i'm merely curious why this one is there. it has all set to null basically with no reference to the originating thing that causes the event to be fired. How much wood could a woodchuck chuck if a wood chuck could chuck wood - Guybrush Treepwood I wrote my own mod ish... still a few bugs to fix. http://thaumcraft.duckdns.org/downloads/MagicCookies-1.0.6.4.jar
May 3, 201510 yr Author no, this fires within if(!event.world.isRemote) How much wood could a woodchuck chuck if a wood chuck could chuck wood - Guybrush Treepwood I wrote my own mod ish... still a few bugs to fix. http://thaumcraft.duckdns.org/downloads/MagicCookies-1.0.6.4.jar
May 3, 201510 yr Author [21:10:09] [server thread/WARN] [WHOTOOKMYCOOKIE]: event.pos = BlockPos{x=0, y=0, z=0} [21:10:09] [server thread/WARN] [WHOTOOKMYCOOKIE]: event.action RIGHT_CLICK_AIR [21:10:09] [server thread/WARN] [WHOTOOKMYCOOKIE]: event.entity EntityPlayerMP['Player810'/206, l='New World', x=3,88, y=44,00, z=9,79] [21:10:09] [server thread/WARN] [WHOTOOKMYCOOKIE]: event.entityLiving EntityPlayerMP['Player810'/206, l='New World', x=3,88, y=44,00, z=9,79] [21:10:09] [server thread/WARN] [WHOTOOKMYCOOKIE]: event.entityPlayer EntityPlayerMP['Player810'/206, l='New World', x=3,88, y=44,00, z=9,79] [21:10:09] [server thread/WARN] [WHOTOOKMYCOOKIE]: event.face null [21:10:09] [server thread/WARN] [WHOTOOKMYCOOKIE]: event.useBlock DENY [21:10:09] [server thread/WARN] [WHOTOOKMYCOOKIE]: event.useItem DEFAULT [21:10:09] [server thread/WARN] [WHOTOOKMYCOOKIE]: event.world net.minecraft.world.WorldServerMulti@4b95ed [21:10:09] [server thread/WARN] [WHOTOOKMYCOOKIE]: event.getPhase() NORMAL [21:10:09] [server thread/WARN] [WHOTOOKMYCOOKIE]: event.getResult() DEFAULT [21:10:09] [server thread/WARN] [WHOTOOKMYCOOKIE]: event.hasResult() false Okay... so right click air doesnt give position? I guess you could get the position from the player location in that case. So basically right click air always fires even when the event that initialises this was a lava bucket placing lava? Is that because you "cross" through air on the way to the block? I kinda get the logic now behind this "double" event fire. Although i'd expect the air event to fire before the item used on a block event. but I guess thats a matter of opinion. How much wood could a woodchuck chuck if a wood chuck could chuck wood - Guybrush Treepwood I wrote my own mod ish... still a few bugs to fix. http://thaumcraft.duckdns.org/downloads/MagicCookies-1.0.6.4.jar
May 3, 201510 yr Author Ah. That makes sense. How much wood could a woodchuck chuck if a wood chuck could chuck wood - Guybrush Treepwood I wrote my own mod ish... still a few bugs to fix. http://thaumcraft.duckdns.org/downloads/MagicCookies-1.0.6.4.jar
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.