Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.5] Help with custom Backpack (slot background and mouse wheel move)


Recommended Posts

1 minute ago, diesieben07 said:

What?

If, as explained above,

I want to swap the item in the player's hand for the item from a slot in the backpack (when the player presses a key or sneak and uses the mouse wheel)

I also need a message again, am I correct?

Link to post
Share on other sites
Posted (edited)
51 minutes ago, diesieben07 said:

Yes, you do, because inventory manipulation has to be done server side.

okay I have now created 3 more messages (NextTool, ToolDown, ToolTop) these are currently only sent by pressing keys, and later also by scrolling with the mouse

unfortunately only the first message works, which always gives the player the next tool. at the others,

the player's hand moves but he doesn't get a new item

this is my ClientTickEvent

 

why do only the first message?

and how do I prevent the permanent switch of tools when pressing (adding a cooldown)?

Edited by Luis_ST
Link to post
Share on other sites

Okay, some things about your packet system which I noticed:

  1. Your "decode" method is actually the encoder.
  2. Your "encode" method is actually the decoder.
  3. The decoder (your "encode") method should not be an instance method. It makes no sense for it to be. It should be static.
  4. The encoder (your "decode") method shouldn't receive a message parameter - it is already an instance method. Same goes for the handle method.

Your messages don't work correctly, because you send all of them twice. All tick events fire twice every tick, you must check TickEvent#phase.

Link to post
Share on other sites
45 minutes ago, diesieben07 said:

Okay, some things about your packet system which I noticed:

okay i have applied your notice on my packet system

now the other 2 messages also work

 

49 minutes ago, diesieben07 said:

Your messages don't work correctly, because you send all of them twice. All tick events fire twice every tick, you must check TickEvent#phase

is there another possibility to add a delay/cooldown, because despite the TickEvent#phase check you can still change the tools too quickly

Link to post
Share on other sites
Just now, Luis_ST said:

is there another possibility to add a delay/cooldown, because despite the TickEvent#phase check you can still change the tools too quickly

Of course you can make cooldowns.

  • Thanks 1
Link to post
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.

Guest
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 Privacy Policy.