#Block Entity not syncing data to client in specific instance.

14 messages · Page 1 of 1 (latest)

latent skiff
#

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.

#

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.

astral pike
#

do you have a repo?

latent skiff
#

I dont have a repo set up, but I stuck the BlockEntity class and its renderer on pastebin

astral pike
#

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

latent skiff
#

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.

astral pike
#

Hmm. You are using Inventories.writeNbt which only writes non-empty stacks

#

intended?

latent skiff
#

the javadocs didnt say that it doesnt write non-empty stacks dontFeelSorbWAAAAAAAA

astral pike
#

wut? I'm pretty sure it didn't

#

what does the debugger say?

latent skiff
#

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

astral pike
#

yea I had the same exact issue before