diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core')
11 files changed, 24 insertions, 19 deletions
diff --git a/src/Java/gtPlusPlus/core/commands/CommandMath.java b/src/Java/gtPlusPlus/core/commands/CommandMath.java index 01091d84e3..b41745c660 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandMath.java +++ b/src/Java/gtPlusPlus/core/commands/CommandMath.java @@ -88,11 +88,11 @@ public class CommandMath implements ICommand ChunkCoordinates Y = null; Utils.LOG_WARNING("Bed Location: "+Y); try { - if (P.getBedLocation(0).equals(null)){ + if (P.getBedLocation(0) == null){ Y = W.getSpawnPoint(); Utils.LOG_WARNING("Spawn Location: "+Y); } - else if (!P.getBedLocation(0).equals(null)){ + else if (P.getBedLocation(0) != null){ Y = P.getBedLocation(0); Utils.LOG_WARNING("Bed Location: "+Y); } @@ -104,7 +104,7 @@ public class CommandMath implements ICommand catch(NullPointerException e) { PlayerUtils.messagePlayer(P, "You do not have a spawn, so..."); } - if (Y == null || Y.equals(null)) { + if (Y == null) { Y = W.getSpawnPoint(); Utils.LOG_WARNING("Spawn Location: "+Y); } diff --git a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java index 1475c98a66..7d7a40c356 100644 --- a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java @@ -20,7 +20,7 @@ public class PickaxeBlockBreakEventHandler { public void onBreakBlock(BreakEvent event) { try{ TileEntity entity = event.world.getTileEntity(event.x, event.y, event.z); - if (entity != null && !entity.equals(null)){ + if (entity != null){ EntityPlayer playerInternal = event.getPlayer(); Utils.LOG_WARNING(entity.getClass().getSimpleName()); if (entity.getClass().getSimpleName().equals("")){ diff --git a/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java b/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java index fcda57aa93..559301f4f0 100644 --- a/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java +++ b/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java @@ -60,7 +60,7 @@ public class UnbreakableBlockManager{ private static void innerInvincible(GregtechMetaSafeBlock MetaSafeBlock, TileEntity entity, World TE_WORLD, /*EntityPlayer aPlayer,*/ int X, int Y, int Z){ - if (entity != null && !entity.equals(null)){ + if (entity != null){ Utils.LOG_WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); Utils.LOG_WARNING("Grabbed TE: "+entity.toString()); diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index bab4bfeded..eb5694f1a9 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -79,8 +79,9 @@ public class BaseItemComponent extends Item{ @Override public String getItemStackDisplayName(ItemStack p_77653_1_) { - if (componentMaterial != null) + if (componentMaterial != null) { return (componentMaterial.getLocalizedName()+componentType.DISPLAY_NAME); + } return materialName+" Cell"; } @@ -132,8 +133,9 @@ public class BaseItemComponent extends Item{ //list.add(EnumChatFormatting.GRAY+"A " + materialName + " Ring."); } if (componentMaterial != null){ - if (!componentMaterial.vChemicalFormula.equals("??")) + if (!componentMaterial.vChemicalFormula.equals("??")) { list.add(componentMaterial.vChemicalFormula); + } if (componentMaterial.isRadioactive){ list.add(CORE.GT_Tooltip_Radioactive); diff --git a/src/Java/gtPlusPlus/core/item/base/CoreItem.java b/src/Java/gtPlusPlus/core/item/base/CoreItem.java index 6c3fb531dd..9c7b14f648 100644 --- a/src/Java/gtPlusPlus/core/item/base/CoreItem.java +++ b/src/Java/gtPlusPlus/core/item/base/CoreItem.java @@ -177,7 +177,7 @@ public class CoreItem extends Item @Override public String getItemStackDisplayName(ItemStack tItem) { - if (itemName == null || itemName.equals("") || itemName == "") + if (itemName == null || itemName.equals("")) return super.getItemStackDisplayName(tItem); return itemName; } diff --git a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java index 2c3ee38048..b9345f6f57 100644 --- a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java +++ b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java @@ -38,7 +38,7 @@ public class BaseItemCell extends BaseItemComponent{ private int fluidBright = 0; private int tickValue; - private short fluidColour[]; + private short[] fluidColour; boolean upwards = true; @Override diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index 4e4192262a..696f497afc 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -65,7 +65,7 @@ public class BaseItemDust extends Item{ temp = temp.replace("itemD", "d"); Utils.LOG_WARNING("Generating OreDict Name: "+temp); } - if (temp != null && temp != ""){ + if (temp != null && !temp.equals("")){ oredictName = temp; GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); } @@ -175,7 +175,7 @@ public class BaseItemDust extends Item{ tempIngot = tempIngot.replace("itemDust", "ingot"); Utils.LOG_WARNING("Generating OreDict Name: "+tempIngot); ItemStack[] outputStacks = {dustInfo.getDust(1)}; - if (tempIngot != null && tempIngot != ""){ + if (tempIngot != null && !tempIngot.equals("")){ tempInputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1); tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempDust, 1); ItemStack tempStackOutput2 = null; @@ -216,7 +216,7 @@ public class BaseItemDust extends Item{ return; } temp = temp.replace("itemDust", "ingot"); - if (temp != null && temp != ""){ + if (temp != null && !temp.equals("")){ if (dustInfo.requiresBlastFurnace()){ Utils.LOG_WARNING("Adding recipe for Hot "+materialName+" Ingots in a Blast furnace."); @@ -230,7 +230,7 @@ public class BaseItemDust extends Item{ } Utils.LOG_WARNING("Adding recipe for "+materialName+" Ingots in a furnace."); ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); - Utils.LOG_WARNING("This will produce an ingot of "+tempOutputStack.getDisplayName() + " Debug: "+temp); + //Utils.LOG_WARNING("This will produce an ingot of "+tempOutputStack.getDisplayName() + " Debug: "+temp); if (null != tempOutputStack){ if (mTier < 5 || !dustInfo.requiresBlastFurnace()){ if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(ItemUtils.getSimpleStack(this), tempOutputStack)){ diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java index a2b5bff7f4..3f6ff6e358 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java @@ -35,7 +35,7 @@ public class BaseItemIngot extends BaseItemComponent{ } temp = temp.replace("itemIngot", "block"); Utils.LOG_WARNING("Generating OreDict Name: "+temp); - if (temp != null && temp != ""){ + if (temp != null && !temp.equals("")){ tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); if (tempOutput != null){ GT_ModHandler.addCompressionRecipe(tempStack, tempOutput); diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOLD.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOLD.java index 20e72f2a64..15b1e48200 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOLD.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOLD.java @@ -39,7 +39,7 @@ public class BaseItemIngotOLD extends Item{ else if (unlocalName.contains("itemHotIngot")){ temp = unlocalName.replace("itemHotIngot", "ingotHot"); } - if (temp != null && temp != ""){ + if (temp != null && !temp.equals("")){ GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); } generateCompressorRecipe(); @@ -76,7 +76,7 @@ public class BaseItemIngotOLD extends Item{ } temp = temp.replace("itemIngot", "block"); Utils.LOG_WARNING("Generating OreDict Name: "+temp); - if (temp != null && temp != ""){ + if (temp != null && !temp.equals("")){ tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); if (tempOutput != null){ GT_ModHandler.addCompressionRecipe(tempStack, tempOutput); diff --git a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java index 468940ac59..82c38de8bd 100644 --- a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java @@ -153,6 +153,9 @@ public class ItemUtils { @SuppressWarnings("unused") public static ItemStack simpleMetaStack(Item item, int meta, int itemstackSize){ try { + if (item == null){ + return null; + } Item em = item; Item em1 = item; Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); @@ -192,7 +195,7 @@ public class ItemUtils { public static ItemStack getCorrectStacktype(Object item_Input, int stackSize) { if (item_Input instanceof String){ - return getCorrectStacktype(item_Input, stackSize); + return getItemStackOfAmountFromOreDictNoBroken((String) item_Input, stackSize); } else if (item_Input instanceof ItemStack){ return (ItemStack) item_Input; @@ -234,7 +237,7 @@ public class ItemUtils { public static ItemStack[] validItemsForOreDict(String oredictName){ List<?> validNames = MaterialUtils.oreDictValuesForEntry(oredictName); - ItemStack[] inputs = null; + ItemStack[] inputs = new ItemStack[validNames.size()]; for (int i=0; i<validNames.size();i++){ inputs[i] = (ItemStack) validNames.get(i); } diff --git a/src/Java/gtPlusPlus/core/util/player/PlayerCache.java b/src/Java/gtPlusPlus/core/util/player/PlayerCache.java index 969de8dc08..85bba2470a 100644 --- a/src/Java/gtPlusPlus/core/util/player/PlayerCache.java +++ b/src/Java/gtPlusPlus/core/util/player/PlayerCache.java @@ -14,7 +14,7 @@ public class PlayerCache { private static final File cache = new File("PlayerCache.dat"); public static final void initCache() { - if (CORE.PlayerCache == null || CORE.PlayerCache.equals(null)){ + if (CORE.PlayerCache == null){ try { if (cache != null){ |