BuildCraft|Core

BuildCraft|Core

7M Downloads

Add better valid block combination detection heuristics [was: BC facades crashes with RotaryCraft]

huttup opened this issue ยท 8 comments

commented

Hi

There is a problem when BuildCraft tries to create facades for RotaryCraft mod. The game crashes when entering /gamemode 1 and hitting the search button

http://pastebin.com/ny48FQE5

Tried to use the newly released 6.1.7 version which had a bug fix related to facades, but still get the same error as I have gotten with the earlier versions I have tried.

commented

I have tried to blacklist the RotaryCraft blocks, but get the same result. Another user have also tried to blacklist RotaryCraft with no luck http://mod-buildcraft.com/forums/index.php?topic=1086.0

Are we blacklisting wrong? Do you have any insight to how to formulate the blacklisting line?

Users are also on Reika's thread on Minecraftforum.net forums asking for help regarding this problem. http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1291655-reikas-mods-tech-worldgen-civilization-and-more?page=676

commented

We know very well, however, this is most likely a bug in RotaryCraft. Try blacklisting RotaryCraft blocks in the facade blacklist in buildcraft/main.conf

commented

This I am not entirely sure, but here are a few ideas that help, though they do not completely solve the problem, at least not soon:

  • Suggest something in Forge to make blocks have to specify the number of valid subtypes that exist - this may be obsolete in 1.8 with the BlockStates system
  • Add an interface to the BC API which the facade algorithm checks, allowing the block to return Collection<Integer> to know which states are valid
  • Try every block at runtime with each test within a try-catch, and cache the Block:Meta pairs that do not return errors, then only refer to those from then on
commented

@ReikaKalseki - what I did for now is go with the third solution. The first two will be obsolete in 1.8, and the fourth solution (which is what AE2 does) is what I plan to implement in BC 6.2.0: since registerValidFacades only creates all the facades necessary for creative tab viewing and recipes, I could just use getSubBlocks() and call it a day.

commented

I would like some mod-level control as well; I have seen "bug" reports of "liquid chroma"/"jet fuel"/etc facades which, while not buggy, nonetheless look very broken.

commented

@ReikaKalseki - there is an IMC command, "blacklist-facade", taking an ItemStack, to do exactly that.

commented

No, it is not an RC bug. BC is trying to create facades for metadatas that do not exist, and then when trying to fetch the name of the block, which is pulled from an array, it throws an OOB. The only way to "fix" this would be to pad all name arrays with 8-15 empty strings so that they all have 16 entries, something I am not going to do.

The real fix for this is something in the BC code for detecting how many metadata states of a block actually exist.

commented

@ReikaKalseki - yes, I know the real fix is detecting all the existing metadata states, but how do you propose to do that? getSubBlocks() is NOT enough, as some blocks can be rotated. Checking all possible functions for NPEs is not a true valid option, either. I cannot use getIcon() either, as the facade registration code also has to be called on the server.