From 04fec51acb0f1053dfea595c04ea0862da1d4f37 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sat, 13 Aug 2016 09:10:38 +0100 Subject: [PATCH] Remove null checks --- src/main/java/gregtech/GT_Mod.java | 4 ++-- src/main/java/gregtech/api/enums/Dyes.java | 2 +- .../java/gregtech/api/enums/Materials.java | 2 +- .../java/gregtech/api/enums/OrePrefixes.java | 2 +- .../IMetaTileEntityItemPipe.java | 6 +++--- .../api/items/GT_Spray_Hardener_Item.java | 2 +- .../metatileentity/BaseMetaTileEntity.java | 2 +- .../metatileentity/BaseMetaTileEntityUE.java | 4 ++-- .../GT_Runnable_MachineBlockUpdate.java | 4 ++-- .../gregtech/api/util/GT_PlayedSound.java | 2 +- .../java/gregtech/api/util/GT_Utility.java | 20 ++++++++++--------- .../common/blocks/GT_Block_Machines.java | 11 +++++----- .../common/blocks/GT_Block_Ores_Abstract.java | 2 +- .../common/entities/GT_Entity_Arrow.java | 2 +- .../common/items/GT_SensorCard_Item.java | 2 +- .../items/behaviors/Behaviour_Wrench.java | 2 +- .../basic/GT_MetaTileEntity_Pump.java | 2 +- .../loaders/load/GT_ItemIterator.java | 2 +- 18 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 576ba976..4775792e 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -71,11 +71,11 @@ public class GT_Mod private final String aTextGeneral = "general"; private final String aTextIC2 = "ic2_"; - /*static { + static { if ((509 != GregTech_API.VERSION) || (509 != GT_ModHandler.VERSION) || (509 != GT_OreDictUnificator.VERSION) || (509 != GT_Recipe.VERSION) || (509 != GT_Utility.VERSION) || (509 != GT_RecipeRegistrator.VERSION) || (509 != Element.VERSION) || (509 != Materials.VERSION) || (509 != OrePrefixes.VERSION)) { throw new GT_ItsNotMyFaultException("One of your Mods included GregTech-API Files inside it's download, mention this to the Mod Author, who does this bad thing, and tell him/her to use reflection. I have added a Version check, to prevent Authors from breaking my Mod that way."); } - }*/ + } public GT_Mod() { try { diff --git a/src/main/java/gregtech/api/enums/Dyes.java b/src/main/java/gregtech/api/enums/Dyes.java index 66c39277..c59b310d 100644 --- a/src/main/java/gregtech/api/enums/Dyes.java +++ b/src/main/java/gregtech/api/enums/Dyes.java @@ -64,7 +64,7 @@ public enum Dyes implements IColorModulationContainer { public static Dyes get(String aColor) { Object tObject = GT_Utility.getFieldContent(Dyes.class, aColor, false, false); - if (tObject != null && tObject instanceof Dyes) return (Dyes) tObject; + if (tObject instanceof Dyes) return (Dyes) tObject; return _NULL; } diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index a3ef13b9..f0883196 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -1423,7 +1423,7 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer { public static Materials get(String aMaterialName) { Object tObject = GT_Utility.getFieldContent(Materials.class, aMaterialName, false, false); - if (tObject != null && tObject instanceof Materials) return (Materials) tObject; + if (tObject instanceof Materials) return (Materials) tObject; return _NULL; } diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java index c096a51f..da2f76b3 100644 --- a/src/main/java/gregtech/api/enums/OrePrefixes.java +++ b/src/main/java/gregtech/api/enums/OrePrefixes.java @@ -639,7 +639,7 @@ public enum OrePrefixes { public static OrePrefixes getPrefix(String aPrefixName, OrePrefixes aReplacement) { Object tObject = GT_Utility.getFieldContent(OrePrefixes.class, aPrefixName, false, false); - if (tObject != null && tObject instanceof OrePrefixes) return (OrePrefixes) tObject; + if (tObject instanceof OrePrefixes) return (OrePrefixes) tObject; return aReplacement; } diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java index 510f314d..54f1f484 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java @@ -65,9 +65,9 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { continue; } } - if (tItemPipe != null && tItemPipe instanceof BaseMetaPipeEntity) { + if (tItemPipe instanceof BaseMetaPipeEntity) { IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity(); - if (tMetaTileEntity != null && tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsOut(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) { + if (tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsOut(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) { scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, aMap, aStep, aSuckItems, aIgnoreCapacity); } } @@ -84,7 +84,7 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { } if (tItemPipe instanceof BaseMetaPipeEntity) { IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity(); - if (tMetaTileEntity != null && tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsIn(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) { + if (tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsIn(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) { scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, aMap, aStep, aSuckItems, aIgnoreCapacity); } } diff --git a/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java b/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java index b9b0b746..926bcc60 100644 --- a/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java +++ b/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java @@ -50,7 +50,7 @@ public class GT_Spray_Hardener_Item extends GT_Tool_Item { } ItemStack tStack1 = GT_ModHandler.getIC2Item("constructionFoam", 1), tStack2 = GT_ModHandler.getIC2Item("constructionFoamWall", 1); - if (tStack1 != null && tStack1.isItemEqual(new ItemStack(aBlock)) && tStack2 != null && tStack2.getItem() != null && tStack2.getItem() instanceof ItemBlock) { + if (tStack1 != null && tStack1.isItemEqual(new ItemStack(aBlock)) && tStack2 != null && tStack2.getItem() instanceof ItemBlock) { if (GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(102), 1.0F, -1, aX, aY, aZ); aWorld.setBlock(aX, aY, aZ, GT_Utility.getBlockFromStack(tStack2), 7, 3); diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 1ee4ee50..5902a706 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -398,7 +398,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (getEUCapacity() > 0) { if (GregTech_API.sMachineFireExplosions && getRandomNumber(1000) == 0) { Block tBlock = getBlockAtSide((byte) getRandomNumber(6)); - if (tBlock != null && tBlock instanceof BlockFire) doEnergyExplosion(); + if (tBlock instanceof BlockFire) doEnergyExplosion(); } if (!hasValidMetaTileEntity()) { diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntityUE.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntityUE.java index 26388bd1..fda019f4 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntityUE.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntityUE.java @@ -75,7 +75,7 @@ public class BaseMetaTileEntityUE extends BaseMetaTileEntity /*implements IUETil for (byte i = 0; i < 6; i++) { if (inputEnergyFrom(i)) { Object tTileEntity = getTileEntityAtSide(i); - if (tTileEntity != null && tTileEntity instanceof IConductor) { + if (tTileEntity instanceof IConductor) { rSides.add(ForgeDirection.getOrientation(i)); } } @@ -88,7 +88,7 @@ public class BaseMetaTileEntityUE extends BaseMetaTileEntity /*implements IUETil for (byte i = 0; i < 6; i++) { if (outputsEnergyTo(i)) { Object tTileEntity = getTileEntityAtSide(i); - if (tTileEntity != null && tTileEntity instanceof IConductor) { + if (tTileEntity instanceof IConductor) { rSides.add(ForgeDirection.getOrientation(i)); } } diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java index 0909229d..92944d3e 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java @@ -22,9 +22,9 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { private static void stepToUpdateMachine(World aWorld, int aX, int aY, int aZ, ArrayList aList) { aList.add(new ChunkPosition(aX, aY, aZ)); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity != null && tTileEntity instanceof IMachineBlockUpdateable) + if (tTileEntity instanceof IMachineBlockUpdateable) ((IMachineBlockUpdateable) tTileEntity).onMachineBlockUpdate(); - if (aList.size() < 5 || (tTileEntity != null && tTileEntity instanceof IMachineBlockUpdateable) || GregTech_API.isMachineBlock(aWorld.getBlock(aX, aY, aZ), aWorld.getBlockMetadata(aX, aY, aZ))) { + if (aList.size() < 5 || (tTileEntity instanceof IMachineBlockUpdateable) || GregTech_API.isMachineBlock(aWorld.getBlock(aX, aY, aZ), aWorld.getBlockMetadata(aX, aY, aZ))) { if (!aList.contains(new ChunkPosition(aX + 1, aY, aZ))) stepToUpdateMachine(aWorld, aX + 1, aY, aZ, aList); if (!aList.contains(new ChunkPosition(aX - 1, aY, aZ))) stepToUpdateMachine(aWorld, aX - 1, aY, aZ, aList); if (!aList.contains(new ChunkPosition(aX, aY + 1, aZ))) stepToUpdateMachine(aWorld, aX, aY + 1, aZ, aList); diff --git a/src/main/java/gregtech/api/util/GT_PlayedSound.java b/src/main/java/gregtech/api/util/GT_PlayedSound.java index 858f3b82..136171f7 100644 --- a/src/main/java/gregtech/api/util/GT_PlayedSound.java +++ b/src/main/java/gregtech/api/util/GT_PlayedSound.java @@ -15,7 +15,7 @@ public class GT_PlayedSound { @Override public boolean equals(Object aObject) { - if (aObject != null && aObject instanceof GT_PlayedSound) { + if (aObject instanceof GT_PlayedSound) { return ((GT_PlayedSound) aObject).mX == mX && ((GT_PlayedSound) aObject).mY == mY && ((GT_PlayedSound) aObject).mZ == mZ && ((GT_PlayedSound) aObject).mSoundName.equals(mSoundName); } return false; diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 7d163c45..ee623725 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -328,7 +328,7 @@ public class GT_Utility { } public static void sendChatToPlayer(EntityPlayer aPlayer, String aChatMessage) { - if (aPlayer != null && aPlayer instanceof EntityPlayerMP && aChatMessage != null) { + if (aPlayer instanceof EntityPlayerMP && aChatMessage != null) { aPlayer.addChatComponentMessage(new ChatComponentText(aChatMessage)); } } @@ -509,7 +509,7 @@ public class GT_Utility { * @return the Amount of moved Items */ public static byte moveOneItemStack(Object aTileEntity1, Object aTileEntity2, byte aGrabFrom, byte aPutTo, List aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) { - if (aTileEntity1 != null && aTileEntity1 instanceof IInventory) + if (aTileEntity1 instanceof IInventory) return moveOneItemStack((IInventory) aTileEntity1, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, true); return 0; } @@ -606,7 +606,7 @@ public class GT_Utility { for (int i = 0; i < tGrabSlots.length; i++) tGrabSlots[i] = i; } - if (aTileEntity2 != null && aTileEntity2 instanceof IInventory) { + if (aTileEntity2 instanceof IInventory) { for (int i = 0; i < tGrabSlots.length; i++) { if (listContainsItem(aFilter, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlots[i]), true, aInvertFilter)) { if (isAllowedToTakeFromSlot((IInventory) aTileEntity1, tGrabSlots[i], aGrabFrom, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlots[i]))) { @@ -1019,7 +1019,7 @@ public class GT_Utility { } public static boolean isBlockValid(Object aBlock) { - return aBlock != null && (aBlock instanceof Block); + return (aBlock instanceof Block); } public static boolean isBlockInvalid(Object aBlock) { @@ -1035,7 +1035,7 @@ public class GT_Utility { } public static boolean isStackValid(Object aStack) { - return aStack != null && (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null && ((ItemStack) aStack).stackSize >= 0; + return (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null && ((ItemStack) aStack).stackSize >= 0; } public static boolean isStackInvalid(Object aStack) { @@ -1560,15 +1560,17 @@ public class GT_Utility { } int tAmount = (int) (Math.pow(amount, 5) / 100); ChunkPosition tPos = new ChunkPosition(aX/16, 1, aZ/16); + int[] tInts = new int[2]; if(GT_Proxy.chunkData.containsKey(tPos)){ - int[] tInts = GT_Proxy.chunkData.get(tPos); + tInts = GT_Proxy.chunkData.get(tPos); if(tInts.length>0){ if(tInts[0]>=0){tAmount = tInts[0];} } GT_Proxy.chunkData.remove(tPos); } tAmount = tAmount - 5; - GT_Proxy.chunkData.put(tPos, new int[]{tAmount}); + tInts[0] = tAmount; + GT_Proxy.chunkData.put(tPos, tInts); return new FluidStack(tFluid, tAmount); } @@ -1583,7 +1585,7 @@ public class GT_Utility { Block tBlock = aWorld.getBlock(aX, aY, aZ); - tList.add("----- X: " +EnumChatFormatting.AQUA+ aX+EnumChatFormatting.RESET + " Y: " +EnumChatFormatting.AQUA+ aY +EnumChatFormatting.RESET+ " Z: " +EnumChatFormatting.AQUA+ aZ +EnumChatFormatting.RESET+ " -----"); + tList.add("----- X: " +EnumChatFormatting.AQUA+ aX +EnumChatFormatting.RESET + " Y: " +EnumChatFormatting.AQUA+ aY +EnumChatFormatting.RESET+ " Z: " +EnumChatFormatting.AQUA+ aZ +EnumChatFormatting.RESET+ " -----"); try { if (tTileEntity != null && tTileEntity instanceof IInventory) tList.add("Name: " + EnumChatFormatting.BLUE+ ((IInventory) tTileEntity).getInventoryName()+EnumChatFormatting.RESET + " MetaData: " +EnumChatFormatting.AQUA+ aWorld.getBlockMetadata(aX, aY, aZ)+EnumChatFormatting.RESET); @@ -1689,7 +1691,7 @@ public class GT_Utility { rEUAmount += 400; int tValue = 0; if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress())) - tList.add("Progress: " +EnumChatFormatting.GREEN+GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress()) +EnumChatFormatting.RESET+ " ticks / " +EnumChatFormatting.YELLOW+GT_Utility.formatNumbers(tValue) +EnumChatFormatting.RESET+" ticks"); + tList.add("Progress: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress()/20) +EnumChatFormatting.RESET+ " s / " +EnumChatFormatting.YELLOW+GT_Utility.formatNumbers(tValue/20) +EnumChatFormatting.RESET+" s"); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java index f6f6ac51..d956ccf3 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java @@ -282,8 +282,7 @@ public class GT_Block_Machines public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && - ((tTileEntity instanceof IGregTechTileEntity))) { + if (((tTileEntity instanceof IGregTechTileEntity))) { ((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer); } } @@ -341,7 +340,7 @@ public class GT_Block_Machines public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { + if (((tTileEntity instanceof IGregTechTileEntity))) { return ((IGregTechTileEntity) tTileEntity).getComparatorValue((byte) aSide); } return 0; @@ -352,7 +351,7 @@ public class GT_Block_Machines return 0; } TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { + if (((tTileEntity instanceof IGregTechTileEntity))) { return ((IGregTechTileEntity) tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)); } return 0; @@ -363,7 +362,7 @@ public class GT_Block_Machines return 0; } TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { + if (((tTileEntity instanceof IGregTechTileEntity))) { return ((IGregTechTileEntity) tTileEntity).getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)); } return 0; @@ -429,7 +428,7 @@ public class GT_Block_Machines public float getExplosionResistance(Entity par1Entity, World aWorld, int aX, int aY, int aZ, double explosionX, double explosionY, double explosionZ) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { + if (((tTileEntity instanceof IGregTechTileEntity))) { return ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6); } return 10.0F; diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java index d5dc9a6d..e69404f2 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java @@ -232,7 +232,7 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements public int getDamageValue(World aWorld, int aX, int aY, int aZ) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && ((tTileEntity instanceof GT_TileEntity_Ores))) { + if (((tTileEntity instanceof GT_TileEntity_Ores))) { return ((GT_TileEntity_Ores) tTileEntity).getMetaData(); } return 0; diff --git a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java index 6530ade4..814ab3f8 100644 --- a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java +++ b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java @@ -128,7 +128,7 @@ public class GT_Entity_Arrow if (tHitEntity != null) { tVector = new MovingObjectPosition(tHitEntity); } - if ((tVector != null) && (tVector.entityHit != null) && ((tVector.entityHit instanceof EntityPlayer))) { + if ((tVector != null) && ((tVector.entityHit instanceof EntityPlayer))) { EntityPlayer entityplayer = (EntityPlayer) tVector.entityHit; if ((entityplayer.capabilities.disableDamage) || (((tShootingEntity instanceof EntityPlayer)) && (!((EntityPlayer) tShootingEntity).canAttackPlayer(entityplayer)))) { tVector = null; diff --git a/src/main/java/gregtech/common/items/GT_SensorCard_Item.java b/src/main/java/gregtech/common/items/GT_SensorCard_Item.java index f10881d7..1c9daec4 100644 --- a/src/main/java/gregtech/common/items/GT_SensorCard_Item.java +++ b/src/main/java/gregtech/common/items/GT_SensorCard_Item.java @@ -53,7 +53,7 @@ public class GT_SensorCard_Item ChunkCoordinates target = aCard.getTarget(); TileEntity tTileEntity = world.getTileEntity(target.posX, target.posY, target.posZ); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechDeviceInformation)) && (((IGregTechDeviceInformation) tTileEntity).isGivingInformation())) { + if (((tTileEntity instanceof IGregTechDeviceInformation)) && (((IGregTechDeviceInformation) tTileEntity).isGivingInformation())) { String[] tInfoData = ((IGregTechDeviceInformation) tTileEntity).getInfoData(); for (int i = 0; i < tInfoData.length; i++) { aCard.setString("mString" + i, tInfoData[i]); diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java index d8c42232..f111e9f0 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java @@ -40,7 +40,7 @@ public class Behaviour_Wrench byte aTargetSide = GT_Utility.determineWrenchingSide((byte) aSide, hitX, hitY, hitZ); TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); try { - if ((aTileEntity != null) && ((aTileEntity instanceof IWrenchable))) { + if (((aTileEntity instanceof IWrenchable))) { if (((IWrenchable) aTileEntity).wrenchCanSetFacing(aPlayer, aTargetSide)) { if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { ((IWrenchable) aTileEntity).setFacing((short) aTargetSide); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java index c10efc71..04014b59 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java @@ -115,7 +115,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { this.mPumpCountBelow = 0; IGregTechTileEntity tTileEntity; for (int i = 1; (i < 21) && ((tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance((byte) 0, i)) != null) - && (tTileEntity.getMetaTileEntity() != null) && ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Pump)); i++) { + && ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Pump)); i++) { getBaseMetaTileEntity().setActive(tTileEntity.isActive()); this.mPumpCountBelow += 1; ((GT_MetaTileEntity_Pump) tTileEntity.getMetaTileEntity()).mPumpTimer -= 1; diff --git a/src/main/java/gregtech/loaders/load/GT_ItemIterator.java b/src/main/java/gregtech/loaders/load/GT_ItemIterator.java index 651b8e86..81847f25 100644 --- a/src/main/java/gregtech/loaders/load/GT_ItemIterator.java +++ b/src/main/java/gregtech/loaders/load/GT_ItemIterator.java @@ -57,7 +57,7 @@ public class GT_ItemIterator Iterator tIterator = Item.itemRegistry.iterator(); while (tIterator.hasNext()) { Object tObject; - if (((tObject = tIterator.next()) != null) && ((tObject instanceof Item)) && (!(tObject instanceof GT_Generic_Item))) { + if (((tObject = tIterator.next()) instanceof Item) && (!(tObject instanceof GT_Generic_Item))) { Item tItem = (Item) tObject; String tName; if ((tName = tItem.getUnlocalizedName()) != null) {