Jump to content

New onItemUseFirst issue.


rich1051414

Recommended Posts

If you return true to cancel a block's activation, it also prevents onItemUseFirst from running on the server entirely, you can reproduce this like this. Make a generic item and override onItemUseFirst, do a System.out.println(FMLCommonHandler.instance().getEffectiveSide()) then return true. It will only say client.

 

Do it again only returning false and it will return client and server, but then the blocks menu will activate.

 

Surely this is not intended, The server SHOULD cancel the activating block, but it shouldn't cancel the items onItemUseFirst as well(or maybe the client is prevented from sending the packet)...

 

I understand that System.out.println() could be reporting wrong, BUT I have other methods called from it, and those also do not run server side. When I call functions before returning true that should run both sides, it seems those are also only working client side, like playing sounds. When I call the exact same function from OnItemUse, the sounds work, but from OnItemUseFirst, they do not.

 

Edit: OH i see the problem, the function is triggered by theItemInWorldManager.activateBlockOrUseItem, and returning true prevents the server from going into any item use calls... God knows why OnItemUseFirst isn't simply ran on both server and client, and it can see for itself whether or not to activate the block... It's not a problem to force it to client side unless it is returning false from the method itself -_-

 

I solved it by just sending a packet and doing the server stuff from my packet handler.

Link to comment
Share on other sites

Its working as intended, you need to undertstand that it compleetly prevents any further processing, which means the server doesnt event get told the user did anything if you cancel it on the client.

So, just work with it.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.