Posted September 8, 20205 yr I am in the process of converting my existing blockstate based model to a tileentity due to excessive use of blockstates (4-value EnumProperty for each direction = 4096 + waterlogged = 8192 permutations!) I have an existing (generated) multipart blockstate json, is there any way to easily convert it to the same model, just using the data from the tileentity instead of the blockstate? I'm assuming I need to create a custom BakedModel, but I would ideally like to keep the current data-driven approach (one model for each of the 4 enum values). It's the first time I've started looking into custom models, and I think a TileEntityRenderer is overkill for static models. Please correct me if I'm wrong.
September 8, 20205 yr Author Perfect, thank you. I'll give that a go and return if I run into any issues.
September 11, 20205 yr Author Almost fully working. Only thing I'm now struggling with is forcing my TileEntity to sync. I'm calling markDirty and requestModelDataUpdate after changing the property, but the client side data doesn't refresh until I close and reopen the world. Do I need to send a custom packet, or is there an easier way of forcing a resync?
September 11, 20205 yr Author Even closer now. I do not want to update neighbours, as the property is changed from Block#neighborChanged, and I do not want to cause an infinite loop. //Called after updating property BlockState blockState = getBlockState(); //Do not update neighbours getWorld().notifyBlockUpdate(getPos(), blockState, blockState, Constants.BlockFlags.BLOCK_UPDATE | Constants.BlockFlags.RERENDER_MAIN_THREAD); requestModelDataUpdate(); I also call requestModelDataUpdate at the end of handleUpdateTag. The data is now correct on the client (displayed when right clicked), but the render is always 1 step behind (Only updates once another block is placed).
September 12, 20205 yr Author 11 hours ago, diesieben07 said: Call requestModelDataUpdate client-side 11 hours ago, Alpvax said: the end of handleUpdateTag I already do call it client side. I have now removed the server side call, but nothing has changed.
September 12, 20205 yr Author Alpvax/AdvancedAutocrafting 1.16_wireTEs branch TileEntity: block.tile.WireTileEntity Block: block.WireBlockV2 The model stuff is in client.data.model. Edited September 12, 20205 yr by Alpvax Fix URL
September 12, 20205 yr Author I saw, thank you. I'll hopefully test it tomorrow, but it looks good. I've never managed to get my head around this, so thanks for helping. Edited September 12, 20205 yr by Alpvax
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.