safer comparisons
This commit is contained in:
@@ -33,14 +33,14 @@ public class PacketTerminalUse extends AppEngPacket {
|
|||||||
NonNullList<ItemStack> mainInventory = player.inventory.mainInventory;
|
NonNullList<ItemStack> mainInventory = player.inventory.mainInventory;
|
||||||
for (int i = 0; i < mainInventory.size(); i++) {
|
for (int i = 0; i < mainInventory.size(); i++) {
|
||||||
ItemStack is = mainInventory.get(i);
|
ItemStack is = mainInventory.get(i);
|
||||||
if (is.isItemEqual(terminal.getItemDefinition().maybeStack(1).get())) {
|
if (terminal.getItemDefinition().isSameAs(is)) {
|
||||||
Platform.openGUI(player, i, terminal.getBridge(), false);
|
Platform.openGUI(player, i, terminal.getBridge(), false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < BaublesApi.getBaublesHandler(player).getSlots(); i++) {
|
for (int i = 0; i < BaublesApi.getBaublesHandler(player).getSlots(); i++) {
|
||||||
ItemStack is = BaublesApi.getBaublesHandler(player).getStackInSlot(i);
|
ItemStack is = BaublesApi.getBaublesHandler(player).getStackInSlot(i);
|
||||||
if (is.isItemEqual(terminal.getItemDefinition().maybeStack(1).get())) {
|
if (terminal.getItemDefinition().isSameAs(is)) {
|
||||||
Platform.openGUI(player, i, terminal.getBridge(), true);
|
Platform.openGUI(player, i, terminal.getBridge(), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
|||||||
siu.deserializeNBT(upgradeNBT);
|
siu.deserializeNBT(upgradeNBT);
|
||||||
for (int s = 0; s < siu.getSlots(); s++) {
|
for (int s = 0; s < siu.getSlots(); s++) {
|
||||||
ItemStack is = siu.getStackInSlot(s);
|
ItemStack is = siu.getStackInSlot(s);
|
||||||
if (is.isItemEqual(AEApi.instance().definitions().materials().cardMagnet().maybeStack(1).get())) {
|
if (AEApi.instance().definitions().materials().cardMagnet().isSameAs(is)) {
|
||||||
ItemMaterial im = (ItemMaterial) is.getItem();
|
ItemMaterial im = (ItemMaterial) is.getItem();
|
||||||
CellConfig c = (CellConfig) im.getConfigInventory(is);
|
CellConfig c = (CellConfig) im.getConfigInventory(is);
|
||||||
CellUpgrades u = (CellUpgrades) im.getUpgradesInventory(is);
|
CellUpgrades u = (CellUpgrades) im.getUpgradesInventory(is);
|
||||||
|
|||||||
@@ -307,9 +307,9 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
|||||||
@Override
|
@Override
|
||||||
public boolean allowInsert(IItemHandler inv, int slot, ItemStack stack) {
|
public boolean allowInsert(IItemHandler inv, int slot, ItemStack stack) {
|
||||||
if (inv.getStackInSlot(0).isEmpty() && inv.getStackInSlot(1).isEmpty() ) {
|
if (inv.getStackInSlot(0).isEmpty() && inv.getStackInSlot(1).isEmpty() ) {
|
||||||
if (slot == 0 && stack.isItemEqual(AEApi.instance().definitions().materials().qESingularity().maybeStack(1).get())) {
|
if (slot == 0 && AEApi.instance().definitions().materials().qESingularity().isSameAs(stack)) {
|
||||||
return true;
|
return true;
|
||||||
} else return slot == 1 && stack.isItemEqual(AEApi.instance().definitions().materials().cardQuantumLink().maybeStack(1).get());
|
} else return slot == 1 && AEApi.instance().definitions().materials().cardQuantumLink().isSameAs(stack);
|
||||||
} else if (slot == 0 && inv.getStackInSlot(1).isEmpty()) {
|
} else if (slot == 0 && inv.getStackInSlot(1).isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}else return slot == 1 && inv.getStackInSlot(0).isEmpty();
|
}else return slot == 1 && inv.getStackInSlot(0).isEmpty();
|
||||||
|
|||||||
Reference in New Issue
Block a user