Jump to content

[Unsolved][1.9]TileEntity ticked once after it is unloaded (Forge Bug?)


maxanier

Recommended Posts

Hello,

 

I have a strange problem with a tickable TileEntity.

My tile is checking a blockstate property of it's block each update tick, which normally works fine.

But when the chunk is unloaded on client side, there is one tick where the tileentity is still updated, but the block at it's position is (already) an air block.

 

Here is my tile:

https://github.com/TeamLapen/Vampirism/blob/e0a40c903fd8481a5d5c93cb327b78e497462cff/src/main/java/de/teamlapen/vampirism/tileentity/TileCoffin.java#L75

and the block:

https://github.com/TeamLapen/Vampirism/blob/e0a40c903fd8481a5d5c93cb327b78e497462cff/src/main/java/de/teamlapen/vampirism/blocks/BlockCoffin.java#L56

 

When moving away from a placed coffin and it is unloaded, there is one tick with an air block at the position and my code logs the stacktrace:

at de.teamlapen.vampirism.blocks.BlockCoffin.isHead(BlockCoffin.java:57) [blockCoffin.class:?]

at de.teamlapen.vampirism.tileentity.TileCoffin.update(TileCoffin.java:75) [TileCoffin.class:?]

at net.minecraft.world.World.updateEntities(World.java:1936) [World.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1880) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1114) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:401) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51]

at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51]

 

I have verifiered the problem with another TileEntity as well. (At serverside there seems to be no problem (with remote check removed of cause).

 

Is there a bug in my code or is this intended by Forge or is it a Forge bug?

I guess it is a forge bug, see post below.

 

Minecraft Forge: v12.16.0.1865

 

Thanks

Minecraft Second Screen Mod: Use your mobile as a second screen for Minecraft and see your inventory, redstone stati, the chat and much more on it.

link

Vampirism: Become a vampire in Minecraft

link

Link to comment
Share on other sites

Alright I took a second look at the Forge/Minecraft code and might have an idea where this problem is coming from:

 

The world#updateEntities method checks if the block is loaded before ticking it, but it uses World#isBlockLoaded(BlockPos) for that, which calls #isBlockLoaded(BlockPos,true), which also considers empty chunks as loaded. Apparently unloaded chunks on client side are (sometimes) converted to empty chunks. So the update loop thinks the block is loaded, and updates the tile entity even though the tile's block is already unloaded. Unfortunatly the tile entity (which is marked to be removed by Chunk#onChunkUnload) is removed AFTER the update method was called.

 

 

Can somebody confirm this?

Minecraft Second Screen Mod: Use your mobile as a second screen for Minecraft and see your inventory, redstone stati, the chat and much more on it.

link

Vampirism: Become a vampire in Minecraft

link

Link to comment
Share on other sites

I want to create a Forge issue, but I would prefer if someone could confirm this issue beforehand. Maybe I'm missing something

Minecraft Second Screen Mod: Use your mobile as a second screen for Minecraft and see your inventory, redstone stati, the chat and much more on it.

link

Vampirism: Become a vampire in Minecraft

link

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.

Announcements



×
×
  • Create New...

Important Information

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