mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 23:03:01 +00:00
Null ItemStack cleanup
This commit is contained in:
1 parent
398f0284a8
commit
c12059e1b1
12 files changed
+40
-45
No files matched your search
@@ -2,7 +2,6 @@ package mekanism.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasTank;
|
||||
@@ -49,7 +48,7 @@ public class GuiChemicalCrystallizer extends GuiMekanism
|
||||
|
||||
public Gas prevGas;
|
||||
|
||||
public @Nullable ItemStack renderStack;
|
||||
public ItemStack renderStack = ItemStack.EMPTY;
|
||||
|
||||
public int stackSwitch = 0;
|
||||
|
||||
@@ -126,7 +125,7 @@ public class GuiChemicalCrystallizer extends GuiMekanism
|
||||
}
|
||||
}
|
||||
|
||||
if(renderStack != null && !renderStack.isEmpty())
|
||||
if(!renderStack.isEmpty())
|
||||
{
|
||||
try {
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -160,7 +159,7 @@ public class GuiChemicalCrystallizer extends GuiMekanism
|
||||
private void resetStacks()
|
||||
{
|
||||
iterStacks.clear();
|
||||
renderStack = null;
|
||||
renderStack = ItemStack.EMPTY;
|
||||
stackSwitch = 0;
|
||||
stackIndex = -1;
|
||||
}
|
||||
@@ -213,7 +212,7 @@ public class GuiChemicalCrystallizer extends GuiMekanism
|
||||
}
|
||||
else if(iterStacks != null && iterStacks.size() == 0)
|
||||
{
|
||||
renderStack = null;
|
||||
renderStack = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
@@ -155,7 +154,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism
|
||||
{
|
||||
if(entry.getValue().iterStacks != null && entry.getValue().iterStacks.size() == 0)
|
||||
{
|
||||
entry.getValue().renderStack = null;
|
||||
entry.getValue().renderStack = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +162,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism
|
||||
{
|
||||
if(entry.getValue().iterStacks != null && entry.getValue().iterStacks.size() == 0)
|
||||
{
|
||||
entry.getValue().renderStack = null;
|
||||
entry.getValue().renderStack = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -465,7 +464,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism
|
||||
{
|
||||
MItemStackFilter itemFilter = (MItemStackFilter)filter;
|
||||
|
||||
if(itemFilter.itemType != null && !itemFilter.itemType.isEmpty())
|
||||
if(!itemFilter.itemType.isEmpty())
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -486,7 +485,8 @@ public class GuiDigitalMinerConfig extends GuiMekanism
|
||||
}
|
||||
|
||||
ItemStack renderStack = oreDictStacks.get(filter).renderStack;
|
||||
if(renderStack != null && !renderStack.isEmpty())
|
||||
|
||||
if(!renderStack.isEmpty())
|
||||
{
|
||||
try {
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -503,7 +503,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism
|
||||
{
|
||||
MMaterialFilter itemFilter = (MMaterialFilter)filter;
|
||||
|
||||
if(itemFilter.materialItem != null && !itemFilter.materialItem.isEmpty())
|
||||
if(!itemFilter.materialItem.isEmpty())
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -524,7 +524,8 @@ public class GuiDigitalMinerConfig extends GuiMekanism
|
||||
}
|
||||
|
||||
ItemStack renderStack = modIDStacks.get(filter).renderStack;
|
||||
if(renderStack != null && !renderStack.isEmpty())
|
||||
|
||||
if(!renderStack.isEmpty())
|
||||
{
|
||||
try {
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -765,7 +766,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism
|
||||
{
|
||||
public List<ItemStack> iterStacks;
|
||||
public int stackIndex;
|
||||
public @Nullable ItemStack renderStack;
|
||||
public ItemStack renderStack = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
@@ -174,7 +173,7 @@ public class GuiLogisticalSorter extends GuiMekanism
|
||||
{
|
||||
if(entry.getValue().iterStacks != null && entry.getValue().iterStacks.size() == 0)
|
||||
{
|
||||
entry.getValue().renderStack = null;
|
||||
entry.getValue().renderStack = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +181,7 @@ public class GuiLogisticalSorter extends GuiMekanism
|
||||
{
|
||||
if(entry.getValue().iterStacks != null && entry.getValue().iterStacks.size() == 0)
|
||||
{
|
||||
entry.getValue().renderStack = null;
|
||||
entry.getValue().renderStack = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -472,7 +471,7 @@ public class GuiLogisticalSorter extends GuiMekanism
|
||||
{
|
||||
final TItemStackFilter itemFilter = (TItemStackFilter) filter;
|
||||
|
||||
if(itemFilter.itemType != null && !itemFilter.itemType.isEmpty())
|
||||
if(!itemFilter.itemType.isEmpty())
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -494,7 +493,8 @@ public class GuiLogisticalSorter extends GuiMekanism
|
||||
}
|
||||
|
||||
ItemStack renderStack = oreDictStacks.get(filter).renderStack;
|
||||
if(renderStack != null && !renderStack.isEmpty())
|
||||
|
||||
if(!renderStack.isEmpty())
|
||||
{
|
||||
try {
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -512,7 +512,7 @@ public class GuiLogisticalSorter extends GuiMekanism
|
||||
{
|
||||
final TMaterialFilter itemFilter = (TMaterialFilter) filter;
|
||||
|
||||
if(itemFilter.materialItem != null && !itemFilter.materialItem.isEmpty())
|
||||
if(!itemFilter.materialItem.isEmpty())
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -534,7 +534,8 @@ public class GuiLogisticalSorter extends GuiMekanism
|
||||
}
|
||||
|
||||
ItemStack renderStack = modIDStacks.get(filter).renderStack;
|
||||
if(renderStack != null && !renderStack.isEmpty())
|
||||
|
||||
if(!renderStack.isEmpty())
|
||||
{
|
||||
try {
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -724,10 +725,8 @@ public class GuiLogisticalSorter extends GuiMekanism
|
||||
public static class StackData
|
||||
{
|
||||
public List<ItemStack> iterStacks;
|
||||
|
||||
public int stackIndex;
|
||||
|
||||
public @Nullable ItemStack renderStack;
|
||||
public ItemStack renderStack = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,6 @@ package mekanism.client.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
@@ -44,7 +43,7 @@ public class GuiOredictionificatorFilter extends GuiMekanism
|
||||
|
||||
public boolean isNew;
|
||||
|
||||
public @Nullable ItemStack renderStack;
|
||||
public ItemStack renderStack = ItemStack.EMPTY;
|
||||
|
||||
public GuiOredictionificatorFilter(EntityPlayer player, TileEntityOredictionificator tentity, int index)
|
||||
{
|
||||
@@ -150,7 +149,7 @@ public class GuiOredictionificatorFilter extends GuiMekanism
|
||||
renderScaledText(filter.filter, 32, 38, 0x404040, 111);
|
||||
}
|
||||
|
||||
if(renderStack != null && !renderStack.isEmpty())
|
||||
if(!renderStack.isEmpty())
|
||||
{
|
||||
try {
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -178,7 +177,7 @@ public class GuiOredictionificatorFilter extends GuiMekanism
|
||||
|
||||
if(xAxis >= 45 && xAxis <= 61 && yAxis >= 19 && yAxis <= 35)
|
||||
{
|
||||
if(renderStack != null && !renderStack.isEmpty())
|
||||
if(!renderStack.isEmpty())
|
||||
{
|
||||
String name = ItemRegistryUtils.getMod(renderStack);
|
||||
String extra = name.equals("null") ? "" : " (" + name + ")";
|
||||
@@ -369,7 +368,7 @@ public class GuiOredictionificatorFilter extends GuiMekanism
|
||||
{
|
||||
if(filter.filter == null || filter.filter.isEmpty())
|
||||
{
|
||||
renderStack = null;
|
||||
renderStack = ItemStack.EMPTY;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -377,7 +376,7 @@ public class GuiOredictionificatorFilter extends GuiMekanism
|
||||
|
||||
if(stacks.isEmpty())
|
||||
{
|
||||
renderStack = null;
|
||||
renderStack = ItemStack.EMPTY;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -386,7 +385,7 @@ public class GuiOredictionificatorFilter extends GuiMekanism
|
||||
renderStack = stacks.get(filter.index).copy();
|
||||
}
|
||||
else {
|
||||
renderStack = null;
|
||||
renderStack = ItemStack.EMPTY;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ShapelessMekanismRecipeWrapper extends BlankRecipeWrapper
|
||||
List<List<ItemStack>> inputs = stackHelper.expandRecipeItemStackInputs(recipe.getInput());
|
||||
ingredients.setInputLists(ItemStack.class, inputs);
|
||||
|
||||
if(recipeOutput != null && !recipeOutput.isEmpty())
|
||||
if(!recipeOutput.isEmpty())
|
||||
{
|
||||
ingredients.setOutput(ItemStack.class, recipeOutput);
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ public class RenderBin extends TileEntitySpecialRenderer<TileEntityBin>
|
||||
public void render(EnumFacing facing, ItemStack itemType, int clientAmount, boolean text, double x, double y, double z)
|
||||
{
|
||||
String amount = "";
|
||||
|
||||
if(itemType != null && !itemType.isEmpty())
|
||||
|
||||
if(!itemType.isEmpty())
|
||||
{
|
||||
amount = Integer.toString(clientAmount);
|
||||
|
||||
@@ -45,10 +45,7 @@ public class RenderBin extends TileEntitySpecialRenderer<TileEntityBin>
|
||||
{
|
||||
amount = LangUtils.localize("gui.infinite");
|
||||
}
|
||||
}
|
||||
|
||||
if(itemType != null && !itemType.isEmpty())
|
||||
{
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
switch(facing)
|
||||
|
||||
@@ -410,7 +410,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
|
||||
if(mop != null && mop.sideHit == bin.facing)
|
||||
{
|
||||
if(bin.bottomStack != null && !bin.bottomStack.isEmpty())
|
||||
if(!bin.bottomStack.isEmpty())
|
||||
{
|
||||
if(!player.isSneaking())
|
||||
{
|
||||
|
||||
@@ -366,7 +366,7 @@ public final class OreDictManager
|
||||
tempCrafting.setInventorySlotContents(0, log);
|
||||
ItemStack resultEntry = MekanismUtils.findMatchingRecipe(tempCrafting, null);
|
||||
|
||||
if(resultEntry != null && !resultEntry.isEmpty())
|
||||
if(!resultEntry.isEmpty())
|
||||
{
|
||||
RecipeHandler.addPrecisionSawmillRecipe(log, StackUtils.size(resultEntry, 6), new ItemStack(MekanismItems.Sawdust), 1);
|
||||
}
|
||||
@@ -377,7 +377,7 @@ public final class OreDictManager
|
||||
tempCrafting.setInventorySlotContents(0, log);
|
||||
ItemStack resultEntry = MekanismUtils.findMatchingRecipe(tempCrafting, null);
|
||||
|
||||
if(resultEntry != null && !resultEntry.isEmpty())
|
||||
if(!resultEntry.isEmpty())
|
||||
{
|
||||
RecipeHandler.addPrecisionSawmillRecipe(log, StackUtils.size(resultEntry, 6), new ItemStack(MekanismItems.Sawdust), 1);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class InfusionInput extends MachineInput<InfusionInput>
|
||||
public InfuseStorage infuse;
|
||||
|
||||
/** The input ItemStack */
|
||||
public ItemStack inputStack;
|
||||
public ItemStack inputStack = ItemStack.EMPTY;
|
||||
|
||||
public InfusionInput(InfuseStorage storage, ItemStack itemStack)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ public class InfusionInput extends MachineInput<InfusionInput>
|
||||
@Override
|
||||
public boolean isValid()
|
||||
{
|
||||
return infuse.type != null && inputStack != null && !inputStack.isEmpty();
|
||||
return infuse.type != null && !inputStack.isEmpty();
|
||||
}
|
||||
|
||||
public boolean use(NonNullList<ItemStack> inventory, int index, InfuseStorage infuseStorage, boolean deplete)
|
||||
|
||||
@@ -27,7 +27,7 @@ public abstract class MachineInput<INPUT extends MachineInput<INPUT>>
|
||||
|
||||
public static boolean inputContains(ItemStack container, ItemStack contained)
|
||||
{
|
||||
if(container != null && !container.isEmpty() && container.getCount() >= contained.getCount())
|
||||
if(!container.isEmpty() && container.getCount() >= contained.getCount())
|
||||
{
|
||||
if(MekanismUtils.getOreDictName(container).contains("treeSapling"))
|
||||
{
|
||||
|
||||
@@ -740,7 +740,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot)
|
||||
{
|
||||
if(slot != 0 || tileEntityBin.itemType == null || tileEntityBin.itemType.isEmpty())
|
||||
if(slot != 0 || tileEntityBin.itemType.isEmpty())
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@@ -970,7 +970,7 @@ public final class MekanismUtils
|
||||
{
|
||||
Object obj = itr.next();
|
||||
|
||||
if(obj instanceof IRecipe && ((IRecipe)obj).getRecipeOutput() != null && !((IRecipe)obj).getRecipeOutput().isEmpty())
|
||||
if(obj instanceof IRecipe && !((IRecipe)obj).getRecipeOutput().isEmpty())
|
||||
{
|
||||
for(ItemStack itemStack : itemStacks)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user