poopoodice Posted October 8, 2019 Posted October 8, 2019 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? Quote
poopoodice Posted October 8, 2019 Author Posted October 8, 2019 On 10/8/2019 at 8:01 AM, 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? Expand 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). Quote
poopoodice Posted October 8, 2019 Author Posted October 8, 2019 On 10/8/2019 at 8:11 AM, diesieben07 said: You can override canContinueUsing to control the abort behavior. Expand 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. Quote
poopoodice Posted October 8, 2019 Author Posted October 8, 2019 On 10/8/2019 at 8:38 AM, 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 Expand I just can't find it, in vanilla Item class as well. Quote
poopoodice Posted October 8, 2019 Author Posted October 8, 2019 (edited) On 10/8/2019 at 9:06 AM, diesieben07 said: Update Forge. The method was added in #2805. Expand 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, 2019 by poopoodice Quote
poopoodice Posted October 8, 2019 Author Posted October 8, 2019 On 10/8/2019 at 9:38 AM, 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. Expand What kind of checks should I do, except the damage? Quote
poopoodice Posted October 8, 2019 Author Posted October 8, 2019 (edited) On 10/8/2019 at 9:50 AM, 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. Expand Thanks ; ) Edited October 8, 2019 by poopoodice Quote
Recommended Posts
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.