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.

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

Featured Replies

Posted

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

  • Author

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

  • Author

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

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.