Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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

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.

  • Author
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

  • Author

I may just move it off somewhere else on the screen and make it inaccessible, feels kind of like a hack job but it's what works.

  • Author

Figured out why it's acting this way, it actually had nothing to do with the way I'd handled the client-server, removing the armor and crafting slots fucks with the slot indices, kind of obvious but I overlooked it.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.