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.

Featured Replies

Posted

I'm trying to update a render (and collision box/bounding box) of a block with a short value stored in a Tile Entity. It was not updating, so I added debug outputs to all related methods (renderWorldBlock in my rendering handler class and getCollisionBoundingBoxFromPool and getBoundingBoxFromPool in my block class), and, lo and behold, only the method that is being given an instance of World and not IBlockAccess was getting the short value correctly. My theory at this point is that either IBlockAccess's getBlockTileEntity is broken or I am casting the tile entity wrongly. What is confusing to me is that it would update the render properly before I made the render update on a random tick, but not now.

 

Related code:

https://github.com/myoKun345/Ars-Herbologica/blob/master/herbologica_common/herbologica/block/crop/BlockHerbologicaBush.java

 

https://github.com/myoKun345/Ars-Herbologica/blob/master/herbologica_common/herbologica/render/BushRender.java

 

https://github.com/myoKun345/Ars-Herbologica/blob/master/herbologica_common/herbologica/tileentity/crop/TileEntityBush.java

 

The rest of the code is in the repository if needed.

 

Thanks in advance.

  • Author

Well, it only half fixed it. Saving and reloading the world just breaks it again, meaning the client version of the tile entity is not being saved between loads.

 

EDIT: And then placing a new instance of this block in the world both breaks any further updates and crashes the game after a while of ticking.

Well, it only half fixed it. Saving and reloading the world just breaks it again, meaning the client version of the tile entity is not being saved between loads.

 

EDIT: And then placing a new instance of this block in the world both breaks any further updates and crashes the game after a while of ticking.

 

Is your TileEntity using NBT to save data? I don't have the problem you mention.

Yes, I am using NBT.

 

Well while researching more on my issue from my thread, I realized that when you load a world with blocks already placed, updateTick gets called right away which means the cached World objects are NULL causing a crash.

 

Perhaps that's what you've encountered? I'm still working on a better resolution.

After following this through the debugger, the bottome line is when IBlockAccess calls World.getBlockTileEntity() the "world" is always a WorldClient according to the "variables" window in Eclipse.

 

I guess the only workaround would be to make sure you're always interacting with a client TileEntity. The problem here is some methods such as updateTick are server only so the World parameter that is passed in the function definition is never a WorldClient.

  • Author

I was thinking I may have to send packets to fix this now... but this is a pretty annoying bug.

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.