Posted September 7, 201312 yr 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.
September 7, 201312 yr Indeed, I just puzzled this out in my getLightValue() thread. Short version: the TileEntity from World is a server-side one while IBlockAccess is client-side. You can look at my explanation of what's happening as well as a possible workaround. http://www.minecraftforge.net/forum/index.php/topic,12125.msg63300.html#msg63300
September 7, 201312 yr 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.
September 7, 201312 yr 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.
September 8, 201312 yr 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.
September 8, 201312 yr 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.
September 8, 201312 yr 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.