Fabric API

Fabric API

106M Downloads

BlockEntity Lifecycle Events Don't Trigger Intuitively

FreezePhoenix opened this issue ยท 5 comments

commented

BlockEntity UNLOAD don't seem to appear to trigger when a chunk exits render distance, nor do they trigger when the player exits the dimension while they are outside of render distance.

Notably, they do fire the UNLOAD event if the player changes dimensions while they are in render distance.

Secondly, the client LOAD event triggers before the NBT is read from the packet the server sends the client. This can be an issue, if the load handler needs to do something using data that could be in the NBT.

commented

Potentially related to #1821 and #1822

commented

First part is rather easy to fix, working on it.

However:

Secondly, the client LOAD event triggers before the NBT is read from the packet the server sends the client. This can be an issue, if the load handler needs to do something using data that could be in the NBT.

While it would be possible to fix this for server->client syncing, this won't be perfect. This can't really be fixed in all circumstances as the LOAD event will be called immediately when the block is set on the client, before the block entity is modified. For example, if you place an Ominous Banner, the event will fire before the block entity receives the data from the banner stack.

I will add a comment warning about this behavior, but I don't think it's feasible to change it.

commented

Thanks very much!

commented

Thank you for the report. :)

commented

@Technici4n Does the new Components system change this?