Jump to content

Recommended Posts

Posted

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?

Posted
 
 
 
 
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).

Posted
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.

Posted (edited)
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 by poopoodice
Posted
 
 
 
 
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?

Posted (edited)
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 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.

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.

Announcements



×
×
  • Create New...

Important Information

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