Posted December 12, 20187 yr I'm defining custom logic for an item via onItemUse. While debugging I'm noticing that the method is actually called twice - once from the main thread and once from the server thread. This wasn't noticeable until I sent a message to the player - it shows twice. player.sendMessage(new TextComponentTranslation("text.scroll.backfire_poison")); I'm not sure what to do - I'm making block changes (right click a block to change it...) so this needs to run on the server but setting @SideOnly(Side.SERVER) doesn't work here. I need to find a way to prevent this from running twice.
December 12, 20187 yr Author I will, but the side aspect now seems unrelated to my issue, unless I have to get way more complex and split these up into logical client/server methods and have them communicate, which I hope is unnecessary..
December 12, 20187 yr No, but the side is important here. You see 2 messages because one is from the client and one from the server. The solution is in the "Performing Side-Specific Operations" portion. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
December 12, 20187 yr Author Ok, I'm new to this so it took me a while to understand it all but the example they spelled out solved my issue. Quote For example, if you want to damage the player every time they click your block, or have your machine process dirt into diamonds, you should only do so after ensuring world.isRemote is false. Applying game logic to the logical client can cause desynchronization (ghost entities, desynchronized stats, etc.) in the lightest case, and crashes in the worst case. Thanks for pointing me in the right direction.
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.