Renames of a few vars
This commit is contained in:
		| @@ -74,15 +74,15 @@ public class GuiGrid extends GuiBase { | ||||
|         items.clear(); | ||||
|  | ||||
|         if (grid.isConnected()) { | ||||
|             items.addAll(grid.getController().getItems()); | ||||
|             items.addAll(grid.getController().getItemGroups()); | ||||
|  | ||||
|             if (!searchField.getText().trim().isEmpty()) { | ||||
|                 Iterator<ItemGroup> t = items.iterator(); | ||||
|  | ||||
|                 while (t.hasNext()) { | ||||
|                     ItemGroup item = t.next(); | ||||
|                     ItemGroup group = t.next(); | ||||
|  | ||||
|                     if (!item.toItemStack().getDisplayName().toLowerCase().contains(searchField.getText().toLowerCase())) { | ||||
|                     if (!group.toItemStack().getDisplayName().toLowerCase().contains(searchField.getText().toLowerCase())) { | ||||
|                         t.remove(); | ||||
|                     } | ||||
|                 } | ||||
| @@ -90,11 +90,11 @@ public class GuiGrid extends GuiBase { | ||||
|  | ||||
|             Collections.sort(items, new Comparator<ItemGroup>() { | ||||
|                 @Override | ||||
|                 public int compare(ItemGroup o1, ItemGroup o2) { | ||||
|                 public int compare(ItemGroup left, ItemGroup right) { | ||||
|                     if (grid.getSortingDirection() == TileGrid.SORTING_DIRECTION_ASCENDING) { | ||||
|                         return o2.toItemStack().getDisplayName().compareTo(o1.toItemStack().getDisplayName()); | ||||
|                         return right.toItemStack().getDisplayName().compareTo(left.toItemStack().getDisplayName()); | ||||
|                     } else if (grid.getSortingDirection() == TileGrid.SORTING_DIRECTION_DESCENDING) { | ||||
|                         return o1.toItemStack().getDisplayName().compareTo(o2.toItemStack().getDisplayName()); | ||||
|                         return left.toItemStack().getDisplayName().compareTo(right.toItemStack().getDisplayName()); | ||||
|                     } | ||||
|  | ||||
|                     return 0; | ||||
| @@ -104,11 +104,11 @@ public class GuiGrid extends GuiBase { | ||||
|             if (grid.getSortingType() == TileGrid.SORTING_TYPE_QUANTITY) { | ||||
|                 Collections.sort(items, new Comparator<ItemGroup>() { | ||||
|                     @Override | ||||
|                     public int compare(ItemGroup o1, ItemGroup o2) { | ||||
|                     public int compare(ItemGroup left, ItemGroup right) { | ||||
|                         if (grid.getSortingDirection() == TileGrid.SORTING_DIRECTION_ASCENDING) { | ||||
|                             return Integer.valueOf(o2.getQuantity()).compareTo(o1.getQuantity()); | ||||
|                             return Integer.valueOf(right.getQuantity()).compareTo(left.getQuantity()); | ||||
|                         } else if (grid.getSortingDirection() == TileGrid.SORTING_DIRECTION_DESCENDING) { | ||||
|                             return Integer.valueOf(o1.getQuantity()).compareTo(o2.getQuantity()); | ||||
|                             return Integer.valueOf(left.getQuantity()).compareTo(right.getQuantity()); | ||||
|                         } | ||||
|  | ||||
|                         return 0; | ||||
|   | ||||
| @@ -69,13 +69,13 @@ public class MessageStoragePull extends MessageHandlerPlayerToServer<MessageStor | ||||
|         if (tile instanceof TileController && ((TileController) tile).isActive()) { | ||||
|             TileController controller = (TileController) tile; | ||||
|  | ||||
|             if (message.id < controller.getItems().size()) { | ||||
|                 ItemGroup item = controller.getItems().get(message.id); | ||||
|             if (message.id < controller.getItemGroups().size()) { | ||||
|                 ItemGroup group = controller.getItemGroups().get(message.id); | ||||
|  | ||||
|                 int quantity = 64; | ||||
|  | ||||
|                 if (message.isPullingHalf() && item.getQuantity() > 1) { | ||||
|                     quantity = item.getQuantity() / 2; | ||||
|                 if (message.isPullingHalf() && group.getQuantity() > 1) { | ||||
|                     quantity = group.getQuantity() / 2; | ||||
|  | ||||
|                     if (quantity > 32) { | ||||
|                         quantity = 32; | ||||
| @@ -86,11 +86,11 @@ public class MessageStoragePull extends MessageHandlerPlayerToServer<MessageStor | ||||
|                     // NO OP, the quantity already set (64) is needed for shift | ||||
|                 } | ||||
|  | ||||
|                 if (quantity > item.getType().getItemStackLimit(item.toItemStack())) { | ||||
|                     quantity = item.getType().getItemStackLimit(item.toItemStack()); | ||||
|                 if (quantity > group.getType().getItemStackLimit(group.toItemStack())) { | ||||
|                     quantity = group.getType().getItemStackLimit(group.toItemStack()); | ||||
|                 } | ||||
|  | ||||
|                 ItemStack took = controller.take(item.copy(quantity).toItemStack()); | ||||
|                 ItemStack took = controller.take(group.copy(quantity).toItemStack()); | ||||
|  | ||||
|                 if (took != null) { | ||||
|                     if (message.isPullingWithShift()) { | ||||
|   | ||||
| @@ -31,7 +31,7 @@ public class NBTStorage implements IStorage { | ||||
|         NBTTagList list = (NBTTagList) nbtTag.getTag(NBT_ITEMS); | ||||
|  | ||||
|         for (int i = 0; i < list.tagCount(); ++i) { | ||||
|             items.add(createItemFromNBT(list.getCompoundTagAt(i))); | ||||
|             items.add(createItemGroupFromNBT(list.getCompoundTagAt(i))); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -44,10 +44,10 @@ public class NBTStorage implements IStorage { | ||||
|         for (int i = 0; i < list.tagCount(); ++i) { | ||||
|             NBTTagCompound tag = list.getCompoundTagAt(i); | ||||
|  | ||||
|             ItemGroup item = createItemFromNBT(tag); | ||||
|             ItemGroup group = createItemGroupFromNBT(tag); | ||||
|  | ||||
|             if (item.compareNoQuantity(stack)) { | ||||
|                 tag.setInteger(NBT_ITEM_QUANTITY, item.getQuantity() + stack.stackSize); | ||||
|             if (group.compareNoQuantity(stack)) { | ||||
|                 tag.setInteger(NBT_ITEM_QUANTITY, group.getQuantity() + stack.stackSize); | ||||
|  | ||||
|                 return; | ||||
|             } | ||||
| @@ -75,22 +75,22 @@ public class NBTStorage implements IStorage { | ||||
|         for (int i = 0; i < list.tagCount(); ++i) { | ||||
|             NBTTagCompound tag = list.getCompoundTagAt(i); | ||||
|  | ||||
|             ItemGroup item = createItemFromNBT(tag); | ||||
|             ItemGroup group = createItemGroupFromNBT(tag); | ||||
|  | ||||
|             if (item.compare(stack, flags)) { | ||||
|                 if (quantity > item.getQuantity()) { | ||||
|                     quantity = item.getQuantity(); | ||||
|             if (group.compare(stack, flags)) { | ||||
|                 if (quantity > group.getQuantity()) { | ||||
|                     quantity = group.getQuantity(); | ||||
|                 } | ||||
|  | ||||
|                 tag.setInteger(NBT_ITEM_QUANTITY, item.getQuantity() - quantity); | ||||
|                 tag.setInteger(NBT_ITEM_QUANTITY, group.getQuantity() - quantity); | ||||
|  | ||||
|                 if (item.getQuantity() - quantity == 0) { | ||||
|                 if (group.getQuantity() - quantity == 0) { | ||||
|                     list.removeTag(i); | ||||
|                 } | ||||
|  | ||||
|                 nbtTag.setInteger(NBT_STORED, getStored(nbtTag) - quantity); | ||||
|  | ||||
|                 ItemStack newItem = item.toItemStack(); | ||||
|                 ItemStack newItem = group.toItemStack(); | ||||
|  | ||||
|                 newItem.stackSize = quantity; | ||||
|  | ||||
| @@ -115,7 +115,7 @@ public class NBTStorage implements IStorage { | ||||
|         return priority; | ||||
|     } | ||||
|  | ||||
|     private ItemGroup createItemFromNBT(NBTTagCompound tag) { | ||||
|     private ItemGroup createItemGroupFromNBT(NBTTagCompound tag) { | ||||
|         return new ItemGroup(Item.getItemById(tag.getInteger(NBT_ITEM_TYPE)), tag.getInteger(NBT_ITEM_QUANTITY), tag.getInteger(NBT_ITEM_DAMAGE), tag.hasKey(NBT_ITEM_NBT) ? ((NBTTagCompound) tag.getTag(NBT_ITEM_NBT)) : null); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -29,7 +29,7 @@ import refinedstorage.util.InventoryUtils; | ||||
| import java.util.*; | ||||
|  | ||||
| public class TileController extends TileBase implements IEnergyReceiver, INetworkTile, IRedstoneModeConfig { | ||||
|     private List<ItemGroup> items = new ArrayList<ItemGroup>(); | ||||
|     private List<ItemGroup> itemGroups = new ArrayList<ItemGroup>(); | ||||
|     private List<IStorage> storages = new ArrayList<IStorage>(); | ||||
|     private List<WirelessGridConsumer> wirelessGridConsumers = new ArrayList<WirelessGridConsumer>(); | ||||
|     private List<WirelessGridConsumer> wirelessGridConsumersMarkedForRemoval = new ArrayList<WirelessGridConsumer>(); | ||||
| @@ -162,15 +162,15 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor | ||||
|         return machines; | ||||
|     } | ||||
|  | ||||
|     public List<ItemGroup> getItems() { | ||||
|         return items; | ||||
|     public List<ItemGroup> getItemGroups() { | ||||
|         return itemGroups; | ||||
|     } | ||||
|  | ||||
|     private void syncItems() { | ||||
|         items.clear(); | ||||
|         itemGroups.clear(); | ||||
|  | ||||
|         for (IStorage storage : storages) { | ||||
|             storage.addItems(items); | ||||
|             storage.addItems(itemGroups); | ||||
|         } | ||||
|  | ||||
|         combineItems(); | ||||
| @@ -179,22 +179,22 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor | ||||
|     private void combineItems() { | ||||
|         List<Integer> markedIndexes = new ArrayList<Integer>(); | ||||
|  | ||||
|         for (int i = 0; i < items.size(); ++i) { | ||||
|         for (int i = 0; i < itemGroups.size(); ++i) { | ||||
|             if (markedIndexes.contains(i)) { | ||||
|                 continue; | ||||
|             } | ||||
|  | ||||
|             ItemGroup item = items.get(i); | ||||
|             ItemGroup group = itemGroups.get(i); | ||||
|  | ||||
|             for (int j = i + 1; j < items.size(); ++j) { | ||||
|             for (int j = i + 1; j < itemGroups.size(); ++j) { | ||||
|                 if (markedIndexes.contains(j)) { | ||||
|                     continue; | ||||
|                 } | ||||
|  | ||||
|                 ItemGroup other = items.get(j); | ||||
|                 ItemGroup otherGroup = itemGroups.get(j); | ||||
|  | ||||
|                 if (item.compareNoQuantity(other)) { | ||||
|                     item.setQuantity(item.getQuantity() + other.getQuantity()); | ||||
|                 if (group.compareNoQuantity(otherGroup)) { | ||||
|                     group.setQuantity(group.getQuantity() + otherGroup.getQuantity()); | ||||
|  | ||||
|                     markedIndexes.add(j); | ||||
|                 } | ||||
| @@ -204,10 +204,10 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor | ||||
|         List<ItemGroup> markedItems = new ArrayList<ItemGroup>(); | ||||
|  | ||||
|         for (int i : markedIndexes) { | ||||
|             markedItems.add(items.get(i)); | ||||
|             markedItems.add(itemGroups.get(i)); | ||||
|         } | ||||
|  | ||||
|         items.removeAll(markedItems); | ||||
|         itemGroups.removeAll(markedItems); | ||||
|     } | ||||
|  | ||||
|     public boolean push(ItemStack stack) { | ||||
| @@ -406,12 +406,12 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor | ||||
|  | ||||
|         redstoneMode = RedstoneMode.getById(buf.readInt()); | ||||
|  | ||||
|         items.clear(); | ||||
|         itemGroups.clear(); | ||||
|  | ||||
|         int size = buf.readInt(); | ||||
|  | ||||
|         for (int i = 0; i < size; ++i) { | ||||
|             items.add(new ItemGroup(buf)); | ||||
|             itemGroups.add(new ItemGroup(buf)); | ||||
|         } | ||||
|  | ||||
|         machines.clear(); | ||||
| @@ -436,10 +436,10 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor | ||||
|  | ||||
|         buf.writeInt(redstoneMode.id); | ||||
|  | ||||
|         buf.writeInt(items.size()); | ||||
|         buf.writeInt(itemGroups.size()); | ||||
|  | ||||
|         for (ItemGroup item : items) { | ||||
|             item.toBytes(buf, items.indexOf(item)); | ||||
|         for (ItemGroup group : itemGroups) { | ||||
|             group.toBytes(buf, itemGroups.indexOf(group)); | ||||
|         } | ||||
|  | ||||
|         buf.writeInt(machines.size()); | ||||
|   | ||||
| @@ -50,19 +50,19 @@ public class TileDetector extends TileMachine implements ICompareConfig { | ||||
|             if (slot != null) { | ||||
|                 boolean foundAny = false; | ||||
|  | ||||
|                 for (ItemGroup item : getController().getItems()) { | ||||
|                     if (item.compare(slot, compare)) { | ||||
|                 for (ItemGroup group : getController().getItemGroups()) { | ||||
|                     if (group.compare(slot, compare)) { | ||||
|                         foundAny = true; | ||||
|  | ||||
|                         switch (mode) { | ||||
|                             case MODE_UNDER: | ||||
|                                 powered = item.getQuantity() < amount; | ||||
|                                 powered = group.getQuantity() < amount; | ||||
|                                 break; | ||||
|                             case MODE_EQUAL: | ||||
|                                 powered = item.getQuantity() == amount; | ||||
|                                 powered = group.getQuantity() == amount; | ||||
|                                 break; | ||||
|                             case MODE_ABOVE: | ||||
|                                 powered = item.getQuantity() > amount; | ||||
|                                 powered = group.getQuantity() > amount; | ||||
|                                 break; | ||||
|                         } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Raoul Van den Berge
					Raoul Van den Berge