BuildCraft|Core

BuildCraft|Core

7M Downloads

Crash: buildcraft creates itemstack with invalid metadata for facade

RCXcrafter opened this issue ยท 4 comments

commented

Axanthic-Game-Studios/Lands-of-Icaria#5
Crash report with only buildcraft and lands of icaria: https://gist.github.com/RCXcrafter/e581a245e6eeed17ca54e61c742d55e0
Buildcraft version: 7.99.24.8
Related to #4197 but slightly different

Basically the hypothetical scenario described in this comment actually happened.
Lands of icaria adds an ore that drops an item with a metadata of 26 while the metadata of the block only goes up to 13 causing an ArrayIndexOutOfBoundsException. I understand the reason for using damageDropped instead of getMetaFromState but maybe some kind of check could be added to prevent itemstacks from being created with invalid metadata.

commented

This also happens if I use the command /give AlexIIL landsoficaria:rock 1 26 and then hover over that item in my inventory. (Basically creating an ItemStack with an 'invalid' metadata of 26). So perhaps it would be better if the check was performed when you access the array?

commented

I'll add a check to lands of icaria just to be safe but I disagree that buildcraft should not check for invalid metadata

commented

I'm not sure that an ItemStack with invalid metadata really makes sense when players can freely spawn itemstacks with any metadata value through /give <name> <item> 1 <any-number>, or edit them in manually using an NBT editor.

commented

Commands and external tools are not something most players will use when playing normally and when used wrong have the ability to crash the game even in vanilla.