Jump to content

[SOLVED]1.15.2 Items duplicating in player inventory, erratic behavior when interacting with other vanilla containers


Turtledove

Recommended Posts

I've implemented a basic inventory organization system in survival, all the tabs work and it organizes the items successfully across the different containers, all done server-side. However, I've discovered an annoying bug:

 

When players first pick up items (excuse the fact that the slots aren't correctly positioned over the texture, I'm just focused on getting it working first since none of this is permanent), it 

 

a) Doesn't show up in the player hotbar in normal gameplay, outside the inventory.

 

b) After A), when I open the inventory, there's no duplicates, the items are in their correct spot. But when I then open up a crafting table for instance and then open the inventory, the items duplicate and shows up twice in the inventory, in the hot bar and in the first row of the 3x9 space. The following is after:

1. Picking up a stack of 4 potatoes and 1 wheat

2) Opening a furnace, where it correctly shows the items I picked up, and makes the item show up in my hotbar.

3) Exiting the furnace, and opening the inventory, this causes the duplication to occur (it doesn't seem to be a real duplication, just a ghost item).

4) Dropping 2 potatoes with Q

 

There seems to be some client-server problems that I can't pinpoint, since I've implemented this container identical to the default, using the vanilla item handlers. The containers and inventory are custom.

 

image.png.8fd4ee8d086909ce694381d4436ebbf3.png

 

EDIT: Just tried using the vanilla container instead of my custom implementation, and it works without issue. So something's not right with my container, even though it's identical to the vanilla one except it doesn't have armor slots or crafting tables.

Edited by Turtledove
Link to comment
Share on other sites

2 hours ago, Turtledove said:

So something's not right with my container

Probably true, you most likely didn't sync the data from the server to the client so the client remembers the items that were originally there without the update. If you have a container, it should be the same process as anything else to add the container to the gui. Telling us something is wrong without showing a reference is also not helpful since we have to guess on what to fix based on prior posts.

Link to comment
Share on other sites

22 minutes ago, ChampionAsh5357 said:

Probably true, you most likely didn't sync the data from the server to the client so the client remembers the items that were originally there without the update. If you have a container, it should be the same process as anything else to add the container to the gui. Telling us something is wrong without showing a reference is also not helpful since we have to guess on what to fix based on prior posts.

It's just because there's nothing to reference, the container is almost exactly the vanilla one, and the inventory works perfectly fine when I don't remove the code adding the armor and crafting slots. I've registered a containertype and the screen, and it's called on the server.

 

I guess my brain is just scrambled by the fact that it only works when the armor slot and crafting slots are present, which kind of defeats the purpose of a custom inventory, and I was trying to figure out why that is, moreso than the code itself which again, was just copy/pasted from the vanilla one for testing.

Edited by Turtledove
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.