fix indexoutofbounds

This commit is contained in:
Jesse Boyd 2019-12-19 16:48:14 +00:00
parent 1a64976195
commit c9c602470f
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 3 additions and 1 deletions

View File

@ -37,6 +37,8 @@ public class BlockID {
public static final int BARRIER = 24;
public static final int BEACON = 25;
public static final int BEDROCK = 26;
public static final int BEE_NEST= 677;
public static final int BEEHIVE = 678; // highest
public static final int BEETROOTS = 27;
public static final int BELL = 605;
public static final int BIRCH_BUTTON = 28;

View File

@ -179,7 +179,7 @@ public class BlockTypesCache {
Collection<String> blocks = blockReg.values();
Map<String, String> blockMap = blocks.stream().collect(Collectors.toMap(item -> item.charAt(item.length() - 1) == ']' ? item.substring(0, item.indexOf('[')) : item, item -> item));
int size = blockMap.size();
int size = blockMap.size() + 1;
Field[] idFields = BlockID.class.getDeclaredFields();
for (Field field : idFields) size = Math.max(field.getInt(null) + 1, size);
BIT_OFFSET = MathMan.log2nlz(size);