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