Posted October 8, 20196 yr I used Mouse.isButtonDown() in the custom item class to replace the vanilla onUsingTick because it wasn't working as well as expected. But this method does not work in multiplayer. Does sending packets to the server fix this problem?
October 8, 20196 yr Author 1 minute ago, diesieben07 said: Yes, you could send a packet when the player starts and stops holding the mouse button. What are you trying to achieve? onUsingTick solves exactly this problem already. Why does it not work for you? Well, the problem of onUsingTick is the item can't be damaged when holding right-click. Otherwise, it just returns a new itemstacks which interrupts the player's action (onUsingTick still being called when the player has already released the right mouse button).
October 8, 20196 yr Author 11 minutes ago, diesieben07 said: You can override canContinueUsing to control the abort behavior. I did find somebody says to use this method to avoid the problem on the internet but I remember that I couldn't find the method in Item class. And I've tried it again just then, still couldn't find it.
October 8, 20196 yr Author 6 minutes ago, diesieben07 said: 1.14.4: https://github.com/MinecraftForge/MinecraftForge/blob/5e9380ab85/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java#L651-L663 1.12.2: https://github.com/MinecraftForge/MinecraftForge/blob/863ab2ca18/patches/minecraft/net/minecraft/item/Item.java.patch#L708-L719 I just can't find it, in vanilla Item class as well.
October 8, 20196 yr Author 26 minutes ago, diesieben07 said: Update Forge. The method was added in #2805. Alright, I'm updating now. So if I Override it and always return true, it will be able to solve the problem, or I need to add some checkings? And I had ran ./gradlew setupDecompWorkspace do I still need to run ./gradlew eclipse? Edited October 8, 20196 yr by poopoodice
October 8, 20196 yr Author 10 minutes ago, diesieben07 said: You need to actually check if the item is still valid to be used. It could be a completely different item now, not just damage changed. What kind of checks should I do, except the damage?
October 8, 20196 yr Author 12 minutes ago, diesieben07 said: You need to return true if it's okay to keep using the item. The definition of what that means is up to your use case. At minimum you should check if the new stack is a completely different Item. Thanks ; ) Edited October 8, 20196 yr by poopoodice
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.