From 349510f2dabc9e7dc9ae5ff1fdc71fef11dd8016 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sat, 13 Aug 2016 03:04:47 +0100 Subject: [PATCH] Bugfixes 1 --- .../gui/GT_GUIContainerMetaTile_Machine.java | 3 +- .../java/gregtech/api/util/GT_ModHandler.java | 42 +++++++++---------- src/main/java/gregtech/common/GT_Proxy.java | 12 +++--- .../GT_MetaTileEntity_FusionComputer.java | 2 +- .../GT_MetaTileEntity_ProcessingArray.java | 5 ++- 5 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java b/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java index 4c20715e..574b1110 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java @@ -29,7 +29,8 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer { super.drawGuiContainerBackgroundLayer(par1, par2, par3); if (GregTech_API.sColoredGUI && mContainer != null && mContainer.mTileEntity != null) { int tColor = mContainer.mTileEntity.getColorization() & 15; - if (tColor >= 0 && tColor < ItemDye.field_150922_c.length) { + /* Bug kind and pattern: INT - INT_BAD_COMPARISON_WITH_NONNEGATIVE_VALUE */ + if (/*tColor >= 0 && */tColor < ItemDye.field_150922_c.length) { tColor = ItemDye.field_150922_c[tColor]; GL11.glColor4f(((tColor >> 16) & 255) / 255.0F, ((tColor >> 8) & 255) / 255.0F, (tColor & 255) / 255.0F, 1.0F); } else GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index be85ca29..25992d27 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -1267,33 +1267,31 @@ public class GT_ModHandler { for (IRecipe tRecipe : (ArrayList) CraftingManager.getInstance().getRecipeList()) { ItemStack tStack = tRecipe.getRecipeOutput(); if (GT_Utility.isStackValid(tStack) && tStack.getMaxStackSize() == 1 && tStack.getMaxDamage() > 0 && !(tStack.getItem() instanceof ItemBlock) && !(tStack.getItem() instanceof IReactorComponent) && !isElectricItem(tStack) && !GT_Utility.isStackInList(tStack, sNonReplaceableItems)) { - if (!(tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe)) { - if (tRecipe instanceof ShapedOreRecipe) { - boolean temp = true; - for (Object tObject : ((ShapedOreRecipe) tRecipe).getInput()) - if (tObject != null) { - if (tObject instanceof ItemStack && (((ItemStack) tObject).getItem() == null || ((ItemStack) tObject).getMaxStackSize() < 2 || ((ItemStack) tObject).getMaxDamage() > 0 || ((ItemStack) tObject).getItem() instanceof ItemBlock)) { - temp = false; - break; - } - if (tObject instanceof List && ((List) tObject).isEmpty()) { - temp = false; - break; - } + if (tRecipe instanceof ShapedOreRecipe) { + boolean temp = true; + for (Object tObject : ((ShapedOreRecipe) tRecipe).getInput()) + if (tObject != null) { + if (tObject instanceof ItemStack && (((ItemStack) tObject).getItem() == null || ((ItemStack) tObject).getMaxStackSize() < 2 || ((ItemStack) tObject).getMaxDamage() > 0 || ((ItemStack) tObject).getItem() instanceof ItemBlock)) { + temp = false; + break; } - if (temp) sSingleNonBlockDamagableRecipeList.add(tRecipe); - } else if (tRecipe instanceof ShapedRecipes) { - boolean temp = true; - for (ItemStack tObject : ((ShapedRecipes) tRecipe).recipeItems) { - if (tObject != null && (tObject.getItem() == null || tObject.getMaxStackSize() < 2 || tObject.getMaxDamage() > 0 || tObject.getItem() instanceof ItemBlock)) { + if (tObject instanceof List && ((List) tObject).isEmpty()) { temp = false; break; } } - if (temp) sSingleNonBlockDamagableRecipeList.add(tRecipe); - } else { - sSingleNonBlockDamagableRecipeList.add(tRecipe); + if (temp) sSingleNonBlockDamagableRecipeList.add(tRecipe); + } else if (tRecipe instanceof ShapedRecipes) { + boolean temp = true; + for (ItemStack tObject : ((ShapedRecipes) tRecipe).recipeItems) { + if (tObject != null && (tObject.getItem() == null || tObject.getMaxStackSize() < 2 || tObject.getMaxDamage() > 0 || tObject.getItem() instanceof ItemBlock)) { + temp = false; + break; + } } + if (temp) sSingleNonBlockDamagableRecipeList.add(tRecipe); + } else { + sSingleNonBlockDamagableRecipeList.add(tRecipe); } } } @@ -1403,7 +1401,7 @@ public class GT_ModHandler { for (Entry tEntry : aRecipeList.entrySet()) { if (tEntry.getKey().matches(aInput)) { if (tEntry.getKey().getAmount() <= aInput.stackSize) { - ItemStack[] tList = (ItemStack[]) tEntry.getValue().items.toArray(); + ItemStack[] tList = (ItemStack[]) tEntry.getValue().items.toArray(new ItemStack[tEntry.getValue().items.size()]); if (tList.length == 0) break; ItemStack[] rList = new ItemStack[aOutputSlots.length]; rRecipeMetaData.setTag("return", tEntry.getValue().metadata); diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index f9cf4f97..ffe2a39a 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -175,12 +175,14 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { onFluidContainerRegistration(new FluidContainerRegistry.FluidContainerRegisterEvent(tData)); } - for (String tOreName : OreDictionary.getOreNames()) { - ItemStack tOreStack; - for (Iterator i$ = OreDictionary.getOres(tOreName).iterator(); i$.hasNext(); registerOre(new OreDictionary.OreRegisterEvent(tOreName, tOreStack))) { - tOreStack = (ItemStack) i$.next(); + try { + for (String tOreName : OreDictionary.getOreNames()) { + ItemStack tOreStack; + for (Iterator i$ = OreDictionary.getOres(tOreName).iterator(); i$.hasNext(); registerOre(new OreDictionary.OreRegisterEvent(tOreName, tOreStack))) { + tOreStack = (ItemStack) i$.next(); + } } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } private static final void registerRecipes(OreDictEventContainer aOre) { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java index 7d950a49..72dd43d0 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java @@ -265,7 +265,7 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity if (tFluidList.size() > 1) { FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sFusionRecipes.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, GT_Values.V[8], tFluids, new ItemStack[]{}); - if (tRecipe == null && !mRunningOnLoad) { + if (mRunningOnLoad) { turnCasingActive(false); this.mLastRecipe = null; return false; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java index 7183aa30..bb3ef55b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java @@ -238,14 +238,15 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); List overStacks = new ArrayList(); for (int f = 0; f < tOut.length; f++) { - if (tOut[f].getMaxStackSize() < tOut[f].stackSize) { + /* FindBugs: Bug kind and pattern: RpC - RpC_REPEATED_CONDITIONAL_TEST */ + //if (tOut[f].getMaxStackSize() < tOut[f].stackSize) { while (tOut[f].getMaxStackSize() < tOut[f].stackSize) { ItemStack tmp = tOut[f].copy(); tmp.stackSize = tmp.getMaxStackSize(); tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize(); overStacks.add(tmp); } - } + //} } if (overStacks.size() > 0) { ItemStack[] tmp = new ItemStack[overStacks.size()];