Facades created for "invalid" metadata values
Xilef11 opened this issue ยท 3 comments
BuildCraft version: 7.99.16
Forge version: 1.12.2-14.23.3.2661
Link to crash report or log: see Runes of Wizardry #44
Singleplayer or multiplayer: Singleplayer
Steps to reproduce: Look at the Facades in JEI/Creative menu with Runes of Wizardry Installed
Additional information:
It seems that for one of my blocks, Buildcraft creates Facades for all 16 metadata values instead of just the 4 that are "valid" as per my getSubItems/getSubBlocks methods. i.e. I get only 4 variants of the "full" block in the creative menu, but facades for 16 blocks.
Block
ItemBlock
The item from which the blocks are built
Let me know if it's something I forgot to implement...
For starters I'd recommend always checking the meta bounds in EnumDustTypes
just for safety (and returning a sensible default if the given meta is out of bounds).
I think this is happening because your block class has 16 valid property values (as specified here, but only 4 of them are actually used. We don't use getSubItems
because that misses some valid variants with other blocks (like wooden logs, as those can be placed in any direction in-world, but as facades we need to know that ahead of time).
I'd recommend finding a way to encode dust types directly (perhaps by using different block classes for every block and PropertyEnum
for the property).
@Xilef11 Thanks for the quick fix!
Although if you ever do need to disable a facade for certain block combinations then you should either use or copy the IMC message sending mechanism specified here: https://github.com/BuildCraft/BuildCraftAPI/blob/8.0.x/api/buildcraft/api/facades/FacadeAPI.java.
(Although it might not work yet, as I haven't actually tested :/)
For starters I'd recommend always checking the meta bounds in EnumDustTypes just for safety (and returning a sensible default if the given meta is out of bounds).
There's not much I can do in terms of a "sensible default" here, but it's definitely the easiest way to prevent a crash
I think this is happening because your block class has 16 valid property values (as specified here, but only 4 of them are actually used. We don't use getSubItems because that misses some valid variants with other blocks (like wooden logs, as those can be placed in any direction in-world, but as facades we need to know that ahead of time).
So you basically create facades for every possible block/property combinations? That would explain what happens.
I'll see what I can do to fix that "properly", but as a second option, is there a way to manually stop facades from being generated for certain blocks/blockstates? the fix was easy, just initialize the property with the correct range in createBlockState for each block instance.