Compatibility issue with The Lost Cities - modded block IDs get mangled in some cases when over 4096
HariboTer opened this issue ยท 0 comments
(I'm just presuming the curseforge description is a bit outdated in this regard, please don't hit me if I'm wrong)
This issue was originally brought up in the LostCities issue tracker, so for my fully detailed investigation please see McJtyMods/LostCities#308
Short summary: LostCities generates buildings made from the wrong blocks when the IDs of the blocks that are supposed to be used exceed 4096. (it could also be 4095, I couldn't test it that exactly, but you get the idea). Also, out of dozens of generation mods that are used, only LostCities seems to be affected.
So from what I could gather, here is what the LostCities does relating to this case:
`
// the block that should be used is read from a text file by name
Block b = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("mod:moddedblocknamewithoutmeta"));
// this gets combined with a meta value to a block state
IBlockState state = b.getDefaultState(); // either that or appropriate alternative if there is a meta value provided in the text file
// another class later turns this into a char (numerical ID) like this:
char c = (char)Block.BLOCK_STATE_IDS.get(state);
// yet another class later uses this char ID to retrieve back a BlockState
IBlockState stateBack = Block.BLOCK_STATE_IDS.getByValue(c);
// and that is when it is given to a regular ChunkPrimer to actually set the block in the world
primer.setBlockState(x, y, z, stateBack);
`
Somewhere during this conversion process, the ID gets capped by 4096 - meaning if the ID of the block given in the text file is 4896, the ID of the block that is actually placed will be 800.
Could it be that Block.BLOCK_STATE_IDS is not adapted to the changes made by JEID?