KAMKEEL / CustomNPC-Plus

Custom Version of 1.7.10 CustomNPC with backported features and original expansions
https://www.curseforge.com/minecraft/mc-mods/customnpc-plus
Other
53 stars 34 forks source link

[Bug] Player Scripts somehow disable themselves sometimes with no error/warning #87

Closed 20Whey closed 1 year ago

20Whey commented 1 year ago

Issue description: all was well, I was programming in some sort of pseudo block place detection with utilisation of mouse events and item stacks. after I finished getting mouse button ids, the code just stopped running inexplicably. I restarted my game, rejoined, added checks for other events, tested in local and only a server restart resolved the issue. no errors appeared in my console or client log. the code I was using will be below incase it's useful Versions:

offending script

function mouseClicked(event) { var cStack = event.player.getHeldItem(); var LStack = event.player.getTempData("lItem"); if(cStack != null){ if (cStack.getName() != LStack){ var cNm = cStack.getName(); event.player.sendMessage(event.player.getHeldItem().getName()); event.player.setTempData("lItem", cNm); }}}

function breakBlock(event){ event.player.sendMessage("cring"); }

fcysta commented 1 year ago

It did crash at first when I ran. But there are some issues I need to point out. Why not just use "cNm" in the seventh line? I need to mention that there is nothing wrong with your "breakBlock". Although this is a bit weird, I can't reproduce it now. If you still can't get it to work, a short video might help me understand why. English is not my first language, so I can't use it very well, good luck.

KAMKEEL commented 1 year ago

May be patched in 1.8.4 - Reopen if it persists

20Whey commented 1 year ago

I'll test it out, thank you for the follow up!