mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Fix more ItemStack issues
This commit is contained in:
1 parent
cf6a04a65d
commit
6eb8e59f3c
68 files changed
+207
-211
No files matched your search
@@ -12,7 +12,7 @@ public class EnergizedItemManager
|
||||
*/
|
||||
public static double discharge(ItemStack itemStack, double amount)
|
||||
{
|
||||
if(itemStack != null)
|
||||
if(!itemStack.isEmpty())
|
||||
{
|
||||
if(itemStack.getItem() instanceof IEnergizedItem)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ public class EnergizedItemManager
|
||||
*/
|
||||
public static double charge(ItemStack itemStack, double amount)
|
||||
{
|
||||
if(itemStack != null)
|
||||
if(!itemStack.isEmpty())
|
||||
{
|
||||
if(itemStack.getItem() instanceof IEnergizedItem)
|
||||
{
|
||||
|
||||
@@ -794,7 +794,7 @@ public class ClientProxy extends CommonProxy
|
||||
case 14:
|
||||
ItemStack itemStack = player.getHeldItem(EnumHand.values()[pos.getX()]);
|
||||
|
||||
if(itemStack != null && itemStack.getItem() instanceof ItemPortableTeleporter)
|
||||
if(!itemStack.isEmpty() && itemStack.getItem() instanceof ItemPortableTeleporter)
|
||||
{
|
||||
return new GuiTeleporter(player, EnumHand.values()[pos.getX()], itemStack);
|
||||
}
|
||||
@@ -863,7 +863,7 @@ public class ClientProxy extends CommonProxy
|
||||
case 38:
|
||||
ItemStack itemStack1 = player.getHeldItem(EnumHand.values()[pos.getX()]);
|
||||
|
||||
if(itemStack1 != null && itemStack1.getItem() instanceof ItemSeismicReader)
|
||||
if(!itemStack1.isEmpty() && itemStack1.getItem() instanceof ItemSeismicReader)
|
||||
{
|
||||
return new GuiSeismicReader(world, new Coord4D(player), itemStack1.copy());
|
||||
}
|
||||
@@ -917,7 +917,7 @@ public class ClientProxy extends CommonProxy
|
||||
{
|
||||
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
|
||||
|
||||
if(screen instanceof GuiTeleporter && ((GuiTeleporter)screen).itemStack != null)
|
||||
if(screen instanceof GuiTeleporter && !((GuiTeleporter)screen).itemStack.isEmpty())
|
||||
{
|
||||
GuiTeleporter teleporter = (GuiTeleporter)screen;
|
||||
|
||||
@@ -1102,7 +1102,7 @@ public class ClientProxy extends CommonProxy
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack)
|
||||
{
|
||||
if(stack != null && stack.getItem() instanceof ItemWalkieTalkie)
|
||||
if(!stack.isEmpty() && stack.getItem() instanceof ItemWalkieTalkie)
|
||||
{
|
||||
ItemWalkieTalkie item = (ItemWalkieTalkie)stack.getItem();
|
||||
|
||||
@@ -1121,7 +1121,7 @@ public class ClientProxy extends CommonProxy
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack)
|
||||
{
|
||||
if(stack != null && stack.getItem() instanceof ItemCraftingFormula)
|
||||
if(!stack.isEmpty() && stack.getItem() instanceof ItemCraftingFormula)
|
||||
{
|
||||
ItemCraftingFormula item = (ItemCraftingFormula)stack.getItem();
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ public class ClientTickHandler
|
||||
|
||||
ItemStack bootStack = mc.player.getItemStackFromSlot(EntityEquipmentSlot.FEET);
|
||||
|
||||
if(bootStack != null && bootStack.getItem() instanceof ItemFreeRunners)
|
||||
if(!bootStack.isEmpty() && bootStack.getItem() instanceof ItemFreeRunners)
|
||||
{
|
||||
mc.player.stepHeight = 1.002F;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ public class ClientTickHandler
|
||||
|
||||
ItemStack chestStack = mc.player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
|
||||
if(chestStack != null && chestStack.getItem() instanceof ItemJetpack)
|
||||
if(!chestStack.isEmpty() && chestStack.getItem() instanceof ItemJetpack)
|
||||
{
|
||||
MekanismClient.updateKey(mc.gameSettings.keyBindJump, KeySync.ASCEND);
|
||||
MekanismClient.updateKey(mc.gameSettings.keyBindSneak, KeySync.DESCEND);
|
||||
@@ -430,7 +430,7 @@ public class ClientTickHandler
|
||||
|
||||
ItemStack stack = player.inventory.armorInventory.get(2);
|
||||
|
||||
if(stack != null && !player.capabilities.isCreativeMode)
|
||||
if(!stack.isEmpty() && !player.capabilities.isCreativeMode)
|
||||
{
|
||||
if(stack.getItem() instanceof ItemJetpack)
|
||||
{
|
||||
@@ -472,7 +472,7 @@ public class ClientTickHandler
|
||||
ItemStack tank = player.inventory.armorInventory.get(2);
|
||||
ItemStack mask = player.inventory.armorInventory.get(3);
|
||||
|
||||
if(tank != null && mask != null)
|
||||
if(!tank.isEmpty() && !mask.isEmpty())
|
||||
{
|
||||
if(tank.getItem() instanceof ItemScubaTank && mask.getItem() instanceof ItemGasMask)
|
||||
{
|
||||
@@ -511,7 +511,7 @@ public class ClientTickHandler
|
||||
|
||||
public static boolean hasFlamethrower(EntityPlayer player)
|
||||
{
|
||||
if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower)
|
||||
if(!player.inventory.getCurrentItem().isEmpty() && player.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower)
|
||||
{
|
||||
ItemFlamethrower flamethrower = (ItemFlamethrower)player.inventory.getCurrentItem().getItem();
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class GuiDictionary extends GuiMekanism
|
||||
fontRendererObj.drawString(LangUtils.localize("item.Dictionary.name"), 64, 5, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("container.inventory"), 8, ySize - 96 + 2, 0x404040);
|
||||
|
||||
if(itemType != null)
|
||||
if(!itemType.isEmpty())
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -118,7 +118,7 @@ public class GuiDictionary extends GuiMekanism
|
||||
{
|
||||
ItemStack stack = hovering.getStack();
|
||||
|
||||
if(stack != null)
|
||||
if(!stack.isEmpty())
|
||||
{
|
||||
itemType = stack.copy();
|
||||
itemType.setCount(1);
|
||||
@@ -135,16 +135,16 @@ public class GuiDictionary extends GuiMekanism
|
||||
{
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
itemType = stack.copy();
|
||||
itemType.setCount(1);
|
||||
|
||||
scrollList.setText(MekanismUtils.getOreDictName(itemType));
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
itemType = null;
|
||||
itemType = ItemStack.EMPTY;
|
||||
|
||||
scrollList.setText(null);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ public class GuiFactory extends GuiMekanism
|
||||
{
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
|
||||
if(stack != null && stack.getItem() instanceof ItemGaugeDropper)
|
||||
if(!stack.isEmpty() && stack.getItem() instanceof ItemGaugeDropper)
|
||||
{
|
||||
ArrayList data = new ArrayList();
|
||||
data.add(1);
|
||||
|
||||
@@ -199,12 +199,12 @@ public class GuiFormulaicAssemblicator extends GuiMekanism
|
||||
{
|
||||
ItemStack stack = tileEntity.formula.input.get(i);
|
||||
|
||||
if(stack != null)
|
||||
if(!stack.isEmpty())
|
||||
{
|
||||
Slot slot = (Slot)inventorySlots.inventorySlots.get(i+20);
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
if(slot.getStack() == null || !slot.getStack().isItemEqual(stack))
|
||||
if(slot.getStack().isEmpty() || !slot.getStack().isItemEqual(stack))
|
||||
{
|
||||
drawGradientRect(guiWidth + slot.xPos, guiHeight + slot.yPos, guiWidth + slot.xPos + 16, guiHeight + slot.yPos + 16, -2137456640, -2137456640);
|
||||
}
|
||||
@@ -223,7 +223,7 @@ public class GuiFormulaicAssemblicator extends GuiMekanism
|
||||
private boolean canEncode()
|
||||
{
|
||||
return tileEntity.formula == null && !tileEntity.inventory.get(2).isEmpty() && tileEntity.inventory.get(2).getItem() instanceof ItemCraftingFormula &&
|
||||
((ItemCraftingFormula)tileEntity.inventory.get(2).getItem()).getInventory(tileEntity.inventory.get(2)) == null;
|
||||
((ItemCraftingFormula)tileEntity.inventory.get(2).getItem()).getInventory(tileEntity.inventory.get(2)).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -88,7 +88,7 @@ public class GuiMItemStackFilter extends GuiMekanism
|
||||
|
||||
if(guibutton.id == 0)
|
||||
{
|
||||
if(filter.itemType != null)
|
||||
if(!filter.itemType.isEmpty())
|
||||
{
|
||||
if(isNew)
|
||||
{
|
||||
@@ -122,13 +122,9 @@ public class GuiMItemStackFilter extends GuiMekanism
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.itemFilter.details") + ":", 35, 32, 0x00CD00);
|
||||
|
||||
if(filter.itemType != null)
|
||||
if(!filter.itemType.isEmpty())
|
||||
{
|
||||
renderScaledText(filter.itemType.getDisplayName(), 35, 41, 0x00CD00, 107);
|
||||
}
|
||||
|
||||
if(filter.itemType != null)
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRender.renderItemAndEffectIntoGUI(filter.itemType, 12, 19);
|
||||
@@ -136,7 +132,7 @@ public class GuiMItemStackFilter extends GuiMekanism
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
if(filter.replaceStack != null)
|
||||
if(!filter.replaceStack.isEmpty())
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -277,7 +273,7 @@ public class GuiMItemStackFilter extends GuiMekanism
|
||||
{
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
@@ -288,9 +284,9 @@ public class GuiMItemStackFilter extends GuiMekanism
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
filter.itemType = null;
|
||||
filter.itemType = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
@@ -300,9 +296,9 @@ public class GuiMItemStackFilter extends GuiMekanism
|
||||
{
|
||||
boolean doNull = false;
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
ItemStack toUse = null;
|
||||
ItemStack toUse = ItemStack.EMPTY;
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
@@ -313,12 +309,12 @@ public class GuiMItemStackFilter extends GuiMekanism
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
doNull = true;
|
||||
}
|
||||
|
||||
if(toUse != null || doNull)
|
||||
if(!toUse.isEmpty() || doNull)
|
||||
{
|
||||
filter.replaceStack = toUse;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class GuiMMaterialFilter extends GuiMekanism
|
||||
|
||||
if(guibutton.id == 0)
|
||||
{
|
||||
if(filter.materialItem != null)
|
||||
if(!filter.materialItem.isEmpty())
|
||||
{
|
||||
if(isNew)
|
||||
{
|
||||
@@ -100,8 +100,7 @@ public class GuiMMaterialFilter extends GuiMekanism
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
|
||||
}
|
||||
else if(filter.materialItem == null)
|
||||
{
|
||||
else {
|
||||
status = EnumColor.DARK_RED + LangUtils.localize("gui.itemFilter.noItem");
|
||||
ticker = 20;
|
||||
}
|
||||
@@ -123,13 +122,9 @@ public class GuiMMaterialFilter extends GuiMekanism
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.materialFilter.details") + ":", 35, 32, 0x00CD00);
|
||||
|
||||
if(filter.materialItem != null)
|
||||
if(!filter.materialItem.isEmpty())
|
||||
{
|
||||
renderScaledText(filter.materialItem.getDisplayName(), 35, 41, 0x00CD00, 107);
|
||||
}
|
||||
|
||||
if(filter.materialItem != null)
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRender.renderItemAndEffectIntoGUI(filter.materialItem, 12, 19);
|
||||
@@ -137,7 +132,7 @@ public class GuiMMaterialFilter extends GuiMekanism
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
if(filter.replaceStack != null)
|
||||
if(!filter.replaceStack.isEmpty())
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -259,7 +254,7 @@ public class GuiMMaterialFilter extends GuiMekanism
|
||||
{
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
@@ -270,9 +265,9 @@ public class GuiMMaterialFilter extends GuiMekanism
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
filter.materialItem = null;
|
||||
filter.materialItem = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
@@ -282,9 +277,9 @@ public class GuiMMaterialFilter extends GuiMekanism
|
||||
{
|
||||
boolean doNull = false;
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
ItemStack toUse = null;
|
||||
ItemStack toUse = ItemStack.EMPTY;
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
@@ -295,12 +290,12 @@ public class GuiMMaterialFilter extends GuiMekanism
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
doNull = true;
|
||||
}
|
||||
|
||||
if(toUse != null || doNull)
|
||||
if(!toUse.isEmpty() || doNull)
|
||||
{
|
||||
filter.replaceStack = toUse;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public class GuiMModIDFilter extends GuiMekanism
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00);
|
||||
renderScaledText(LangUtils.localize("gui.id") + ": " + filter.modID, 35, 32, 0x00CD00, 107);
|
||||
|
||||
if(renderStack != null)
|
||||
if(!renderStack.isEmpty())
|
||||
{
|
||||
try {
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -178,7 +178,7 @@ public class GuiMModIDFilter extends GuiMekanism
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
||||
if(filter.replaceStack != null)
|
||||
if(!filter.replaceStack.isEmpty())
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -290,7 +290,7 @@ public class GuiMModIDFilter extends GuiMekanism
|
||||
}
|
||||
else if(iterStacks != null && iterStacks.size() == 0)
|
||||
{
|
||||
renderStack = null;
|
||||
renderStack = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,9 +328,9 @@ public class GuiMModIDFilter extends GuiMekanism
|
||||
{
|
||||
boolean doNull = false;
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
ItemStack toUse = null;
|
||||
ItemStack toUse = ItemStack.EMPTY;
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
@@ -341,12 +341,12 @@ public class GuiMModIDFilter extends GuiMekanism
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
doNull = true;
|
||||
}
|
||||
|
||||
if(toUse != null || doNull)
|
||||
if(!toUse.isEmpty() || doNull)
|
||||
{
|
||||
filter.replaceStack = toUse;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public class GuiMOreDictFilter extends GuiMekanism
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00);
|
||||
renderScaledText(LangUtils.localize("gui.key") + ": " + filter.oreDictName, 35, 32, 0x00CD00, 107);
|
||||
|
||||
if(renderStack != null)
|
||||
if(!renderStack.isEmpty())
|
||||
{
|
||||
try {
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -178,7 +178,7 @@ public class GuiMOreDictFilter extends GuiMekanism
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
||||
if(filter.replaceStack != null)
|
||||
if(!filter.replaceStack.isEmpty())
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -290,7 +290,7 @@ public class GuiMOreDictFilter extends GuiMekanism
|
||||
}
|
||||
else if(iterStacks != null && iterStacks.size() == 0)
|
||||
{
|
||||
renderStack = null;
|
||||
renderStack = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,9 +328,9 @@ public class GuiMOreDictFilter extends GuiMekanism
|
||||
{
|
||||
boolean doNull = false;
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
ItemStack toUse = null;
|
||||
ItemStack toUse = ItemStack.EMPTY;
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
@@ -341,12 +341,12 @@ public class GuiMOreDictFilter extends GuiMekanism
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
doNull = true;
|
||||
}
|
||||
|
||||
if(toUse != null || doNull)
|
||||
if(!toUse.isEmpty() || doNull)
|
||||
{
|
||||
filter.replaceStack = toUse;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper
|
||||
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
|
||||
if(stack != null && stack.getItem() instanceof ItemConfigurator && hovering != null)
|
||||
if(!stack.isEmpty() && stack.getItem() instanceof ItemConfigurator && hovering != null)
|
||||
{
|
||||
SideData data = getFromSlot(hovering);
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ public class GuiOredictionificator extends GuiMekanism
|
||||
|
||||
ItemStack stack = renderStacks.get(filter);
|
||||
|
||||
if(stack != null)
|
||||
if(!stack.isEmpty())
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -258,7 +258,7 @@ public class GuiOredictionificator extends GuiMekanism
|
||||
{
|
||||
if(filter.filter == null || filter.filter.isEmpty())
|
||||
{
|
||||
renderStacks.put(filter, null);
|
||||
renderStacks.put(filter, ItemStack.EMPTY);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ public class GuiOredictionificator extends GuiMekanism
|
||||
|
||||
if(stacks.isEmpty())
|
||||
{
|
||||
renderStacks.put(filter, null);
|
||||
renderStacks.put(filter, ItemStack.EMPTY);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ public class GuiOredictionificator extends GuiMekanism
|
||||
renderStacks.put(filter, stacks.get(filter.index).copy());
|
||||
}
|
||||
else {
|
||||
renderStacks.put(filter, null);
|
||||
renderStacks.put(filter, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,10 +264,10 @@ public class GuiRobitRepair extends GuiMekanism implements IContainerListener
|
||||
{
|
||||
if(slotID == 0)
|
||||
{
|
||||
itemNameField.setText(itemstack == null ? "" : itemstack.getDisplayName());
|
||||
itemNameField.setEnabled(itemstack != null);
|
||||
itemNameField.setText(itemstack.isEmpty() ? "" : itemstack.getDisplayName());
|
||||
itemNameField.setEnabled(!itemstack.isEmpty());
|
||||
|
||||
if(itemstack != null)
|
||||
if(!itemstack.isEmpty())
|
||||
{
|
||||
repairContainer.updateItemName(itemNameField.getText());
|
||||
mc.player.connection.sendPacket(new CPacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(itemNameField.getText())));
|
||||
|
||||
@@ -101,7 +101,7 @@ public class GuiTItemStackFilter extends GuiMekanism
|
||||
|
||||
if(guibutton.id == 0)
|
||||
{
|
||||
if(filter.itemType != null && !minField.getText().isEmpty() && !maxField.getText().isEmpty())
|
||||
if(!filter.itemType.isEmpty() && !minField.getText().isEmpty() && !maxField.getText().isEmpty())
|
||||
{
|
||||
int min = Integer.parseInt(minField.getText());
|
||||
int max = Integer.parseInt(maxField.getText());
|
||||
@@ -132,7 +132,7 @@ public class GuiTItemStackFilter extends GuiMekanism
|
||||
ticker = 20;
|
||||
}
|
||||
}
|
||||
else if(filter.itemType == null)
|
||||
else if(filter.itemType.isEmpty())
|
||||
{
|
||||
status = EnumColor.DARK_RED + "No item";
|
||||
ticker = 20;
|
||||
@@ -179,13 +179,9 @@ public class GuiTItemStackFilter extends GuiMekanism
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.itemFilter.max") + ":", 128, 32, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui." + (filter.sizeMode ? "on" : "off")), 141, 46, 0x404040);
|
||||
|
||||
if(filter.itemType != null)
|
||||
if(!filter.itemType.isEmpty())
|
||||
{
|
||||
renderScaledText(filter.itemType.getDisplayName(), 35, 41, 0x00CD00, 89);
|
||||
}
|
||||
|
||||
if(filter.itemType != null)
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRender.renderItemAndEffectIntoGUI(filter.itemType, 12, 19);
|
||||
@@ -312,14 +308,14 @@ public class GuiTItemStackFilter extends GuiMekanism
|
||||
{
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
filter.itemType = stack.copy();
|
||||
filter.itemType.setCount(1);
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
filter.itemType = null;
|
||||
filter.itemType = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
@@ -92,7 +92,7 @@ public class GuiTMaterialFilter extends GuiMekanism
|
||||
|
||||
if(guibutton.id == 0)
|
||||
{
|
||||
if(filter.materialItem != null)
|
||||
if(!filter.materialItem.isEmpty())
|
||||
{
|
||||
if(isNew)
|
||||
{
|
||||
@@ -104,7 +104,7 @@ public class GuiTMaterialFilter extends GuiMekanism
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
|
||||
}
|
||||
else if(filter.materialItem == null)
|
||||
else if(filter.materialItem.isEmpty())
|
||||
{
|
||||
status = EnumColor.DARK_RED + LangUtils.localize("gui.itemFilter.noItem");
|
||||
ticker = 20;
|
||||
@@ -127,13 +127,9 @@ public class GuiTMaterialFilter extends GuiMekanism
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.materialFilter.details") + ":", 35, 32, 0x00CD00);
|
||||
|
||||
if(filter.materialItem != null)
|
||||
if(!filter.materialItem.isEmpty())
|
||||
{
|
||||
renderScaledText(filter.materialItem.getDisplayName(), 35, 41, 0x00CD00, 107);
|
||||
}
|
||||
|
||||
if(filter.materialItem != null)
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRender.renderItemAndEffectIntoGUI(filter.materialItem, 12, 19);
|
||||
@@ -243,7 +239,7 @@ public class GuiTMaterialFilter extends GuiMekanism
|
||||
{
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
@@ -254,9 +250,9 @@ public class GuiTMaterialFilter extends GuiMekanism
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
filter.materialItem = null;
|
||||
filter.materialItem = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
@@ -162,7 +162,7 @@ public class GuiTeleporter extends GuiMekanism
|
||||
setButton = new GuiButton(2, guiWidth + 27, guiHeight + 116, 60, 20, LangUtils.localize("gui.set"));
|
||||
deleteButton = new GuiButton(3, guiWidth + 89, guiHeight + 116, 60, 20, LangUtils.localize("gui.delete"));
|
||||
|
||||
if(itemStack != null)
|
||||
if(!itemStack.isEmpty())
|
||||
{
|
||||
teleportButton = new GuiButton(4, guiWidth + 42, guiHeight + 140, 92, 20, LangUtils.localize("gui.teleport"));
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public class GuiTeleporter extends GuiMekanism
|
||||
buttonList.add(setButton);
|
||||
buttonList.add(deleteButton);
|
||||
|
||||
if(itemStack != null)
|
||||
if(!itemStack.isEmpty())
|
||||
{
|
||||
buttonList.add(teleportButton);
|
||||
|
||||
@@ -281,7 +281,7 @@ public class GuiTeleporter extends GuiMekanism
|
||||
deleteButton.enabled = false;
|
||||
}
|
||||
|
||||
if(itemStack != null)
|
||||
if(!itemStack.isEmpty())
|
||||
{
|
||||
if(clientFreq != null && clientStatus == 1)
|
||||
{
|
||||
@@ -418,7 +418,7 @@ public class GuiTeleporter extends GuiMekanism
|
||||
int yAxis = (mouseY-(height-ySize)/2);
|
||||
|
||||
fontRendererObj.drawString(getName(), (xSize/2)-(fontRendererObj.getStringWidth(getName())/2), 4, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.owner") + ": " + (getOwner() != null ? getOwner() : LangUtils.localize("gui.none")), 8, itemStack != null ? ySize-12 : (ySize-96)+4, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.owner") + ": " + (getOwner() != null ? getOwner() : LangUtils.localize("gui.none")), 8, !itemStack.isEmpty() ? ySize-12 : (ySize-96)+4, 0x404040);
|
||||
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.freq") + ":", 32, 81, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.security") + ":", 32, 91, 0x404040);
|
||||
@@ -528,7 +528,7 @@ public class GuiTeleporter extends GuiMekanism
|
||||
|
||||
private double getEnergy()
|
||||
{
|
||||
if(itemStack != null)
|
||||
if(!itemStack.isEmpty())
|
||||
{
|
||||
return ((ItemPortableTeleporter)itemStack.getItem()).getEnergy(itemStack);
|
||||
}
|
||||
@@ -538,7 +538,7 @@ public class GuiTeleporter extends GuiMekanism
|
||||
|
||||
private double getMaxEnergy()
|
||||
{
|
||||
if(itemStack != null)
|
||||
if(!itemStack.isEmpty())
|
||||
{
|
||||
return ((ItemPortableTeleporter)itemStack.getItem()).getMaxEnergy(itemStack);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class GuiFluidGauge extends GuiGauge<Fluid>
|
||||
{
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
|
||||
if(guiObj instanceof GuiMekanism && stack != null && stack.getItem() instanceof ItemGaugeDropper)
|
||||
if(guiObj instanceof GuiMekanism && !stack.isEmpty() && stack.getItem() instanceof ItemGaugeDropper)
|
||||
{
|
||||
TileEntity tile = ((GuiMekanism)guiObj).getTileEntity();
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public class GuiGasGauge extends GuiGauge<Gas>
|
||||
{
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
|
||||
if(guiObj instanceof GuiMekanism && stack != null && stack.getItem() instanceof ItemGaugeDropper)
|
||||
if(guiObj instanceof GuiMekanism && !stack.isEmpty() && stack.getItem() instanceof ItemGaugeDropper)
|
||||
{
|
||||
TileEntity tile = ((GuiMekanism)guiObj).getTileEntity();
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ public abstract class GuiGauge<T> extends GuiElement
|
||||
{
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
|
||||
if(stack != null && stack.getItem() instanceof ItemConfigurator && color != null)
|
||||
if(!stack.isEmpty() && stack.getItem() instanceof ItemConfigurator && color != null)
|
||||
{
|
||||
if(guiObj instanceof GuiMekanism && ((GuiMekanism)guiObj).getTileEntity() != null)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ public class RenderConfigurableMachine<S extends TileEntity & ISideConfiguration
|
||||
ItemStack itemStack = player.inventory.getCurrentItem();
|
||||
RayTraceResult pos = player.rayTrace(8.0D, 1.0F);
|
||||
|
||||
if(pos != null && itemStack != null && itemStack.getItem() instanceof ItemConfigurator && ((ItemConfigurator)itemStack.getItem()).getState(itemStack).isConfigurating())
|
||||
if(pos != null && !itemStack.isEmpty() && itemStack.getItem() instanceof ItemConfigurator && ((ItemConfigurator)itemStack.getItem()).getState(itemStack).isConfigurating())
|
||||
{
|
||||
BlockPos bp = pos.getBlockPos();
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public class RenderLogisticalTransporter extends RenderTransmitterBase<TileEntit
|
||||
ItemStack itemStack = player.inventory.getCurrentItem();
|
||||
RayTraceResult pos = player.rayTrace(8.0D, 1.0F);
|
||||
|
||||
if(pos != null && itemStack != null && itemStack.getItem() instanceof ItemConfigurator)
|
||||
if(pos != null && !itemStack.isEmpty() && itemStack.getItem() instanceof ItemConfigurator)
|
||||
{
|
||||
Coord4D obj = new Coord4D(pos.getBlockPos(), transporter.getWorld());
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ public class CommonPlayerTickHandler
|
||||
{
|
||||
ItemStack stack = player.inventory.armorInventory.get(2);
|
||||
|
||||
if(stack != null && !player.capabilities.isCreativeMode)
|
||||
if(!stack.isEmpty() && !player.capabilities.isCreativeMode)
|
||||
{
|
||||
if(stack.getItem() instanceof ItemJetpack)
|
||||
{
|
||||
@@ -197,7 +197,7 @@ public class CommonPlayerTickHandler
|
||||
ItemStack tank = player.inventory.armorInventory.get(2);
|
||||
ItemStack mask = player.inventory.armorInventory.get(3);
|
||||
|
||||
if(tank != null && mask != null)
|
||||
if(!tank.isEmpty() && !mask.isEmpty())
|
||||
{
|
||||
if(tank.getItem() instanceof ItemScubaTank && mask.getItem() instanceof ItemGasMask)
|
||||
{
|
||||
@@ -220,7 +220,7 @@ public class CommonPlayerTickHandler
|
||||
{
|
||||
if(Mekanism.flamethrowerActive.contains(player.getName()))
|
||||
{
|
||||
if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower)
|
||||
if(!player.inventory.getCurrentItem().isEmpty() && player.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ public class CommonProxy implements IGuiProvider
|
||||
case 14:
|
||||
ItemStack itemStack = player.getHeldItem(EnumHand.values()[pos.getX()]);
|
||||
|
||||
if(itemStack != null && itemStack.getItem() instanceof ItemPortableTeleporter)
|
||||
if(!itemStack.isEmpty() && itemStack.getItem() instanceof ItemPortableTeleporter)
|
||||
{
|
||||
return new ContainerNull();
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class IMCHandler
|
||||
{
|
||||
ItemStack stack = RecipeUtils.loadRecipeItemStack(msg.getNBTValue());
|
||||
|
||||
if(stack != null)
|
||||
if(!stack.isEmpty())
|
||||
{
|
||||
RecipeUtils.removeRecipes(stack);
|
||||
Mekanism.logger.info("[Mekanism] " + msg.getSender() + " removed a Mekanism recipe from the recipe list.");
|
||||
|
||||
@@ -175,7 +175,7 @@ public interface IFactory
|
||||
|
||||
public boolean hasRecipe(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack == null)
|
||||
if(itemStack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@ public interface ITankManager
|
||||
{
|
||||
ItemStack stack = player.inventory.getItemStack();
|
||||
|
||||
if(stack == null || !(stack.getItem() instanceof ItemGaugeDropper))
|
||||
if(stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemGaugeDropper dropper = (ItemGaugeDropper)stack.getItem();
|
||||
|
||||
if(stack != null)
|
||||
if(!stack.isEmpty())
|
||||
{
|
||||
if(tank instanceof GasTank)
|
||||
{
|
||||
|
||||
@@ -198,7 +198,7 @@ public class BlockEnergyCube extends BlockContainer
|
||||
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(pos);
|
||||
ItemStack stack = entityplayer.getHeldItem(hand);
|
||||
|
||||
if(stack != null)
|
||||
if(!stack.isEmpty())
|
||||
{
|
||||
Item tool = stack.getItem();
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ public class BlockGasTank extends BlockContainer
|
||||
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(pos);
|
||||
ItemStack stack = entityplayer.getHeldItem(hand);
|
||||
|
||||
if(stack != null)
|
||||
if(!stack.isEmpty())
|
||||
{
|
||||
Item tool = stack.getItem();
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public class BlockObsidianTNT extends Block
|
||||
{
|
||||
ItemStack stack = entityplayer.getHeldItem(hand);
|
||||
|
||||
if(stack != null && stack.getItem() == Items.FLINT_AND_STEEL)
|
||||
if(!stack.isEmpty() && stack.getItem() == Items.FLINT_AND_STEEL)
|
||||
{
|
||||
explode(world, pos);
|
||||
world.setBlockToAir(pos);
|
||||
|
||||
@@ -205,7 +205,7 @@ public class BlockTransmitter extends Block implements ITileEntityProvider
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
|
||||
|
||||
public class TransporterManager
|
||||
@@ -75,12 +76,24 @@ public class TransporterManager
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static InventoryCopy copyInv(IItemHandler handler)
|
||||
{
|
||||
NonNullList<ItemStack> ret = NonNullList.withSize(handler.getSlots(), ItemStack.EMPTY);
|
||||
|
||||
for(int i = 0; i < handler.getSlots(); i++)
|
||||
{
|
||||
ret.set(i, handler.getStackInSlot(i));
|
||||
}
|
||||
|
||||
return new InventoryCopy(ret);
|
||||
}
|
||||
|
||||
public static InventoryCopy copyInvFromSide(IInventory inv, EnumFacing side)
|
||||
{
|
||||
inv = InventoryUtils.checkChestInv(inv);
|
||||
|
||||
NonNullList<ItemStack>ret = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY);
|
||||
|
||||
NonNullList<ItemStack> ret = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY);
|
||||
|
||||
if(!(inv instanceof ISidedInventory))
|
||||
{
|
||||
|
||||
@@ -233,14 +233,14 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData
|
||||
{
|
||||
ItemStack stack = block.getStack(world);
|
||||
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack result = FurnaceRecipes.instance().getSmeltingResult(block.getStack(world));
|
||||
|
||||
if(result != null && result.getItem() != null)
|
||||
if(!result.isEmpty() && result.getItem() != null)
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
|
||||
@@ -254,7 +254,7 @@ public class ContainerFactory extends Container
|
||||
|
||||
public boolean isProperMachine(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack != null && itemStack.getItem() instanceof ItemBlockMachine)
|
||||
if(!itemStack.isEmpty() && itemStack.getItem() instanceof ItemBlockMachine)
|
||||
{
|
||||
for(RecipeType type : RecipeType.values())
|
||||
{
|
||||
|
||||
@@ -144,7 +144,7 @@ public class ContainerPersonalChest extends Container
|
||||
{
|
||||
ItemStack itemStack = player.inventory.getStackInSlot(destSlot);
|
||||
|
||||
if(itemStack != null && MachineType.get(itemStack) == MachineType.PERSONAL_CHEST)
|
||||
if(!itemStack.isEmpty() && MachineType.get(itemStack) == MachineType.PERSONAL_CHEST)
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ItemCraftingFormula extends ItemMekanism
|
||||
|
||||
for(ItemStack stack : inv)
|
||||
{
|
||||
if(stack != null)
|
||||
if(!stack.isEmpty())
|
||||
{
|
||||
boolean found = false;
|
||||
|
||||
|
||||
@@ -51,12 +51,12 @@ public class ItemElectricBow extends ItemEnergized
|
||||
ItemStack ammo = findAmmo(player);
|
||||
|
||||
int maxItemUse = getMaxItemUseDuration(itemstack) - itemUseCount;
|
||||
maxItemUse = ForgeEventFactory.onArrowLoose(itemstack, world, player, maxItemUse, itemstack != null || flag);
|
||||
maxItemUse = ForgeEventFactory.onArrowLoose(itemstack, world, player, maxItemUse, !itemstack.isEmpty() || flag);
|
||||
if(maxItemUse < 0) return;
|
||||
|
||||
if(flag || ammo != null)
|
||||
if(flag || !ammo.isEmpty())
|
||||
{
|
||||
if(ammo == null)
|
||||
if(ammo.isEmpty())
|
||||
{
|
||||
ammo = new ItemStack(Items.ARROW);
|
||||
}
|
||||
@@ -152,20 +152,20 @@ public class ItemElectricBow extends ItemEnergized
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isArrow(@Nullable ItemStack stack)
|
||||
{
|
||||
return stack != null && stack.getItem() instanceof ItemArrow;
|
||||
return !stack.isEmpty() && stack.getItem() instanceof ItemArrow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand)
|
||||
{
|
||||
ItemStack itemStackIn = playerIn.getHeldItem(hand);
|
||||
boolean flag = findAmmo(playerIn) != null;
|
||||
boolean flag = !findAmmo(playerIn).isEmpty();
|
||||
|
||||
ActionResult<ItemStack> ret = ForgeEventFactory.onArrowNock(itemStackIn, worldIn, playerIn, hand, flag);
|
||||
if(ret != null) return ret;
|
||||
|
||||
@@ -217,7 +217,7 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci
|
||||
EntityLivingBase base = event.getEntityLiving();
|
||||
ItemStack stack = base.getItemStackFromSlot(EntityEquipmentSlot.FEET);
|
||||
|
||||
if(stack != null && stack.getItem() instanceof ItemFreeRunners)
|
||||
if(!stack.isEmpty() && stack.getItem() instanceof ItemFreeRunners)
|
||||
{
|
||||
ItemFreeRunners boots = (ItemFreeRunners)stack.getItem();
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class PacketConfiguratorState implements IMessageHandler<ConfiguratorStat
|
||||
{
|
||||
ItemStack itemstack = PacketHandler.getPlayer(context).getHeldItem(message.currentHand);
|
||||
|
||||
if(itemstack != null && itemstack.getItem() instanceof ItemConfigurator)
|
||||
if(!itemstack.isEmpty() && itemstack.getItem() instanceof ItemConfigurator)
|
||||
{
|
||||
((ItemConfigurator)itemstack.getItem()).setState(itemstack, message.state);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class PacketElectricBowState implements IMessageHandler<ElectricBowStateM
|
||||
{
|
||||
ItemStack itemstack = PacketHandler.getPlayer(context).getHeldItem(message.currentHand);
|
||||
|
||||
if(itemstack != null && itemstack.getItem() instanceof ItemElectricBow)
|
||||
if(!itemstack.isEmpty() && itemstack.getItem() instanceof ItemElectricBow)
|
||||
{
|
||||
((ItemElectricBow)itemstack.getItem()).setFireState(itemstack, message.fireMode);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PacketFlamethrowerData implements IMessageHandler<FlamethrowerDataM
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(message.currentHand);
|
||||
|
||||
if(stack != null && stack.getItem() instanceof ItemFlamethrower)
|
||||
if(!stack.isEmpty() && stack.getItem() instanceof ItemFlamethrower)
|
||||
{
|
||||
((ItemFlamethrower)stack.getItem()).incrementMode(stack);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class PacketJetpackData implements IMessageHandler<JetpackDataMessage, IM
|
||||
{
|
||||
ItemStack stack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
|
||||
if(stack != null && stack.getItem() instanceof ItemJetpack)
|
||||
if(!stack.isEmpty() && stack.getItem() instanceof ItemJetpack)
|
||||
{
|
||||
if(!message.value)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ public class PacketPortableTankState implements IMessageHandler<PortableTankStat
|
||||
{
|
||||
ItemStack itemstack = PacketHandler.getPlayer(context).getHeldItem(message.currentHand);
|
||||
|
||||
if(itemstack != null && itemstack.getItem() instanceof ItemBlockMachine)
|
||||
if(!itemstack.isEmpty() && itemstack.getItem() instanceof ItemBlockMachine)
|
||||
{
|
||||
((ItemBlockMachine)itemstack.getItem()).setBucketMode(itemstack, message.bucketMode);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PacketPortableTeleporter implements IMessageHandler<PortableTelepor
|
||||
ItemStack itemstack = player.getHeldItem(message.currentHand);
|
||||
World world = player.world;
|
||||
|
||||
if(itemstack != null && itemstack.getItem() instanceof ItemPortableTeleporter)
|
||||
if(!itemstack.isEmpty() && itemstack.getItem() instanceof ItemPortableTeleporter)
|
||||
{
|
||||
ItemPortableTeleporter item = (ItemPortableTeleporter)itemstack.getItem();
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class PacketScubaTankData implements IMessageHandler<ScubaTankDataMessage
|
||||
{
|
||||
ItemStack stack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
|
||||
if(stack != null && stack.getItem() instanceof ItemScubaTank)
|
||||
if(!stack.isEmpty() && stack.getItem() instanceof ItemScubaTank)
|
||||
{
|
||||
((ItemScubaTank)stack.getItem()).toggleFlowing(stack);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class PacketWalkieTalkieState implements IMessageHandler<WalkieTalkieStat
|
||||
{
|
||||
ItemStack itemstack = PacketHandler.getPlayer(context).getHeldItem(message.currentHand);
|
||||
|
||||
if(itemstack != null && itemstack.getItem() instanceof ItemWalkieTalkie)
|
||||
if(!itemstack.isEmpty() && itemstack.getItem() instanceof ItemWalkieTalkie)
|
||||
{
|
||||
((ItemWalkieTalkie)itemstack.getItem()).setChannel(itemstack, message.channel);
|
||||
}
|
||||
|
||||
@@ -33,12 +33,12 @@ public class BinRecipe implements IRecipe
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World world)
|
||||
{
|
||||
return getCraftingResult(inv) != null;
|
||||
return !getCraftingResult(inv).isEmpty();
|
||||
}
|
||||
|
||||
private boolean isBin(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack == null)
|
||||
if(itemStack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class BinRecipe implements IRecipe
|
||||
|
||||
public ItemStack getResult(IInventory inv)
|
||||
{
|
||||
ItemStack bin = null;
|
||||
ItemStack bin = ItemStack.EMPTY;
|
||||
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
@@ -62,31 +62,31 @@ public class BinRecipe implements IRecipe
|
||||
|
||||
if(isBin(stack))
|
||||
{
|
||||
if(bin != null)
|
||||
if(!bin.isEmpty())
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
bin = stack.copy();
|
||||
}
|
||||
}
|
||||
|
||||
if(bin == null || bin.getCount() > 1)
|
||||
if(bin.isEmpty() || bin.getCount() > 1)
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
ItemStack addStack = null;
|
||||
ItemStack addStack = ItemStack.EMPTY;
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
|
||||
if(stack != null && !isBin(stack))
|
||||
if(!stack.isEmpty() && !isBin(stack))
|
||||
{
|
||||
if(addStack != null)
|
||||
if(!addStack.isEmpty())
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
addStack = stack.copy();
|
||||
@@ -95,13 +95,13 @@ public class BinRecipe implements IRecipe
|
||||
|
||||
InventoryBin binInv = new InventoryBin(bin);
|
||||
|
||||
if(addStack != null)
|
||||
if(!addStack.isEmpty())
|
||||
{
|
||||
if(!(addStack.getItem() instanceof ItemProxy))
|
||||
{
|
||||
if(binInv.getItemType() != null && !binInv.getItemType().isItemEqual(addStack))
|
||||
if(!binInv.getItemType().isEmpty() && !binInv.getItemType().isItemEqual(addStack))
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
binInv.add(addStack);
|
||||
@@ -135,7 +135,7 @@ public class BinRecipe implements IRecipe
|
||||
@SubscribeEvent
|
||||
public void onCrafting(ItemCraftedEvent event)
|
||||
{
|
||||
if(getResult(event.craftMatrix) != null)
|
||||
if(!getResult(event.craftMatrix).isEmpty())
|
||||
{
|
||||
if(!isBin(event.crafting))
|
||||
{
|
||||
@@ -149,7 +149,7 @@ public class BinRecipe implements IRecipe
|
||||
int size = inv.getItemCount();
|
||||
|
||||
ItemStack testRemove = inv.removeStack();
|
||||
int newCount = size-(testRemove != null ? testRemove.getCount() : 0);
|
||||
int newCount = size-(!testRemove.isEmpty() ? testRemove.getCount() : 0);
|
||||
|
||||
if(inv.getTier() == BinTier.CREATIVE)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ public class BinRecipe implements IRecipe
|
||||
{
|
||||
bin = i;
|
||||
}
|
||||
else if(!isBin(event.craftMatrix.getStackInSlot(i)) && event.craftMatrix.getStackInSlot(i) != null)
|
||||
else if(!isBin(event.craftMatrix.getStackInSlot(i)) && !event.craftMatrix.getStackInSlot(i).isEmpty())
|
||||
{
|
||||
other = i;
|
||||
}
|
||||
@@ -181,14 +181,14 @@ public class BinRecipe implements IRecipe
|
||||
|
||||
ItemStack testRemain = new InventoryBin(binStack.copy()).add(otherStack.copy());
|
||||
|
||||
if(testRemain != null && testRemain.getCount() > 0)
|
||||
if(!testRemain.isEmpty() && testRemain.getCount() > 0)
|
||||
{
|
||||
ItemStack proxy = new ItemStack(MekanismItems.ItemProxy);
|
||||
((ItemProxy)proxy.getItem()).setSavedItem(proxy, testRemain.copy());
|
||||
event.craftMatrix.setInventorySlotContents(other, proxy);
|
||||
}
|
||||
else {
|
||||
event.craftMatrix.setInventorySlotContents(other, null);
|
||||
event.craftMatrix.setInventorySlotContents(other, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ public final class RecipeHandler
|
||||
*/
|
||||
public static <RECIPE extends MachineRecipe<ItemStackInput, ?, RECIPE>> boolean isInRecipe(ItemStack itemstack, Map<ItemStackInput, RECIPE> recipes)
|
||||
{
|
||||
if(itemstack != null)
|
||||
if(!itemstack.isEmpty())
|
||||
{
|
||||
for(RECIPE recipe : recipes.values())
|
||||
{
|
||||
@@ -509,7 +509,7 @@ public final class RecipeHandler
|
||||
|
||||
public static boolean isInPressurizedRecipe(ItemStack stack)
|
||||
{
|
||||
if(stack != null)
|
||||
if(!stack.isEmpty())
|
||||
{
|
||||
for(PressurizedInput key : (Set<PressurizedInput>)Recipe.PRESSURIZED_REACTION_CHAMBER.get().keySet())
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ public class AdvancedMachineInput extends MachineInput<AdvancedMachineInput>
|
||||
@Override
|
||||
public boolean isValid()
|
||||
{
|
||||
return itemStack != null && gasType != null;
|
||||
return !itemStack.isEmpty() && gasType != null;
|
||||
}
|
||||
|
||||
public boolean useItem(NonNullList<ItemStack> inventory, int index, boolean deplete)
|
||||
|
||||
@@ -69,7 +69,7 @@ public class PressurizedInput extends MachineInput<PressurizedInput>
|
||||
*/
|
||||
public boolean containsType(ItemStack stack)
|
||||
{
|
||||
if(stack == null || stack.getCount() == 0)
|
||||
if(stack.isEmpty() || stack.getCount() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public class TileEntityChargepad extends TileEntityNoisyElectricBlock
|
||||
|
||||
public void chargeItemStack(ItemStack itemstack)
|
||||
{
|
||||
if(itemstack != null)
|
||||
if(!itemstack.isEmpty())
|
||||
{
|
||||
if(itemstack.getItem() instanceof IEnergizedItem)
|
||||
{
|
||||
|
||||
@@ -411,7 +411,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
|
||||
{
|
||||
if(slotID == 0)
|
||||
{
|
||||
return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).getGas(itemstack) != null &&
|
||||
return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).getGas(itemstack) != null &&
|
||||
RecipeHandler.Recipe.CHEMICAL_CRYSTALLIZER.containsRecipe(((IGasItem)itemstack.getItem()).getGas(itemstack).getGas());
|
||||
}
|
||||
else if(slotID == 2)
|
||||
@@ -427,7 +427,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
|
||||
{
|
||||
if(slotID == 0)
|
||||
{
|
||||
return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).getGas(itemstack) == null;
|
||||
return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).getGas(itemstack) == null;
|
||||
}
|
||||
else if(slotID == 1)
|
||||
{
|
||||
|
||||
@@ -195,7 +195,7 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri
|
||||
{
|
||||
if(slotID == 2)
|
||||
{
|
||||
return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null);
|
||||
return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -471,11 +471,11 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl
|
||||
{
|
||||
if(slotID == 0 || slotID == 2)
|
||||
{
|
||||
return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canReceiveGas(itemstack, null);
|
||||
return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canReceiveGas(itemstack, null);
|
||||
}
|
||||
else if(slotID == 1)
|
||||
{
|
||||
return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null);
|
||||
return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null);
|
||||
}
|
||||
else if(slotID == 3)
|
||||
{
|
||||
|
||||
@@ -173,7 +173,7 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp
|
||||
{
|
||||
if(slotID == 2)
|
||||
{
|
||||
return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null);
|
||||
return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -465,7 +465,7 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
|
||||
{
|
||||
if(slotID == 1)
|
||||
{
|
||||
return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null);
|
||||
return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null);
|
||||
}
|
||||
else if(slotID == 2)
|
||||
{
|
||||
|
||||
@@ -140,7 +140,7 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl
|
||||
{
|
||||
inventory.set(slotID, itemstack);
|
||||
|
||||
if(itemstack != null && itemstack.getCount() > getInventoryStackLimit())
|
||||
if(!itemstack.isEmpty() && itemstack.getCount() > getInventoryStackLimit())
|
||||
{
|
||||
itemstack.setCount(getInventoryStackLimit());
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
public boolean doEject = false;
|
||||
public boolean doPull = false;
|
||||
|
||||
public ItemStack missingStack = null;
|
||||
public ItemStack missingStack = ItemStack.EMPTY;
|
||||
|
||||
public int BASE_DELAY = 80;
|
||||
|
||||
@@ -278,7 +278,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
|
||||
world.playEvent(null, 2001, coord.getPos(), Block.getStateId(state));
|
||||
|
||||
missingStack = null;
|
||||
missingStack = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -305,7 +305,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
}
|
||||
}
|
||||
|
||||
if(doEject && delayTicks == 0 && getTopEject(false, null) != null && getEjectInv() != null && getEjectTile() != null)
|
||||
if(doEject && delayTicks == 0 && !getTopEject(false, null).isEmpty() && getEjectInv() != null && getEjectTile() != null)
|
||||
{
|
||||
if(getEjectInv() instanceof IInventory)
|
||||
{
|
||||
@@ -381,7 +381,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
{
|
||||
ItemStack stack = getReplace(index);
|
||||
|
||||
if(stack != null)
|
||||
if(!stack.isEmpty())
|
||||
{
|
||||
world.setBlockState(obj.getPos(), Block.getBlockFromItem(stack.getItem()).getStateFromMeta(stack.getItemDamage()), 3);
|
||||
|
||||
@@ -417,9 +417,9 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
{
|
||||
MinerFilter filter = replaceMap.get(index);
|
||||
|
||||
if(filter == null || filter.replaceStack == null)
|
||||
if(filter == null || filter.replaceStack.isEmpty())
|
||||
{
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 27; i++)
|
||||
@@ -480,7 +480,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public boolean canInsert(List<ItemStack> stacks)
|
||||
@@ -497,7 +497,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
stacks:
|
||||
for(ItemStack stack : stacks)
|
||||
{
|
||||
if(stack == null || stack.getItem() == null)
|
||||
if(stack.isEmpty() || stack.getItem() == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -609,7 +609,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
running = false;
|
||||
oresToMine.clear();
|
||||
replaceMap.clear();
|
||||
missingStack = null;
|
||||
missingStack = ItemStack.EMPTY;
|
||||
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
@@ -618,7 +618,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
{
|
||||
for(MinerFilter filter : filters)
|
||||
{
|
||||
if(filter.replaceStack != null && filter.replaceStack.isItemEqual(stack))
|
||||
if(!filter.replaceStack.isEmpty() && filter.replaceStack.isItemEqual(stack))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -823,7 +823,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
missingStack = new ItemStack(Item.getItemById(dataStream.readInt()), 1, dataStream.readInt());
|
||||
}
|
||||
else {
|
||||
missingStack = null;
|
||||
missingStack = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
filters.clear();
|
||||
@@ -856,7 +856,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
missingStack = new ItemStack(Item.getItemById(dataStream.readInt()), 1, dataStream.readInt());
|
||||
}
|
||||
else {
|
||||
missingStack = null;
|
||||
missingStack = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
else if(type == 2)
|
||||
@@ -881,7 +881,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
missingStack = new ItemStack(Item.getItemById(dataStream.readInt()), 1, dataStream.readInt());
|
||||
}
|
||||
else {
|
||||
missingStack = null;
|
||||
missingStack = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -922,7 +922,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
data.add(controlType.ordinal());
|
||||
data.add(inverse);
|
||||
|
||||
if(missingStack != null)
|
||||
if(!missingStack.isEmpty())
|
||||
{
|
||||
data.add(true);
|
||||
data.add(MekanismUtils.getID(missingStack));
|
||||
@@ -959,7 +959,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
data.add(getSize());
|
||||
}
|
||||
|
||||
if(missingStack != null)
|
||||
if(!missingStack.isEmpty())
|
||||
{
|
||||
data.add(true);
|
||||
data.add(MekanismUtils.getID(missingStack));
|
||||
@@ -1000,7 +1000,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
data.add(controlType.ordinal());
|
||||
data.add(inverse);
|
||||
|
||||
if(missingStack != null)
|
||||
if(!missingStack.isEmpty())
|
||||
{
|
||||
data.add(true);
|
||||
data.add(MekanismUtils.getID(missingStack));
|
||||
@@ -1220,7 +1220,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
}
|
||||
else if(location.equals(pull))
|
||||
{
|
||||
if(itemstack != null && isReplaceStack(itemstack))
|
||||
if(!itemstack.isEmpty() && isReplaceStack(itemstack))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1239,7 +1239,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
|
||||
if(location.equals(eject))
|
||||
{
|
||||
if(itemstack != null && isReplaceStack(itemstack))
|
||||
if(!itemstack.isEmpty() && isReplaceStack(itemstack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public class TileComponentEjector implements ITileComponent
|
||||
{
|
||||
int slotID = sideData.get(TransmissionType.ITEM).availableSlots[index];
|
||||
|
||||
if(tileEntity.getStackInSlot(slotID) == null)
|
||||
if(tileEntity.getStackInSlot(slotID).isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -207,12 +207,12 @@ public class TileComponentEjector implements ITileComponent
|
||||
}
|
||||
}
|
||||
|
||||
if(stack == null || prev.getCount() != stack.getCount())
|
||||
if(stack.isEmpty() || prev.getCount() != stack.getCount())
|
||||
{
|
||||
trackers.get(TransmissionType.ITEM)[index] = side.ordinal();
|
||||
}
|
||||
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<IInve
|
||||
IInventory inv = (IInventory)tile;
|
||||
InvStack stack = InventoryUtils.takeTopItem(inv, side, tier.pullAmount);
|
||||
|
||||
if(stack != null && stack.getStack() != null)
|
||||
if(stack != null && !stack.getStack().isEmpty())
|
||||
{
|
||||
ItemStack rejects = TransporterUtils.insert(tile, getTransmitter(), stack.getStack(), getTransmitter().getColor(), true, 0);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class TransporterImpl extends TransmitterImpl<IInventory, InventoryNetwor
|
||||
{
|
||||
if(!stack.initiatedPath)
|
||||
{
|
||||
if(stack.itemStack == null || stack.itemStack == ItemStack.EMPTY || !recalculate(stack, null))
|
||||
if(stack.itemStack.isEmpty() || !recalculate(stack, null))
|
||||
{
|
||||
remove.add(stack);
|
||||
continue;
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class ItemRegistryUtils
|
||||
/* Mod ID lookup thanks to JEI */
|
||||
public static String getMod(ItemStack stack)
|
||||
{
|
||||
if(stack == null || stack.getItem() == null)
|
||||
if(stack.isEmpty() || stack.getItem() == null)
|
||||
{
|
||||
return "null";
|
||||
}
|
||||
|
||||
@@ -1218,7 +1218,7 @@ public final class MekanismUtils
|
||||
try {
|
||||
FontRenderer renderer = (FontRenderer)Mekanism.proxy.getFontRenderer();
|
||||
|
||||
if(stack != null && stack.getItem().getFontRenderer(stack) != null)
|
||||
if(!stack.isEmpty() && stack.getItem().getFontRenderer(stack) != null)
|
||||
{
|
||||
renderer = stack.getItem().getFontRenderer(stack);
|
||||
}
|
||||
@@ -1404,7 +1404,7 @@ public final class MekanismUtils
|
||||
*/
|
||||
public static int getID(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack == null)
|
||||
if(itemStack.isEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class RecipeUtils
|
||||
{
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
|
||||
if(itemstack != null && itemstack.getItem() instanceof IEnergizedItem)
|
||||
if(!itemstack.isEmpty() && itemstack.getItem() instanceof IEnergizedItem)
|
||||
{
|
||||
energyFound += ((IEnergizedItem)itemstack.getItem()).getEnergy(itemstack);
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class RecipeUtils
|
||||
{
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
|
||||
if(itemstack != null && itemstack.getItem() instanceof IGasItem)
|
||||
if(!itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem)
|
||||
{
|
||||
GasStack stored = ((IGasItem)itemstack.getItem()).getGas(itemstack);
|
||||
|
||||
@@ -149,7 +149,7 @@ public class RecipeUtils
|
||||
{
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
|
||||
if(itemstack != null && itemstack.getItem() instanceof ISecurityItem)
|
||||
if(!itemstack.isEmpty() && itemstack.getItem() instanceof ISecurityItem)
|
||||
{
|
||||
((ISecurityItem)toReturn.getItem()).setOwner(toReturn, ((ISecurityItem)itemstack.getItem()).getOwner(itemstack));
|
||||
((ISecurityItem)toReturn.getItem()).setSecurity(toReturn, ((ISecurityItem)itemstack.getItem()).getSecurity(itemstack));
|
||||
@@ -209,7 +209,7 @@ public class RecipeUtils
|
||||
{
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
|
||||
if(itemstack != null && BasicBlockType.get(itemstack) == BasicBlockType.BIN)
|
||||
if(!itemstack.isEmpty() && BasicBlockType.get(itemstack) == BasicBlockType.BIN)
|
||||
{
|
||||
InventoryBin binInv = new InventoryBin(itemstack);
|
||||
|
||||
@@ -234,7 +234,7 @@ public class RecipeUtils
|
||||
{
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
|
||||
if(itemstack != null && BlockStateMachine.MachineType.get(itemstack) != null && BlockStateMachine.MachineType.get(itemstack).supportsUpgrades)
|
||||
if(!itemstack.isEmpty() && BlockStateMachine.MachineType.get(itemstack) != null && BlockStateMachine.MachineType.get(itemstack).supportsUpgrades)
|
||||
{
|
||||
Map<Upgrade, Integer> stackMap = Upgrade.buildMap(ItemDataUtils.getDataMap(itemstack));
|
||||
|
||||
@@ -294,7 +294,7 @@ public class RecipeUtils
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public static boolean removeRecipes(ItemStack stack)
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class SecurityUtils
|
||||
return owner == null || owner.equals(player.getName());
|
||||
}
|
||||
|
||||
if(stack == null || !(stack.getItem() instanceof ISecurityItem))
|
||||
if(stack.isEmpty() || !(stack.getItem() instanceof ISecurityItem))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public class VoiceConnection extends Thread
|
||||
|
||||
public boolean canListen(int channel, ItemStack itemStack)
|
||||
{
|
||||
if(itemStack != null)
|
||||
if(!itemStack.isEmpty())
|
||||
{
|
||||
if(itemStack.getItem() instanceof ItemWalkieTalkie)
|
||||
{
|
||||
@@ -198,7 +198,7 @@ public class VoiceConnection extends Thread
|
||||
{
|
||||
ItemStack itemStack = getPlayer().inventory.getCurrentItem();
|
||||
|
||||
if(itemStack != null)
|
||||
if(!itemStack.isEmpty())
|
||||
{
|
||||
ItemWalkieTalkie walkieTalkie = (ItemWalkieTalkie)itemStack.getItem();
|
||||
|
||||
|
||||
@@ -413,7 +413,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock
|
||||
int metadata = state.getBlock().getMetaFromState(state);
|
||||
ItemStack stack = entityplayer.getHeldItem(hand);
|
||||
|
||||
if(stack != null)
|
||||
if(!stack.isEmpty())
|
||||
{
|
||||
Item tool = stack.getItem();
|
||||
|
||||
@@ -457,7 +457,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock
|
||||
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
if(stack != null && stack.getItem() == GeneratorsItems.TurbineBlade)
|
||||
if(!stack.isEmpty() && stack.getItem() == GeneratorsItems.TurbineBlade)
|
||||
{
|
||||
if(!world.isRemote && rod.editBlade(true))
|
||||
{
|
||||
@@ -467,7 +467,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock
|
||||
|
||||
if(stack.getCount() == 0)
|
||||
{
|
||||
entityplayer.setHeldItem(hand, null);
|
||||
entityplayer.setHeldItem(hand, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -478,7 +478,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock
|
||||
else {
|
||||
if(!world.isRemote)
|
||||
{
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
{
|
||||
if(rod.editBlade(false))
|
||||
{
|
||||
|
||||
@@ -178,7 +178,7 @@ public abstract class BlockReactor extends BlockContainer implements ICTMBlock
|
||||
int metadata = state.getBlock().getMetaFromState(state);
|
||||
ItemStack stack = entityplayer.getHeldItem(hand);
|
||||
|
||||
if(stack != null)
|
||||
if(!stack.isEmpty())
|
||||
{
|
||||
if(MekanismUtils.isBCWrench(stack.getItem()) && !stack.getUnlocalizedName().contains("omniwrench"))
|
||||
{
|
||||
|
||||
@@ -397,7 +397,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
|
||||
{
|
||||
getReactor().getInventory().set(slotID, itemstack);
|
||||
|
||||
if(itemstack != null && itemstack.getCount() > getInventoryStackLimit())
|
||||
if(!itemstack.isEmpty() && itemstack.getCount() > getInventoryStackLimit())
|
||||
{
|
||||
itemstack.setCount(getInventoryStackLimit());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user