Jump to content

Desynchronization of inventory and anvil (1.12.2)


Recommended Posts

 I want to say that I am a newbie and a simpleton in modding. I've been working on this for a long time, but I can't find a solution. The point is, I've created an NPC that has an anvil function. However, I can't move items in the inventory while in the anvil menu. They just go back to where I took them from. And when I click on empty inventory slots, items randomly move around the inventory and sometimes get duplicated. As far as I understand, this is related to synchronization between the client and server. I can't get this synchronization to work properly. Although I managed to do it for other functions. I encountered a similar problem when I wanted to implement trading with villagers in the same way. But back then, I ended up creating the trading function from scratch, as I couldn't solve the desynchronization issue.

If you have an idea why synchronization is not working, advice or a possible solution to the problem, I will be very grateful to you.

My Code:

Spoiler

TheAnvil.java - GUI of the anvil that opens when you press a special button.

https://drive.google.com/file/d/1rHwCqS_heow5uBHkD8CqvOwEpl60fZKS/view?usp=sharing

ContainerAnvil.java - This module should synchronize the states between the client and the server.

https://drive.google.com/file/d/1tSyktS36G2MdzWX8IBdeRIbXxou0cMY7/view?usp=sharing

 

Link to comment
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.
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.



×
×
  • Create New...

Important Information

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