The Meaning of Life, the Universe, and Everything.
Join Date:
4/26/2014
Posts:
44
Minecraft:
minerguy31
Member Details
I'm trying to add a feature to my mod where it takes every block registered, overlays a semi-transparent texture on that, and then registers a corresponding block. I know this is possible; some examples of similar implementations would be extra utilities (microblocks), ae2 (cable facades), and buildcraft (facades). I'm fairly new to modding, so I can't really look at other people's code and make much sense of it.
GameData.getBlockRegistry() is a Collection containing all registered Blocks, though adding duplicates of that many blocks is very likely to cause you problems.
For one, there can only ever be 4096 blocks, so if someone has enough modded blocks to bring the total in game to 2049, you will run out of block IDs and crash.
Another point is that many blocks have sub-blocks which the server does not necessarily know about - how will you handle those?
Depending on what, exactly, you are trying to accomplish, it may be simpler to use one of Forge's events to render an extra layer over existing blocks that have been flagged somehow, perhaps by storing a list of affected block coordinates somewhere and using that to determine which ones need special rendering.
The Meaning of Life, the Universe, and Everything.
Join Date:
4/26/2014
Posts:
44
Minecraft:
minerguy31
Member Details
Then how do other mods accomplish it? I mean, for example, the extra utilities microblocks has like 4 different microblocks for every block (examples: pipe jacket, fences, walls, and not to mention all the different color frequencies of some blocks), meaning the cap is brought down to less than 1024 blocks. But it still works, with the ~500 in vanilla, and ~2000 more from all the other mods.
I have no idea how other mods accomplish it, having never tried to do such a thing myself nor have I ever used any of the mods you mention; however, I suspect they are not actually registering new blocks, but rather rendering their own overlays on top of them, or perhaps each of their blocks is actually a TileEntity that stores which type of block it is supposed to be and then renders accordingly.
If any of those mods are open source, I highly suggest you start by looking there and seeing how they accomplished it, if you haven't already, and if you can't make much sense of it, then I would suggest starting by getting better at Java so that you can understand it.
I'm trying to add a feature to my mod where it takes every block registered, overlays a semi-transparent texture on that, and then registers a corresponding block. I know this is possible; some examples of similar implementations would be extra utilities (microblocks), ae2 (cable facades), and buildcraft (facades). I'm fairly new to modding, so I can't really look at other people's code and make much sense of it.
https://www.youtube....EN8PxT5KYO4X0Ow
GameData.getBlockRegistry() is a Collection containing all registered Blocks, though adding duplicates of that many blocks is very likely to cause you problems.
For one, there can only ever be 4096 blocks, so if someone has enough modded blocks to bring the total in game to 2049, you will run out of block IDs and crash.
Another point is that many blocks have sub-blocks which the server does not necessarily know about - how will you handle those?
Depending on what, exactly, you are trying to accomplish, it may be simpler to use one of Forge's events to render an extra layer over existing blocks that have been flagged somehow, perhaps by storing a list of affected block coordinates somewhere and using that to determine which ones need special rendering.
Then how do other mods accomplish it? I mean, for example, the extra utilities microblocks has like 4 different microblocks for every block (examples: pipe jacket, fences, walls, and not to mention all the different color frequencies of some blocks), meaning the cap is brought down to less than 1024 blocks. But it still works, with the ~500 in vanilla, and ~2000 more from all the other mods.
https://www.youtube....EN8PxT5KYO4X0Ow
I have no idea how other mods accomplish it, having never tried to do such a thing myself nor have I ever used any of the mods you mention; however, I suspect they are not actually registering new blocks, but rather rendering their own overlays on top of them, or perhaps each of their blocks is actually a TileEntity that stores which type of block it is supposed to be and then renders accordingly.
If any of those mods are open source, I highly suggest you start by looking there and seeing how they accomplished it, if you haven't already, and if you can't make much sense of it, then I would suggest starting by getting better at Java so that you can understand it.