sanity check the enum index calculation value before attempting to use it
@@ -167,12 +167,16 @@ public class BlockStateBasic extends ExtendedBlockState
@Nullable
public static BasicBlockType get(BasicBlock blockType, int metadata)
{
- BasicBlockType firstTry = values()[blockType.ordinal() << 4 | metadata];
+ int index = blockType.ordinal() << 4 | metadata;
+ if (index < values().length)
+ {
+ BasicBlockType firstTry = values()[index];
if(firstTry.blockType == blockType && firstTry.meta == metadata)
{
return firstTry;
}
+ }
for(BasicBlockType type : values())
{
