max item id crash fix

This commit is contained in:
FalsePattern committed 2023-03-03 09:38:41 +01:00
1 parent 0e58bf113d
commit 984c976b34
2 files changed
+5 -2

No files matched your search

@@ -22,7 +22,7 @@ public class FmlRegistry implements IClassNodeTransformer {
}
field = AsmUtil.findField(cn, "MAX_ITEM_ID", true);
if (field != null) {
field.value = ExtendedConstants.maxBlockID;
field.value = ExtendedConstants.maxItemID;
}
boolean found = false;
for (final MethodNode method : cn.methods) {
@@ -30,7 +30,7 @@ public class FmlRegistry implements IClassNodeTransformer {
ExtendedConstants.maxBlockID, true)) {
found = true;
}
AsmUtil.transformInlinedSizeMethod(cn, method, 31999, ExtendedConstants.maxBlockID, true);
AsmUtil.transformInlinedSizeMethod(cn, method, 31999, ExtendedConstants.maxItemID, true);
}
if (!found) {
throw new AsmTransformException("can't find 4095 constant in any method");
@@ -24,6 +24,9 @@ public class ExtendedConstants {
public static final int blockIDCount = 1 << (bitsPerID - countCorrectionBits);
public static final int maxBlockID = blockIDCount - 1;
public static final int itemIDCount = 1 << (bitsPerID);
public static final int maxItemID = itemIDCount - 1;
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
public static final int nibblesPerBlock = bitsPerBlock / 4;
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;