Fix asm crash in beacon gui

Fix rare ItemSorter crash
This commit is contained in:
Chicken-Bomes committed 2014-07-11 15:43:53 +10:00
1 parent 7a6a694ebd
commit f101d36a5f
3 files changed
+8 -6

No files matched your search

+2 -1
View File
@@ -354,7 +354,8 @@ LCONT
list beaconButtonObscured
ALOAD 0
GETFIELD BeaconButton.this$0 : Lnet/minecraft/client/gui/inventory/GuiBeacon;
# NEI will replace the owner with the appropriate inner class
GETFIELD net/minecraft/client/gui/inventory/GuiBeacon.this$0 : Lnet/minecraft/client/gui/inventory/GuiBeacon;
DUP
GETFIELD net/minecraft/client/gui/inventory/GuiContainer.manager : Lcodechicken/nei/guihook/GuiContainerManager;
SWAP
+5 -4
View File
@@ -37,10 +37,10 @@ public class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback
public static ArrayList<SortEntry> entries = new ArrayList<SortEntry>();
public static ArrayList<SortEntry> list = new ArrayList<SortEntry>();
public static ItemSorter instance = new ItemSorter();
public static final ItemSorter instance = new ItemSorter();
//optimisations
public HashMap<ItemStack, Integer> ordering = new HashMap<ItemStack, Integer>();
public HashMap<ItemStack, Integer> ordering = null;
public static void sort(ArrayList<ItemStack> items) {
Collections.sort(items, instance);
@@ -57,10 +57,11 @@ public class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback
@Override
public void itemsLoaded() {
ordering.clear();
HashMap<ItemStack, Integer> newMap = new HashMap<ItemStack, Integer>();
int i = 0;
for(ItemStack stack : ItemList.items)
ordering.put(stack, i++);
newMap.put(stack, i++);
ordering = newMap;
}
public static String getSaveString() {
+1 -1
View File
@@ -162,7 +162,7 @@ public class NEITransformer implements IClassTransformer
asmblocks.get("renderTabTooltip"), true));
String[] buttons = new String[]{"CancelButton", "ConfirmButton", "PowerButton"};
String[] this_fields = new String[]{"field_146146_o", "field_146147_o", "field_146149_p"};
String[] this_fields = new String[]{"field_146146_o", "field_146147_o", "field_146150_o"};
for(int i = 0; i < 3; i++) {
ObfMapping m = new ObfMapping("net/minecraft/client/gui/inventory/GuiBeacon$"+buttons[i], "func_146111_b", "(II)V");
InsnListSection l = asmblocks.get("beaconButtonObscured").list.copy();