For some reason, regardless of what I do, the last item transferred into the output block will just not be updated on the client side. ive looked at the written nbt compound, as well as the read nbt compound. for some reason the written nbt compound has Air written to it, but the read nbt compound is still reading the last inputted item. i dont get it.
#Block Entity not syncing data to client in specific instance.
14 messages · Page 1 of 1 (latest)
ive been trying to figure this out for hours now. ive marked the block entity as dirty on the server side everywhere that interacts with the item stack. but nothing works.
do you have a repo?
I dont have a repo set up, but I stuck the BlockEntity class and its renderer on pastebin
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
https://fabricmc.net/wiki/tutorial:blockentity_modify_data
If you want clients to know the update (for example, they may be need to render, or pick-stack without holding Ctrl), add an extra line after the markDirty call, so that the client will know the block entity has been changed:
world.updateListeners(pos, state, state, 0);
markDirty is just for saving to file on world unload
my Block Entity class overrides markDirty to include that call, so it should work reguardless.
but despite that, I added world.updateListeners to my tick method, ive tried before and after i call markDirty, and ive tried using 0 and Block.NOTIFY_LISTENERS as the flags, but none of the combinations ive tried just leave the result the same.
Hmm. You are using Inventories.writeNbt which only writes non-empty stacks
intended?
the javadocs didnt say that it doesnt write non-empty stacks 
Okay yeah despite what Inventory.writeNbt is labelled, it doesnt seem to write empty stacks. swapping to manually serializing the stack into nbt fixed the issue immediately
yea I had the same exact issue before