mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
sanity check the enum index calculation value before attempting to use it
(cherry picked from commit cb0f0086b9a70d457ff7bdc1e07451996c185e02)
This commit is contained in:
1 parent
8446e1e1b4
commit
589346011d
1 file changed
+8
-4
@@ -167,11 +167,15 @@ public class BlockStateBasic extends ExtendedBlockState
|
||||
@Nullable
|
||||
public static BasicBlockType get(BasicBlock blockType, int metadata)
|
||||
{
|
||||
BasicBlockType firstTry = values()[blockType.ordinal() << 4 | metadata];
|
||||
|
||||
if(firstTry.blockType == blockType && firstTry.meta == metadata)
|
||||
int index = blockType.ordinal() << 4 | metadata;
|
||||
if (index < values().length)
|
||||
{
|
||||
return firstTry;
|
||||
BasicBlockType firstTry = values()[index];
|
||||
|
||||
if(firstTry.blockType == blockType && firstTry.meta == metadata)
|
||||
{
|
||||
return firstTry;
|
||||
}
|
||||
}
|
||||
|
||||
for(BasicBlockType type : values())
|
||||
|
||||
Reference in new issue
Block a user