diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech')
83 files changed, 465 insertions, 638 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java index 9f82936035..5dc2c4c7da 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java @@ -8,6 +8,7 @@ import static gtPlusPlus.core.util.Utils.getTcAspectStack; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -410,9 +411,9 @@ public enum GregtechOrePrefixes { * at a location where it shouldn't happen. * <p/> * Mainly for preventing NullPointer Exceptions and providing Default Values. - * + * <p> * Unknown Material Components. Dead End Section. - * + * <p> * Alkalus Range 730-799 & 970-998 (aMetaItemSubID, TextureSet, aToolSpeed, aToolDurability, aToolQuality, * aTypes, R, G, B, Alpha, aLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, * aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor @@ -420,7 +421,7 @@ public enum GregtechOrePrefixes { * */ _NULL(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 255, 255, 255, 0, "NULL", 0, 0, 0, 0, false, false, 1, 1, 1, - Dyes._NULL, Element._NULL, Arrays.asList(getTcAspectStack(TCAspects.VACUOS.name(), 1))), + Dyes._NULL, Element._NULL, Collections.singletonList(getTcAspectStack(TCAspects.VACUOS.name(), 1))), // Lapis(526, TextureSet.SET_LAPIS, 1.0F, 0, 1, 1 | 4 | 8, 70, 70, 220, 0, "Lapis", 0, 0, -1, 0, false, false, // 3, 1, 1, Dyes.dyeBlue, 2, Arrays.asList(new MaterialStack(Materials.Lazurite, 12), new @@ -459,7 +460,7 @@ public enum GregtechOrePrefixes { Arrays.asList(getTcAspectStack(TCAspects.ELECTRUM, 8), getTcAspectStack(TCAspects.MACHINA, 8))), Superconductor(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 190, 240, 190, 0, "Superconductor", 0, 0, -1, 0, false, - false, 1, 1, 1, Dyes.dyeGreen, Arrays.asList(getTcAspectStack(TCAspects.ELECTRUM, 8))), + false, 1, 1, 1, Dyes.dyeGreen, Collections.singletonList(getTcAspectStack(TCAspects.ELECTRUM, 8))), Staballoy(30, TextureSet.SET_ROUGH, 10.0F, 5120, 4, 1 | 2 | 16 | 32 | 64 | 128, 68, 75, 66, 0, "Staballoy", 0, 0, 1500, 2800, true, false, 1, 3, 1, Dyes.dyeGreen, 2, @@ -924,11 +925,12 @@ public enum GregtechOrePrefixes { aColor); this.mExtraData = aExtraData; this.mMaterialList.addAll(aMaterialList); - this.mChemicalFormula = ""; + final StringBuilder sb = new StringBuilder(); for (final MaterialStack tMaterial : this.mMaterialList) { - this.mChemicalFormula += tMaterial.toString(); + sb.append(tMaterial.toString()); } - this.mChemicalFormula = this.mChemicalFormula.replaceAll("_", "-"); + this.mChemicalFormula = sb.toString() + .replaceAll("_", "-"); int tAmountOfComponents = 0, tMeltingPoint = 0; for (final MaterialStack tMaterial : this.mMaterialList) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java index 0a116b1b9f..7dd8b429d4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java @@ -5,5 +5,5 @@ public enum GregtechToolDictNames { craftingToolAngleGrinder, craftingToolElectricSnips, craftingToolElectricLighter, - craftingToolElectricButcherKnife; + craftingToolElectricButcherKnife } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java index 1bc2050eee..743f10aae6 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java @@ -35,6 +35,6 @@ public class ElectricSlotWidget extends SlotWidget { return false; } return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) - || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), 4, true, true, true) > 0.0D); + || (ElectricItem.manager.discharge(stack, Double.NaN, 4, true, true, true) > 0.0D); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IGregtechItemContainer.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IGregtechItemContainer.java index ea9ab3602a..f8537b1125 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IGregtechItemContainer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IGregtechItemContainer.java @@ -6,35 +6,35 @@ import net.minecraft.item.ItemStack; public interface IGregtechItemContainer { - public Item getItem(); + Item getItem(); - public Block getBlock(); + Block getBlock(); - public boolean isStackEqual(Object aStack); + boolean isStackEqual(Object aStack); - public boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT); + boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT); - public ItemStack get(long aAmount, Object... aReplacements); + ItemStack get(long aAmount, Object... aReplacements); - public ItemStack getWildcard(long aAmount, Object... aReplacements); + ItemStack getWildcard(long aAmount, Object... aReplacements); - public ItemStack getUndamaged(long aAmount, Object... aReplacements); + ItemStack getUndamaged(long aAmount, Object... aReplacements); - public ItemStack getAlmostBroken(long aAmount, Object... aReplacements); + ItemStack getAlmostBroken(long aAmount, Object... aReplacements); - public ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements); + ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements); - public IGregtechItemContainer set(Item aItem); + IGregtechItemContainer set(Item aItem); - public IGregtechItemContainer set(ItemStack aStack); + IGregtechItemContainer set(ItemStack aStack); - public IGregtechItemContainer registerOre(Object... aOreNames); + IGregtechItemContainer registerOre(Object... aOreNames); - public IGregtechItemContainer registerWildcardAsOre(Object... aOreNames); + IGregtechItemContainer registerWildcardAsOre(Object... aOreNames); - public ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements); + ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements); - public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements); + ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements); - public boolean hasBeenSet(); + boolean hasBeenSet(); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IItemBehaviour.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IItemBehaviour.java index a68efc4fb8..5f7e4527cd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IItemBehaviour.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IItemBehaviour.java @@ -16,31 +16,31 @@ import gtPlusPlus.xmod.gregtech.api.items.GTMetaItemBase; public interface IItemBehaviour<E extends Item> { - public boolean onLeftClickEntity(E aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity); + boolean onLeftClickEntity(E aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity); - public boolean onItemUse(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, - int aSide, float hitX, float hitY, float hitZ); + boolean onItemUse(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, + float hitX, float hitY, float hitZ); - public boolean onItemUseFirst(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, + boolean onItemUseFirst(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); - public ItemStack onItemRightClick(E aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer); + ItemStack onItemRightClick(E aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer); - public List<String> getAdditionalToolTips(E aItem, List<String> aList, ItemStack aStack); + List<String> getAdditionalToolTips(E aItem, List<String> aList, ItemStack aStack); - public void onUpdate(E aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand); + void onUpdate(E aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand); - public boolean isItemStackUsable(E aItem, ItemStack aStack); + boolean isItemStackUsable(E aItem, ItemStack aStack); - public boolean canDispense(E aItem, IBlockSource aSource, ItemStack aStack); + boolean canDispense(E aItem, IBlockSource aSource, ItemStack aStack); - public ItemStack onDispense(E aItem, IBlockSource aSource, ItemStack aStack); + ItemStack onDispense(E aItem, IBlockSource aSource, ItemStack aStack); - public boolean hasProjectile(GTMetaItemBase aItem, SubTag aProjectileType, ItemStack aStack); + boolean hasProjectile(GTMetaItemBase aItem, SubTag aProjectileType, ItemStack aStack); - public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, - double aY, double aZ); + EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, + double aZ); - public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, - EntityLivingBase aEntity, float aSpeed); + EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, + float aSpeed); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IOreRecipeRegistrator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IOreRecipeRegistrator.java index 4c8b1c2391..93b61dc7f0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IOreRecipeRegistrator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IOreRecipeRegistrator.java @@ -16,9 +16,9 @@ public interface IOreRecipeRegistrator { * @param aMaterial always != null, and can be == _NULL if the Prefix is Self Referencing or not Material based! * @param aStack always != null */ - public void registerOre(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, String aOreDictName, String aModName, + void registerOre(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack); - public void registerOre(GregtechOrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, + void registerOre(GregtechOrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack copyAmount); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IToolStats.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IToolStats.java index 98b446869c..1a61814f55 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IToolStats.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IToolStats.java @@ -26,126 +26,126 @@ public interface IToolStats extends gregtech.api.interfaces.IToolStats { * Called when aPlayer crafts this Tool */ @Override - public void onToolCrafted(ItemStack aStack, EntityPlayer aPlayer); + void onToolCrafted(ItemStack aStack, EntityPlayer aPlayer); /** * Called when this gets added to a Tool Item */ - public void onStatsAddedToTool(GTMetaTool gregtech_MetaTool, int aID); + void onStatsAddedToTool(GTMetaTool gregtech_MetaTool, int aID); /** * @return Damage the Tool receives when breaking a Block. 100 is one Damage Point (or 100 EU). */ @Override - public int getToolDamagePerBlockBreak(); + int getToolDamagePerBlockBreak(); /** * @return Damage the Tool receives when converting the drops of a Block. 100 is one Damage Point (or 100 EU). */ @Override - public int getToolDamagePerDropConversion(); + int getToolDamagePerDropConversion(); /** * @return Damage the Tool receives when being used as Container Item. 100 is one use, however it is usually 8 times * more than normal. */ @Override - public int getToolDamagePerContainerCraft(); + int getToolDamagePerContainerCraft(); /** * @return Damage the Tool receives when being used as Weapon, 200 is the normal Value, 100 for actual Weapons. */ @Override - public int getToolDamagePerEntityAttack(); + int getToolDamagePerEntityAttack(); /** * @return Basic Quality of the Tool, 0 is normal. If increased, it will increase the general quality of all Tools * of this Type. Decreasing is also possible. */ @Override - public int getBaseQuality(); + int getBaseQuality(); /** * @return The Damage Bonus for this Type of Tool against Mobs. 1.0F is normal punch. */ @Override - public float getBaseDamage(); + float getBaseDamage(); /** * @return This gets the Hurt Resistance time for Entities getting hit. (always does 1 as minimum) */ @Override - public int getHurtResistanceTime(int aOriginalHurtResistance, Entity aEntity); + int getHurtResistanceTime(int aOriginalHurtResistance, Entity aEntity); /** * @return This is a multiplier for the Tool Speed. 1.0F = no special Speed. */ @Override - public float getSpeedMultiplier(); + float getSpeedMultiplier(); /** * @return This is a multiplier for the Tool Speed. 1.0F = no special Durability. */ @Override - public float getMaxDurabilityMultiplier(); + float getMaxDurabilityMultiplier(); @Override - public DamageSource getDamageSource(EntityLivingBase aPlayer, Entity aEntity); + DamageSource getDamageSource(EntityLivingBase aPlayer, Entity aEntity); @Override - public String getMiningSound(); + String getMiningSound(); @Override - public String getCraftingSound(); + String getCraftingSound(); @Override - public String getEntityHitSound(); + String getEntityHitSound(); @Override - public String getBreakingSound(); + String getBreakingSound(); @Override - public Enchantment[] getEnchantments(ItemStack aStack); + Enchantment[] getEnchantments(ItemStack aStack); @Override - public int[] getEnchantmentLevels(ItemStack aStack); + int[] getEnchantmentLevels(ItemStack aStack); /** * @return If this Tool can be used for blocking Damage like a Sword. */ @Override - public boolean canBlock(); + boolean canBlock(); /** * @return If this Tool can be used as an RC Crowbar. */ @Override - public boolean isCrowbar(); + boolean isCrowbar(); /** * @return If this Tool can be used as an BC Wrench. */ @Override - public boolean isWrench(); + boolean isWrench(); /** * @return If this Tool can be used as Weapon i.e. if that is the main purpose. */ @Override - public boolean isWeapon(); + boolean isWeapon(); /** * @return If this Tool is a Ranged Weapon. Return false at isWeapon unless you have a Blade attached to your * Bow/Gun or something */ @Override - public boolean isRangedWeapon(); + boolean isRangedWeapon(); /** * @return If this Tool can be used as Weapon i.e. if that is the main purpose. */ @Override - public boolean isMiningTool(); + boolean isMiningTool(); /** * aBlock.getHarvestTool(aMetaData) can return the following Values for example. "axe", "pickaxe", "sword", @@ -156,7 +156,7 @@ public interface IToolStats extends gregtech.api.interfaces.IToolStats { * check. */ @Override - public boolean isMinableBlock(Block aBlock, byte aMetaData); + boolean isMinableBlock(Block aBlock, byte aMetaData); /** * This lets you modify the Drop List, when this type of Tool has been used. @@ -164,38 +164,36 @@ public interface IToolStats extends gregtech.api.interfaces.IToolStats { * @return the Amount of modified Items. */ @Override - public int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, - int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent); + int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, + int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent); /** * @return Returns a broken Version of the Item. */ @Override - public ItemStack getBrokenItem(ItemStack aStack); + ItemStack getBrokenItem(ItemStack aStack); /** * @return the Damage actually done to the Mob. */ @Override - public float getNormalDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, - EntityPlayer aPlayer); + float getNormalDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer); /** * @return the Damage actually done to the Mob. */ @Override - public float getMagicDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, - EntityPlayer aPlayer); + float getMagicDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer); @Override - public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack); + IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack); @Override - public short[] getRGBa(boolean aIsToolHead, ItemStack aStack); + short[] getRGBa(boolean aIsToolHead, ItemStack aStack); /** * Called when this gets added to a Tool Item */ @Override - public void onStatsAddedToTool(MetaGeneratedTool aItem, int aID); + void onStatsAddedToTool(MetaGeneratedTool aItem, int aID); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/GTMetaItem.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/GTMetaItem.java index c98023bad7..befca0975f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/GTMetaItem.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/GTMetaItem.java @@ -106,7 +106,6 @@ public abstract class GTMetaItem extends GTMetaItemBase { } if (tRandomData == SubTag.NO_UNIFICATION) { GTOreDictUnificator.addToBlacklist(rStack); - continue; } } } @@ -140,7 +139,6 @@ public abstract class GTMetaItem extends GTMetaItemBase { } if (tUseOreDict) { GTOreDictUnificator.registerOre(tRandomData, rStack); - continue; } } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/GTMetaItemBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/GTMetaItemBase.java index 3e7fcf1486..09c6d4467a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/GTMetaItemBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/GTMetaItemBase.java @@ -64,11 +64,8 @@ public abstract class GTMetaItemBase extends GTGenericItem if ((aMetaValue < 0) || (aMetaValue >= 32766) || (aBehavior == null)) { return this; } - ArrayList<IItemBehaviour<GTMetaItemBase>> tList = this.mItemBehaviors.get((short) aMetaValue); - if (tList == null) { - tList = new ArrayList<>(1); - this.mItemBehaviors.put((short) aMetaValue, tList); - } + ArrayList<IItemBehaviour<GTMetaItemBase>> tList = this.mItemBehaviors + .computeIfAbsent((short) aMetaValue, k -> new ArrayList<>(1)); tList.add(aBehavior); return this; } @@ -278,8 +275,7 @@ public abstract class GTMetaItemBase extends GTGenericItem EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.GRAY); } else { aList.add( - EnumChatFormatting.AQUA + "" - + GTUtility.formatNumbers(tCharge) + EnumChatFormatting.AQUA + GTUtility.formatNumbers(tCharge) + " / " + GTUtility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/GTMetaItemX32.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/GTMetaItemX32.java index 31cdac4770..102a3cc0b7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/GTMetaItemX32.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/GTMetaItemX32.java @@ -101,7 +101,7 @@ public abstract class GTMetaItemX32 extends GTMetaItem { // You have to check for at least these Conditions in every Case! So add a super Call like the following for // this before executing your Code: // if (!super.doesMaterialAllowGeneration(aPrefix, aMaterial)) return false; - return (aPrefix != null) && (aMaterial != null) && aPrefix.doGenerateItem(aMaterial); + return aPrefix != null && aPrefix.doGenerateItem(aMaterial); } /* ---------- OVERRIDEABLE FUNCTIONS ---------- */ diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/METHatchAirIntake.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/METHatchAirIntake.java index e475037c63..6786fabc31 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/METHatchAirIntake.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/METHatchAirIntake.java @@ -101,27 +101,27 @@ public class METHatchAirIntake extends MTEHatchFluidGenerator { aWorld.spawnParticle( name, - (double) (xPos + ran1 * 0.5f), - (double) (yPos + METHatchAirIntake.floatGen.nextFloat() * 0.5f), - (double) (zPos + METHatchAirIntake.floatGen.nextFloat() * 0.5f), - (double) xSpd, - (double) -ySpd, - (double) zSpd); + xPos + ran1 * 0.5f, + yPos + METHatchAirIntake.floatGen.nextFloat() * 0.5f, + zPos + METHatchAirIntake.floatGen.nextFloat() * 0.5f, + xSpd, + -ySpd, + zSpd); aWorld.spawnParticle( name, - (double) (xPos + ran2 * 0.5f), - (double) (yPos + METHatchAirIntake.floatGen.nextFloat() * 0.5f), - (double) (zPos + METHatchAirIntake.floatGen.nextFloat() * 0.5f), - (double) xSpd, - (double) -ySpd, - (double) zSpd); + xPos + ran2 * 0.5f, + yPos + METHatchAirIntake.floatGen.nextFloat() * 0.5f, + zPos + METHatchAirIntake.floatGen.nextFloat() * 0.5f, + xSpd, + -ySpd, + zSpd); aWorld.spawnParticle( name, - (double) (xPos + ran3 * 0.5f), - (double) (yPos + METHatchAirIntake.floatGen.nextFloat() * 0.5f), - (double) (zPos + METHatchAirIntake.floatGen.nextFloat() * 0.5f), - (double) xSpd, - (double) -ySpd, - (double) zSpd); + xPos + ran3 * 0.5f, + yPos + METHatchAirIntake.floatGen.nextFloat() * 0.5f, + zPos + METHatchAirIntake.floatGen.nextFloat() * 0.5f, + xSpd, + -ySpd, + zSpd); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchElementalDataOrbHolder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchElementalDataOrbHolder.java index 0043819b23..68396fee78 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchElementalDataOrbHolder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchElementalDataOrbHolder.java @@ -125,22 +125,16 @@ public class MTEHatchElementalDataOrbHolder extends MTEHatch implements IConfigu public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { Logger.INFO("Checking if we can pull " + aStack.getDisplayName() + " from slot " + aIndex); - if (aIndex == mInventory.length - 1 && ItemUtils.isControlCircuit(aStack) - && side == getBaseMetaTileEntity().getFrontFacing()) { - return true; - } - return false; + return aIndex == mInventory.length - 1 && ItemUtils.isControlCircuit(aStack) + && side == getBaseMetaTileEntity().getFrontFacing(); } @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { Logger.INFO("Checking if we can put " + aStack.getDisplayName() + " into slot " + aIndex); - if (aIndex == mInventory.length - 1 && ItemUtils.isControlCircuit(aStack) - && side == getBaseMetaTileEntity().getFrontFacing()) { - return true; - } - return false; + return aIndex == mInventory.length - 1 && ItemUtils.isControlCircuit(aStack) + && side == getBaseMetaTileEntity().getFrontFacing(); } public ArrayList<ItemStack> getInventory() { @@ -154,7 +148,7 @@ public class MTEHatchElementalDataOrbHolder extends MTEHatch implements IConfigu public ItemStack getOrbByCircuit() { ItemStack aCirc = getBaseMetaTileEntity().getStackInSlot(getCircuitSlot()); - if (aCirc != null && ItemUtils.isControlCircuit(aCirc)) { + if (ItemUtils.isControlCircuit(aCirc)) { int slot = aCirc.getItemDamage() - 1; // slots are 0 indexed but there's no 0 circuit if (slot < getBaseMetaTileEntity().getSizeInventory() - 1) { return getBaseMetaTileEntity().getStackInSlot(slot); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchFluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchFluidGenerator.java index 3a5640cd88..9eafd09a10 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchFluidGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchFluidGenerator.java @@ -9,7 +9,6 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -58,14 +57,12 @@ public abstract class MTEHatchFluidGenerator extends MTEHatchInput { @Override public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, - new GTRenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER) }; + return new ITexture[] { aBaseTexture, new GTRenderedTexture(Textures.BlockIcons.OVERLAY_MUFFLER) }; } @Override public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, - new GTRenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER) }; + return new ITexture[] { aBaseTexture, new GTRenderedTexture(Textures.BlockIcons.OVERLAY_MUFFLER) }; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchMufflerAdvanced.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchMufflerAdvanced.java index 2cf1ed3efe..dd38f1ab26 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchMufflerAdvanced.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchMufflerAdvanced.java @@ -299,8 +299,8 @@ public class MTEHatchMufflerAdvanced extends MTEHatchMuffler implements IAddGreg float zSpd; if (aDir.offsetY == -1) { float temp = GTPPCore.RANDOM.nextFloat() * 2.0F * GTPPCore.PI; - xSpd = (float) Math.sin((double) temp) * 0.1F; - zSpd = (float) Math.cos((double) temp) * 0.1F; + xSpd = (float) Math.sin(temp) * 0.1F; + zSpd = (float) Math.cos(temp) * 0.1F; } else { xSpd = (float) aDir.offsetX * (0.1F + 0.2F * GTPPCore.RANDOM.nextFloat()); zSpd = (float) aDir.offsetZ * (0.1F + 0.2F * GTPPCore.RANDOM.nextFloat()); @@ -309,34 +309,34 @@ public class MTEHatchMufflerAdvanced extends MTEHatchMuffler implements IAddGreg if (chk1) { aWorld.spawnParticle( name, - (double) (xPos + ran1 * 0.5F), - (double) (yPos + GTPPCore.RANDOM.nextFloat() * 0.5F), - (double) (zPos + GTPPCore.RANDOM.nextFloat() * 0.5F), - (double) xSpd, - (double) ySpd, - (double) zSpd); + xPos + ran1 * 0.5F, + yPos + GTPPCore.RANDOM.nextFloat() * 0.5F, + zPos + GTPPCore.RANDOM.nextFloat() * 0.5F, + xSpd, + ySpd, + zSpd); } if (chk2) { aWorld.spawnParticle( name, - (double) (xPos + ran2 * 0.5F), - (double) (yPos + GTPPCore.RANDOM.nextFloat() * 0.5F), - (double) (zPos + GTPPCore.RANDOM.nextFloat() * 0.5F), - (double) xSpd, - (double) ySpd, - (double) zSpd); + xPos + ran2 * 0.5F, + yPos + GTPPCore.RANDOM.nextFloat() * 0.5F, + zPos + GTPPCore.RANDOM.nextFloat() * 0.5F, + xSpd, + ySpd, + zSpd); } if (chk3) { aWorld.spawnParticle( name, - (double) (xPos + ran3 * 0.5F), - (double) (yPos + GTPPCore.RANDOM.nextFloat() * 0.5F), - (double) (zPos + GTPPCore.RANDOM.nextFloat() * 0.5F), - (double) xSpd, - (double) ySpd, - (double) zSpd); + xPos + ran3 * 0.5F, + yPos + GTPPCore.RANDOM.nextFloat() * 0.5F, + zPos + GTPPCore.RANDOM.nextFloat() * 0.5F, + xSpd, + ySpd, + zSpd); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchSuperBusInput.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchSuperBusInput.java index e95cea2762..a87d992139 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchSuperBusInput.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchSuperBusInput.java @@ -38,7 +38,7 @@ public class MTEHatchSuperBusInput extends MTEHatchInputBus { @Override public String[] getDescription() { - return new String[] { "Item Input for Multiblocks", "" + getSlots(this.mTier) + " Slots", + return new String[] { "Item Input for Multiblocks", getSlots(this.mTier) + " Slots", GTPPCore.GT_Tooltip.get() }; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchTurbine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchTurbine.java index 09c3dd6efb..ee40ffdbe8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchTurbine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchTurbine.java @@ -106,8 +106,7 @@ public class MTEHatchTurbine extends MTEHatch { public boolean hasTurbine() { ItemStack aStack = this.mInventory[0]; - boolean aIsValid = MTELargerTurbineBase.isValidTurbine(aStack); - return aIsValid; + return MTELargerTurbineBase.isValidTurbine(aStack); } public ItemStack getTurbine() { @@ -194,15 +193,10 @@ public class MTEHatchTurbine extends MTEHatch { super.onPostTick(aBaseMetaTileEntity, aTick); if (this.mHasController) { if (aTick % 20 == 0) { - if (isControllerActive()) { - this.getBaseMetaTileEntity() - .setActive(true); - } else { - this.getBaseMetaTileEntity() - .setActive(false); - } + this.getBaseMetaTileEntity() + .setActive(isControllerActive()); } - } else if (!this.mHasController && this.mControllerLocation != null) { + } else if (this.mControllerLocation != null) { // Weird Invalid State if (setController(BlockPos.generateBlockPos(mControllerLocation))) { // Valid @@ -224,7 +218,7 @@ public class MTEHatchTurbine extends MTEHatch { } public MTELargerTurbineBase getController() { - if (this.mHasController && this.mControllerLocation != null && this.mControllerLocation.length() > 0) { + if (this.mHasController && this.mControllerLocation != null && !this.mControllerLocation.isEmpty()) { BlockPos p = BlockPos.generateBlockPos(mControllerLocation); if (p != null) { // Logger.INFO(p.getLocationString()); @@ -246,10 +240,7 @@ public class MTEHatchTurbine extends MTEHatch { } public boolean canSetNewController() { - if ((mControllerLocation != null && mControllerLocation.length() > 0) || this.mHasController) { - return false; - } - return true; + return (mControllerLocation == null || mControllerLocation.isEmpty()) && !this.mHasController; } public boolean setController(BlockPos aPos) { @@ -395,7 +386,7 @@ public class MTEHatchTurbine extends MTEHatch { aHasTurbine ? "Cannot remove turbine, no free inventory space." : "No turbine to remove."); } } else if (GTUtility.isStackInList(tCurrentItem, GregTechAPI.sSolderingToolList)) { - if (mControllerLocation != null && mControllerLocation.length() > 0) { + if (mControllerLocation != null && !mControllerLocation.isEmpty()) { if (setController(BlockPos.generateBlockPos(mControllerLocation))) { if (PlayerUtils.isCreative(aPlayer) || GTModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchTurbineProvider.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchTurbineProvider.java index 6a501a2531..5d0bc5c554 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchTurbineProvider.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchTurbineProvider.java @@ -110,18 +110,14 @@ public class MTEHatchTurbineProvider extends MTEHatchInputBus { public boolean isItemStackTurbine(ItemStack aStack) { if (aStack.getItem() instanceof MetaGeneratedTool) { - if (aStack.getItemDamage() >= 170 && aStack.getItemDamage() <= 176) { - return true; - } + return aStack.getItemDamage() >= 170 && aStack.getItemDamage() <= 176; } return false; } public boolean isItemStackScrewdriver(ItemStack aStack) { if (aStack.getItem() instanceof MetaGeneratedTool) { - if (aStack.getItemDamage() == 22 || aStack.getItemDamage() == 150) { - return true; - } + return aStack.getItemDamage() == 22 || aStack.getItemDamage() == 150; } return false; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTESuperBusOutput.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTESuperBusOutput.java index 686589b38a..0ea35495fa 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTESuperBusOutput.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTESuperBusOutput.java @@ -1,7 +1,5 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; -import net.minecraft.inventory.IInventory; - import com.gtnewhorizons.modularui.api.screen.ModularWindow.Builder; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.common.widget.Scrollable; @@ -68,8 +66,8 @@ public class MTESuperBusOutput extends MTEHatchOutputBus { if (this.mInventory[j] != null && (this.mInventory[i] == null || GTUtility.areStacksEqual(this.mInventory[i], this.mInventory[j]))) { GTUtility.moveStackFromSlotAToSlotB( - (IInventory) this.getBaseMetaTileEntity(), - (IInventory) this.getBaseMetaTileEntity(), + this.getBaseMetaTileEntity(), + this.getBaseMetaTileEntity(), j, i, (byte) 64, @@ -83,10 +81,9 @@ public class MTESuperBusOutput extends MTEHatchOutputBus { @Override public String[] getDescription() { - String[] aDesc = new String[] { "Item Output for Multiblocks", "" + getSlots(this.mTier) + " Slots", + return new String[] { "Item Output for Multiblocks", getSlots(this.mTier) + " Slots", "Left click with data stick to save filter config", "Right click with data stick to load filter config", GTPPCore.GT_Tooltip.get() }; - return aDesc; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java index b969227977..df55649bb5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java @@ -139,7 +139,7 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas public String[] getInfoData() { ArrayList<String> mInfo = new ArrayList<>(); if (!this.getMetaName() - .equals("")) { + .isEmpty()) { mInfo.add(this.getMetaName()); } @@ -148,11 +148,7 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas if (extra == null) { extra = new String[0]; } - if (extra.length > 0) { - for (String s : extra) { - mInfo.add(s); - } - } + mInfo.addAll(Arrays.asList(extra)); long seconds = (this.mTotalRunTime / 20); int weeks = (int) (TimeUnit.SECONDS.toDays(seconds) / 7); @@ -183,20 +179,18 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy") + ":"); mInfo.add( StatCollector.translateToLocal( - "" + EnumChatFormatting.GREEN - + Long.toString(storedEnergy) + EnumChatFormatting.GREEN.toString() + storedEnergy + EnumChatFormatting.RESET + " EU / " + EnumChatFormatting.YELLOW - + Long.toString(maxEnergy) + + maxEnergy + EnumChatFormatting.RESET + " EU")); mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei") + ":"); mInfo.add( StatCollector.translateToLocal( - "" + EnumChatFormatting.YELLOW - + Long.toString(getMaxInputVoltage()) + EnumChatFormatting.YELLOW.toString() + getMaxInputVoltage() + EnumChatFormatting.RESET + " EU/t(*2A) " + StatCollector.translateToLocal("GTPP.machines.tier") @@ -211,12 +205,11 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy") + " In Dynamos:"); mInfo.add( StatCollector.translateToLocal( - "" + EnumChatFormatting.GREEN - + Long.toString(storedEnergy) + EnumChatFormatting.GREEN.toString() + storedEnergy + EnumChatFormatting.RESET + " EU / " + EnumChatFormatting.YELLOW - + Long.toString(maxEnergy) + + maxEnergy + EnumChatFormatting.RESET + " EU")); } @@ -242,7 +235,7 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas + StatCollector.translateToLocal("GTPP.multiblock.efficiency") + ": " + EnumChatFormatting.YELLOW - + Float.toString(mEfficiency / 100.0F) + + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %"); @@ -270,11 +263,11 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas mInfo.add( "Total Time Since Built: " + EnumChatFormatting.DARK_GREEN - + Integer.toString(weeks) + + weeks + EnumChatFormatting.RESET + " Weeks, " + EnumChatFormatting.DARK_GREEN - + Integer.toString(days) + + days + EnumChatFormatting.RESET + " Days, "); mInfo.add( @@ -282,17 +275,16 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas + EnumChatFormatting.RESET + " Hours, " + EnumChatFormatting.DARK_GREEN - + Long.toString(minutes) + + minutes + EnumChatFormatting.RESET + " Minutes, " + EnumChatFormatting.DARK_GREEN - + Long.toString(second) + + second + EnumChatFormatting.RESET + " Seconds."); - mInfo.add("Total Time in ticks: " + EnumChatFormatting.DARK_GREEN + Long.toString(this.mTotalRunTime)); + mInfo.add("Total Time in ticks: " + EnumChatFormatting.DARK_GREEN + this.mTotalRunTime); - String[] mInfo2 = mInfo.toArray(new String[mInfo.size()]); - return mInfo2; + return mInfo.toArray(new String[0]); } public int getPollutionReductionForAllMufflers() { @@ -409,10 +401,8 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas } public boolean isMachineRunning() { - boolean aRunning = this.getBaseMetaTileEntity() + return this.getBaseMetaTileEntity() .isActive(); - // log("Queried Multiblock is currently running: "+aRunning); - return aRunning; } @Override @@ -423,19 +413,16 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas .doExplosion(GTValues.V[8])) { tTileEntity = localIterator.next(); } - tTileEntity = null; for (final Iterator<MTEHatchOutputBattery> localIterator = this.mDischargeHatches.iterator(); localIterator .hasNext(); tTileEntity.getBaseMetaTileEntity() .doExplosion(GTValues.V[8])) { tTileEntity = localIterator.next(); } - tTileEntity = null; for (final Iterator<MTEHatch> localIterator = this.mTecTechDynamoHatches.iterator(); localIterator .hasNext(); tTileEntity.getBaseMetaTileEntity() .doExplosion(GTValues.V[8])) { tTileEntity = localIterator.next(); } - tTileEntity = null; for (final Iterator<MTEHatch> localIterator = this.mTecTechEnergyHatches.iterator(); localIterator .hasNext(); tTileEntity.getBaseMetaTileEntity() .doExplosion(GTValues.V[8])) { @@ -465,7 +452,7 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas } public ItemStack findItemInInventory(ItemStack aSearchStack) { - if (aSearchStack != null && this.mInputBusses.size() > 0) { + if (aSearchStack != null && !this.mInputBusses.isEmpty()) { for (MTEHatchInputBus bus : this.mInputBusses) { if (bus != null) { for (ItemStack uStack : bus.mInventory) { @@ -513,8 +500,7 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas } public boolean checkHatch() { - return mMaintenanceHatches.size() <= 1 - && (this.getPollutionPerSecond(null) > 0 ? !mMufflerHatches.isEmpty() : true); + return mMaintenanceHatches.size() <= 1 && (this.getPollutionPerSecond(null) <= 0 || !mMufflerHatches.isEmpty()); } @Override @@ -610,8 +596,7 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas if (aTileEntity == null) { return null; } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - return aMetaTileEntity; + return aTileEntity.getMetaTileEntity(); } @Override @@ -782,28 +767,27 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas if (aTileEntity == null) { return false; } - final IMetaTileEntity aMetaTileEntity = aTileEntity; - if (aMetaTileEntity instanceof MTEHatchInput || aMetaTileEntity instanceof MTEHatchInputBus - || aMetaTileEntity instanceof MteHatchSteamBusInput) { - if (aMetaTileEntity instanceof MTEHatchInput) { - ((MTEHatchInput) aMetaTileEntity).mRecipeMap = null; - ((MTEHatchInput) aMetaTileEntity).mRecipeMap = aMap; + if (aTileEntity instanceof MTEHatchInput || aTileEntity instanceof MTEHatchInputBus + || aTileEntity instanceof MteHatchSteamBusInput) { + if (aTileEntity instanceof MTEHatchInput) { + ((MTEHatchInput) aTileEntity).mRecipeMap = null; + ((MTEHatchInput) aTileEntity).mRecipeMap = aMap; if (aMap != null) { log("Remapped Input Hatch to " + aMap.unlocalizedName + "."); } else { log("Cleared Input Hatch."); } - } else if (aMetaTileEntity instanceof MTEHatchInputBus) { - ((MTEHatchInputBus) aMetaTileEntity).mRecipeMap = null; - ((MTEHatchInputBus) aMetaTileEntity).mRecipeMap = aMap; + } else if (aTileEntity instanceof MTEHatchInputBus) { + ((MTEHatchInputBus) aTileEntity).mRecipeMap = null; + ((MTEHatchInputBus) aTileEntity).mRecipeMap = aMap; if (aMap != null) { log("Remapped Input Bus to " + aMap.unlocalizedName + "."); } else { log("Cleared Input Bus."); } } else { - ((MteHatchSteamBusInput) aMetaTileEntity).mRecipeMap = null; - ((MteHatchSteamBusInput) aMetaTileEntity).mRecipeMap = aMap; + ((MteHatchSteamBusInput) aTileEntity).mRecipeMap = null; + ((MteHatchSteamBusInput) aTileEntity).mRecipeMap = aMap; if (aMap != null) { log("Remapped Input Bus to " + aMap.unlocalizedName + "."); } else { @@ -997,8 +981,7 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas } } // Do Super - boolean aSuper = super.onRightclick(aBaseMetaTileEntity, aPlayer, side, aX, aY, aZ); - return aSuper; + return super.onRightclick(aBaseMetaTileEntity, aPlayer, side, aX, aY, aZ); } public boolean onPlungerRightClick(EntityPlayer aPlayer, ForgeDirection side, float aX, float aY, float aZ) { @@ -1371,8 +1354,7 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas () -> StatCollector.translateToLocal("GTPP.multiblock.specialvalue") + ": " + EnumChatFormatting.RED + getLastRecipeEU() - + EnumChatFormatting.RESET - + "") + + EnumChatFormatting.RESET) .setDefaultColor(COLOR_TEXT_WHITE.get()) .setEnabled( widget -> mMachine && getLastRecipeEU() != 0 diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/MTEBoilerBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/MTEBoilerBase.java index 6387624a1c..ed6432a58f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/MTEBoilerBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/MTEBoilerBase.java @@ -225,7 +225,7 @@ public abstract class MTEBoilerBase extends MTEBasicTank { } if ((aTick % 10L) == 0L) { if (this.mTemperature > 100) { - if ((this.mFluid == null) || (!GTModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) { + if ((!GTModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) { this.mHadNoWater = true; } else { if (this.mHadNoWater) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/MTERocketFuelGeneratorBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/MTERocketFuelGeneratorBase.java index ae5e653de0..40678f203f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/MTERocketFuelGeneratorBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/MTERocketFuelGeneratorBase.java @@ -232,7 +232,7 @@ public abstract class MTERocketFuelGeneratorBase extends MTEBasicTank implements if ((tFluidAmountToUse > 0) && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) { int aSafeFloor = (int) Math.max(((tFluidAmountToUse * tConsumed) / 3), 1); - this.mFluid.amount -= (int) aSafeFloor; + this.mFluid.amount -= aSafeFloor; PollutionUtils.addPollution(getBaseMetaTileEntity(), 10 * getPollution()); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/MTEHatchNbtConsumable.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/MTEHatchNbtConsumable.java index b626bcc8ba..8cf42533c7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/MTEHatchNbtConsumable.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/MTEHatchNbtConsumable.java @@ -211,7 +211,7 @@ public abstract class MTEHatchNbtConsumable extends MTEHatch implements IAddGreg // Then Move stack to Usage slots for (int i = getSlotID_FirstUsage(); i <= getSlotID_LastUsage(); i++) { if (mInventory[i] == null) { - if ((aFoundMatching && aAllowMultiOfSameTypeInUsageSlots) || !aFoundMatching) { + if (!aFoundMatching || aAllowMultiOfSameTypeInUsageSlots) { mInventory[i] = aStackToMove; aDidSet = true; Logger.INFO("Moving new stack to usage slots."); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java index 2cafd18a39..ea5e46a534 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java @@ -51,9 +51,7 @@ public class GregtechItemData { } } this.mByProducts = j > 0 ? new GregtechMaterialStack[j] : EMPTY_GT_MaterialStack_ARRAY; - for (int i = 0; i < this.mByProducts.length; i++) { - this.mByProducts[i] = tByProducts[i]; - } + System.arraycopy(tByProducts, 0, this.mByProducts, 0, this.mByProducts.length); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java index 32f1f127d0..087e4fb056 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java @@ -15,7 +15,7 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; public class GregtechMetaCasingBlocksPipeGearbox extends GregtechMetaCasingBlocksAbstract { - private static HashMap<Integer, Integer> sMaterialMapping = new HashMap<>(); + private static final HashMap<Integer, Integer> sMaterialMapping = new HashMap<>(); public GregtechMetaCasingBlocksPipeGearbox() { super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.pipesgears", MaterialCasings.INSTANCE); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java index 128e9c95d7..8208147236 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java @@ -13,43 +13,43 @@ import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.MT public class TexturesGrinderMultiblock { - private static CustomIcon GT8_1_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE1"); - private static CustomIcon GT8_1 = new CustomIcon("iconsets/Grinder/GRINDER1"); - private static CustomIcon GT8_2_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE2"); - private static CustomIcon GT8_2 = new CustomIcon("iconsets/Grinder/GRINDER2"); - private static CustomIcon GT8_3_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE3"); - private static CustomIcon GT8_3 = new CustomIcon("iconsets/Grinder/GRINDER3"); - private static CustomIcon GT8_4_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE4"); - private static CustomIcon GT8_4 = new CustomIcon("iconsets/Grinder/GRINDER4"); - private static CustomIcon GT8_5_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5"); - private static CustomIcon GT8_5 = new CustomIcon("iconsets/Grinder/GRINDER5"); - private static CustomIcon GT8_6_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE6"); - private static CustomIcon GT8_6 = new CustomIcon("iconsets/Grinder/GRINDER6"); - private static CustomIcon GT8_7_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE7"); - private static CustomIcon GT8_7 = new CustomIcon("iconsets/Grinder/GRINDER7"); - private static CustomIcon GT8_8_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE8"); - private static CustomIcon GT8_8 = new CustomIcon("iconsets/Grinder/GRINDER8"); - private static CustomIcon GT8_9_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE9"); - private static CustomIcon GT8_9 = new CustomIcon("iconsets/Grinder/GRINDER9"); + private static final CustomIcon GT8_1_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE1"); + private static final CustomIcon GT8_1 = new CustomIcon("iconsets/Grinder/GRINDER1"); + private static final CustomIcon GT8_2_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE2"); + private static final CustomIcon GT8_2 = new CustomIcon("iconsets/Grinder/GRINDER2"); + private static final CustomIcon GT8_3_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE3"); + private static final CustomIcon GT8_3 = new CustomIcon("iconsets/Grinder/GRINDER3"); + private static final CustomIcon GT8_4_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE4"); + private static final CustomIcon GT8_4 = new CustomIcon("iconsets/Grinder/GRINDER4"); + private static final CustomIcon GT8_5_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5"); + private static final CustomIcon GT8_5 = new CustomIcon("iconsets/Grinder/GRINDER5"); + private static final CustomIcon GT8_6_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE6"); + private static final CustomIcon GT8_6 = new CustomIcon("iconsets/Grinder/GRINDER6"); + private static final CustomIcon GT8_7_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE7"); + private static final CustomIcon GT8_7 = new CustomIcon("iconsets/Grinder/GRINDER7"); + private static final CustomIcon GT8_8_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE8"); + private static final CustomIcon GT8_8 = new CustomIcon("iconsets/Grinder/GRINDER8"); + private static final CustomIcon GT8_9_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE9"); + private static final CustomIcon GT8_9 = new CustomIcon("iconsets/Grinder/GRINDER9"); - private static CustomIcon frontFace_0 = (GT8_1); - private static CustomIcon frontFaceActive_0 = (GT8_1_Active); - private static CustomIcon frontFace_1 = (GT8_2); - private static CustomIcon frontFaceActive_1 = (GT8_2_Active); - private static CustomIcon frontFace_2 = (GT8_3); - private static CustomIcon frontFaceActive_2 = (GT8_3_Active); - private static CustomIcon frontFace_3 = (GT8_4); - private static CustomIcon frontFaceActive_3 = (GT8_4_Active); - private static CustomIcon frontFace_4 = (GT8_5); - private static CustomIcon frontFaceActive_4 = (GT8_5_Active); - private static CustomIcon frontFace_5 = (GT8_6); - private static CustomIcon frontFaceActive_5 = (GT8_6_Active); - private static CustomIcon frontFace_6 = (GT8_7); - private static CustomIcon frontFaceActive_6 = (GT8_7_Active); - private static CustomIcon frontFace_7 = (GT8_8); - private static CustomIcon frontFaceActive_7 = (GT8_8_Active); - private static CustomIcon frontFace_8 = (GT8_9); - private static CustomIcon frontFaceActive_8 = (GT8_9_Active); + private static final CustomIcon frontFace_0 = (GT8_1); + private static final CustomIcon frontFaceActive_0 = (GT8_1_Active); + private static final CustomIcon frontFace_1 = (GT8_2); + private static final CustomIcon frontFaceActive_1 = (GT8_2_Active); + private static final CustomIcon frontFace_2 = (GT8_3); + private static final CustomIcon frontFaceActive_2 = (GT8_3_Active); + private static final CustomIcon frontFace_3 = (GT8_4); + private static final CustomIcon frontFaceActive_3 = (GT8_4_Active); + private static final CustomIcon frontFace_4 = (GT8_5); + private static final CustomIcon frontFaceActive_4 = (GT8_5_Active); + private static final CustomIcon frontFace_5 = (GT8_6); + private static final CustomIcon frontFaceActive_5 = (GT8_6_Active); + private static final CustomIcon frontFace_6 = (GT8_7); + private static final CustomIcon frontFaceActive_6 = (GT8_7_Active); + private static final CustomIcon frontFace_7 = (GT8_8); + private static final CustomIcon frontFaceActive_7 = (GT8_8_Active); + private static final CustomIcon frontFace_8 = (GT8_9); + private static final CustomIcon frontFaceActive_8 = (GT8_9_Active); CustomIcon[] GRINDER = new CustomIcon[] { frontFace_0, frontFace_1, frontFace_2, frontFace_3, frontFace_4, frontFace_5, frontFace_6, frontFace_7, frontFace_8 }; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java index dea287fde6..e0acc6666d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java @@ -383,16 +383,12 @@ public class LargeTurbineTextureHandler { public static boolean isUsingAnimatedTexture(TileEntity tTileEntity) { boolean aVal = true; - IGregTechTileEntity aTile; - if (tTileEntity instanceof IGregTechTileEntity) { - aTile = (IGregTechTileEntity) tTileEntity; - if (aTile != null) { - final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity(); - if (aMetaTileEntity != null && aMetaTileEntity instanceof MTEHatchTurbine) { - aVal = ((MTEHatchTurbine) aMetaTileEntity).getBaseMetaTileEntity() - .isActive(); - // Logger.INFO("Returning "+aVal+" as Rotor Assembly controller status"); - } + if (tTileEntity instanceof IGregTechTileEntity aTile) { + final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity(); + if (aMetaTileEntity instanceof MTEHatchTurbine) { + aVal = aMetaTileEntity.getBaseMetaTileEntity() + .isActive(); + // Logger.INFO("Returning "+aVal+" as Rotor Assembly controller status"); } } return aVal; @@ -401,7 +397,7 @@ public class LargeTurbineTextureHandler { public static MTEHatchTurbine isTurbineHatch(final IGregTechTileEntity aTileEntity) { if (aTileEntity != null) { final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity != null && aMetaTileEntity instanceof MTEHatchTurbine) { + if (aMetaTileEntity instanceof MTEHatchTurbine) { return (MTEHatchTurbine) aMetaTileEntity; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverToggleVisual.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverToggleVisual.java index 2ba532d11f..891035f7ac 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverToggleVisual.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverToggleVisual.java @@ -31,8 +31,7 @@ public class CoverToggleVisual extends CoverBehavior { BlockPos aPos = new BlockPos( aEntity.getIGregTechTileEntity(aEntity.getXCoord(), aEntity.getYCoord(), aEntity.getZCoord())); - String s = aEntity.getInventoryName() + "." + aPos.getUniqueIdentifier() + side.name(); - return s; + return aEntity.getInventoryName() + "." + aPos.getUniqueIdentifier() + side.name(); } catch (Throwable t) {} XSTR x = new XSTR(); return "ERROR." + x.getSeed() + x.hashCode() + x.nextDouble() + ".ID"; @@ -168,10 +167,10 @@ public class CoverToggleVisual extends CoverBehavior { public static boolean getConnectionState(String aKey) { Integer b = sConnectionStateForEntityMap.get(aKey); // Logger.INFO("Get State: "+b+" | "+aKey); - return b != null ? b == VALUE_ON : false; + return b != null && b == VALUE_ON; } - public static final boolean getCoverConnections(final ItemStack aStack) { + public static boolean getCoverConnections(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java index 773bf0127e..4ef2838542 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java @@ -46,7 +46,7 @@ public class FlotationRecipeHandler { } public static ItemStack findMilledStack(ItemStack[] aInputs) { - if (aInputs == null || aInputs.length <= 0) { + if (aInputs == null) { return null; } for (ItemStack aStack : aInputs) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java index 03a4ace32f..35de0d8cea 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java @@ -25,7 +25,7 @@ public class TesseractHelper { */ // Checks if a Generator is owned by a player. - public static final boolean isGeneratorOwnedByPlayer(EntityPlayer player, MTETesseractGenerator generator) { + public static boolean isGeneratorOwnedByPlayer(EntityPlayer player, MTETesseractGenerator generator) { if (player == null) { Logger.WARNING("Failed. [isGeneratorOwnedByPlayer]"); return false; @@ -50,7 +50,7 @@ public class TesseractHelper { } // Saves A Generator to the Players UUID map along with the Freq. - public static final boolean setGeneratorOwnershipByPlayer(EntityPlayer player, int freq, + public static boolean setGeneratorOwnershipByPlayer(EntityPlayer player, int freq, MTETesseractGenerator generator) { if (player == null) { return false; @@ -82,7 +82,7 @@ public class TesseractHelper { } // Gets Generator based on Frequency. - public static final MTETesseractGenerator getGeneratorByFrequency(EntityPlayer player, int freq) { + public static MTETesseractGenerator getGeneratorByFrequency(EntityPlayer player, int freq) { if (player == null) { return null; } @@ -107,7 +107,7 @@ public class TesseractHelper { } // Remove Tesseract Generator - public static final boolean removeGenerator(EntityPlayer player, int frequency) { + public static boolean removeGenerator(EntityPlayer player, int frequency) { if (player == null) { return false; } @@ -129,7 +129,7 @@ public class TesseractHelper { */ // Checks if a Terminal is owned by a player. - public static final boolean isTerminalOwnedByPlayer(EntityPlayer player, MTETesseractTerminal generator) { + public static boolean isTerminalOwnedByPlayer(EntityPlayer player, MTETesseractTerminal generator) { if (player == null) { return false; } @@ -148,8 +148,7 @@ public class TesseractHelper { } // Saves A Terminal to the Players UUID map along with the Freq. - public static final boolean setTerminalOwnershipByPlayer(EntityPlayer player, int freq, - MTETesseractTerminal generator) { + public static boolean setTerminalOwnershipByPlayer(EntityPlayer player, int freq, MTETesseractTerminal generator) { if (player == null) { return false; } @@ -178,7 +177,7 @@ public class TesseractHelper { } // Gets Terminal based on Frequency. - public static final MTETesseractTerminal getTerminalByFrequency(EntityPlayer player, int freq) { + public static MTETesseractTerminal getTerminalByFrequency(EntityPlayer player, int freq) { if (player == null) { return null; } @@ -200,7 +199,7 @@ public class TesseractHelper { } // Remove Tesseract Terminal - public static final boolean removeTerminal(EntityPlayer player, int frequency) { + public static boolean removeTerminal(EntityPlayer player, int frequency) { if (player == null) { return false; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java index a6cd63ca19..76b0ca91ea 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java @@ -18,7 +18,6 @@ import org.apache.commons.lang3.StringUtils; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTechAPI; import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; import gregtech.api.objects.GTMultiTexture; import gregtech.api.objects.GTRenderedTexture; import gtPlusPlus.api.objects.Logger; @@ -74,7 +73,7 @@ public class MetaCustomCoverItem extends Item { } GregTechAPI.registerCover( thisStack, - new GTMultiTexture(new ITexture[] { new GTRenderedTexture(mTextures[i]) }), + new GTMultiTexture(new GTRenderedTexture(mTextures[i])), new CoverToggleVisual()); } } @@ -112,7 +111,7 @@ public class MetaCustomCoverItem extends Item { return true; } - public static final long getCoverDamage(final ItemStack aStack) { + public static long getCoverDamage(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); @@ -125,7 +124,7 @@ public class MetaCustomCoverItem extends Item { return 0L; } - public static final boolean setCoverDamage(final ItemStack aStack, final long aDamage) { + public static boolean setCoverDamage(final ItemStack aStack, final long aDamage) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); @@ -137,7 +136,7 @@ public class MetaCustomCoverItem extends Item { return false; } - public static final boolean getCoverConnections(final ItemStack aStack) { + public static boolean getCoverConnections(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); @@ -150,7 +149,7 @@ public class MetaCustomCoverItem extends Item { return false; } - public static final boolean setCoverConnections(final ItemStack aStack, final boolean aConnections) { + public static boolean setCoverConnections(final ItemStack aStack, final boolean aConnections) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); @@ -169,19 +168,14 @@ public class MetaCustomCoverItem extends Item { } double currentDamage = getCoverDamage(stack); double meta = stack.getItemDamage() == 0 ? 50 : 2500; - double durabilitypercent = currentDamage / meta; - return durabilitypercent; + return currentDamage / meta; } @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if (KeyboardUtils.isShiftKeyDown()) { boolean con = getCoverConnections(stack); - if (con) { - setCoverConnections(stack, false); - } else { - setCoverConnections(stack, true); - } + setCoverConnections(stack, !con); } return stack; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java index be7a0f1c99..5a1bb0eba5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java @@ -16,7 +16,7 @@ import gtPlusPlus.core.util.minecraft.PlayerUtils; public class Behaviour_Choocher extends BehaviourNone { - private boolean isWrench = true; + private final boolean isWrench = true; private final BehaviourWrench wrench = new BehaviourWrench(150); private final Behaviour_Prospecting_Ex prospecting = new Behaviour_Prospecting_Ex(10, 1250); private final String mTooltip1 = GTLanguageManager diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java index f63da57f1c..4196d399a1 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java @@ -68,9 +68,7 @@ public class Behaviour_Prospecting_Ex extends BehaviourProspecting { int tY = aY; int tZ = aZ; int tMetaID = 0; - final int tQuality = ((aItem instanceof MetaGeneratedTool) - ? ((MetaGeneratedTool) aItem).getHarvestLevel(aStack, "") - : 0) * 3; + final int tQuality = ((aItem instanceof MetaGeneratedTool) ? aItem.getHarvestLevel(aStack, "") : 0) * 3; int i = 0; for (final int j = 6 + tQuality; i < j; i++) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/render/MachineBlockRenderer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/render/MachineBlockRenderer.java index 7ce7002738..e39a6fcbba 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/render/MachineBlockRenderer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/render/MachineBlockRenderer.java @@ -232,21 +232,19 @@ public class MachineBlockRenderer extends GTRendererBlock { RenderBlocks aRenderer) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof ITexturedTileEntity - ? renderStandardBlock( - aWorld, - aX, - aY, - aZ, - aBlock, - aRenderer, - new ITexture[][] { GTMethodHelper.getTexture(tTileEntity, aBlock, DOWN), - GTMethodHelper.getTexture(tTileEntity, aBlock, UP), - GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.NORTH), - GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.SOUTH), - GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.WEST), - GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.EAST) }) - : false; + return tTileEntity instanceof ITexturedTileEntity && renderStandardBlock( + aWorld, + aX, + aY, + aZ, + aBlock, + aRenderer, + new ITexture[][] { GTMethodHelper.getTexture(tTileEntity, aBlock, DOWN), + GTMethodHelper.getTexture(tTileEntity, aBlock, UP), + GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.NORTH), + GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.SOUTH), + GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.WEST), + GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.EAST) }); } public boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, @@ -1220,22 +1218,13 @@ public class MachineBlockRenderer extends GTRendererBlock { public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID, RenderBlocks aRenderer) { TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return aTileEntity == null ? false - : (aTileEntity instanceof IGregTechTileEntity - && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity() != null - && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity() - .renderInWorld(aWorld, aX, aY, aZ, aBlock, aRenderer) - ? true - : (aTileEntity instanceof IPipeRenderedTileEntity - ? renderPipeBlock( - aWorld, - aX, - aY, - aZ, - aBlock, - (IPipeRenderedTileEntity) aTileEntity, - aRenderer) - : renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer))); + return aTileEntity != null && (aTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity() != null + && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity() + .renderInWorld(aWorld, aX, aY, aZ, aBlock, aRenderer) + || (aTileEntity instanceof IPipeRenderedTileEntity + ? renderPipeBlock(aWorld, aX, aY, aZ, aBlock, (IPipeRenderedTileEntity) aTileEntity, aRenderer) + : renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer))); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTEElectricAutoWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTEElectricAutoWorkbench.java index 05150c8478..73233b7938 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTEElectricAutoWorkbench.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTEElectricAutoWorkbench.java @@ -391,7 +391,9 @@ public class MTEElectricAutoWorkbench extends MTEBasicTank implements IAddGregte tTempStack.stackSize = 1; tRecipe[0] = tTempStack; tOutput = GTOreDictUnificator.get(true, tTempStack); - if (tOutput != null && GTUtility.areStacksEqual(tOutput, tTempStack)) tOutput = null; + if (GTUtility.areStacksEqual(tOutput, tTempStack)) { + tOutput = null; + } if (tOutput == null) { tRecipe[0] = null; if (mInventory[18] == null) { @@ -552,7 +554,7 @@ public class MTEElectricAutoWorkbench extends MTEBasicTank implements IAddGregte mInventory[28] = GTUtility.copy(tOutput); ArrayList<ItemStack> tList = recipeContent(tRecipe), tContent = benchContent(); - if (tList.size() > 0 && tContent.size() > 0) { + if (!tList.isEmpty() && !tContent.isEmpty()) { boolean success = (mMode == 6 || mMode == 7 || mInventory[17] == null); for (byte i = 0; i < tList.size() && success; i++) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractGenerator.java index 08db4e19be..a48bcdace4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractGenerator.java @@ -196,13 +196,10 @@ public class MTETesseractGenerator extends MTEBasicTank { .getOwnerName() != null && !this.getBaseMetaTileEntity() .getOwnerName() - .equals("")) { + .isEmpty()) { if (this.getBaseMetaTileEntity() .getOwnerName() - .toLowerCase() - .equals( - aPlayer.getDisplayName() - .toLowerCase())) { + .equalsIgnoreCase(aPlayer.getDisplayName())) { this.mOwner = PlayerUtils.getPlayersUUIDByName( this.getBaseMetaTileEntity() .getOwnerName()); @@ -684,8 +681,8 @@ public class MTETesseractGenerator extends MTEBasicTank { && (this.getBaseMetaTileEntity() .decreaseStoredEnergyUnits(this.mNeededEnergy, false))) { // Utils.LOG_WARNING("Can Work & Has Energy"); - if ((getGeneratorEntity(Integer.valueOf(this.mFrequency)) == null) - || (!getGeneratorEntity(Integer.valueOf(this.mFrequency)).isValidTesseractGenerator(null, true))) { + if ((getGeneratorEntity(this.mFrequency) == null) + || (!getGeneratorEntity(this.mFrequency).isValidTesseractGenerator(null, true))) { // Utils.LOG_WARNING("storing TE I think to mFreq map?"); TesseractHelper.setGeneratorOwnershipByPlayer( PlayerUtils.getPlayerOnServerFromUUID(mOwner), @@ -693,7 +690,7 @@ public class MTETesseractGenerator extends MTEBasicTank { this); } } else { - if (getGeneratorEntity(Integer.valueOf(this.mFrequency)) == this) { + if (getGeneratorEntity(this.mFrequency) == this) { Logger.WARNING("this gen == mFreq on map - do block update"); TesseractHelper.removeGenerator(PlayerUtils.getPlayerOnServerFromUUID(mOwner), this.mFrequency); this.getBaseMetaTileEntity() @@ -701,7 +698,7 @@ public class MTETesseractGenerator extends MTEBasicTank { } this.isWorking = 0; } - if (getGeneratorEntity(Integer.valueOf(this.mFrequency)) == this) { + if (getGeneratorEntity(this.mFrequency) == this) { // Utils.LOG_WARNING("mFreq == this - do work related things"); if (this.isWorking < 20) { this.isWorking = ((byte) (this.isWorking + 1)); @@ -789,21 +786,11 @@ public class MTETesseractGenerator extends MTEBasicTank { } private MTETesseractGenerator getGeneratorEntity() { - MTETesseractGenerator thisGenerator = TesseractHelper - .getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), this.mFrequency); - if (thisGenerator != null) { - return thisGenerator; - } - return null; + return TesseractHelper.getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), this.mFrequency); } private MTETesseractGenerator getGeneratorEntity(int frequency) { - MTETesseractGenerator thisGenerator = TesseractHelper - .getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), frequency); - if (thisGenerator != null) { - return thisGenerator; - } - return null; + return TesseractHelper.getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), frequency); } @Override @@ -812,7 +799,7 @@ public class MTETesseractGenerator extends MTEBasicTank { .getOwnerName() != null && !this.getBaseMetaTileEntity() .getOwnerName() - .equals("")) { + .isEmpty()) { this.mOwner = PlayerUtils.getPlayersUUIDByName( this.getBaseMetaTileEntity() .getOwnerName()); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractTerminal.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractTerminal.java index c34a2ca41b..1935129e32 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractTerminal.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractTerminal.java @@ -149,13 +149,10 @@ public class MTETesseractTerminal extends MTEBasicTank { .getOwnerName() != null && !this.getBaseMetaTileEntity() .getOwnerName() - .equals("")) { + .isEmpty()) { if (this.getBaseMetaTileEntity() .getOwnerName() - .toLowerCase() - .equals( - aPlayer.getDisplayName() - .toLowerCase())) { + .equalsIgnoreCase(aPlayer.getDisplayName())) { this.mOwner = PlayerUtils.getPlayersUUIDByName( this.getBaseMetaTileEntity() .getOwnerName()); @@ -194,11 +191,7 @@ public class MTETesseractTerminal extends MTEBasicTank { } PlayerUtils.messagePlayer(aPlayer, "Frequency: " + this.mFrequency); if (this.getTesseract(this.mFrequency, false) != null) { - PlayerUtils.messagePlayer( - aPlayer, - new StringBuilder().append(EnumChatFormatting.GREEN) - .append(" (Connected)") - .toString()); + PlayerUtils.messagePlayer(aPlayer, EnumChatFormatting.GREEN + " (Connected)"); } } } else if (aPlayer.getUniqueID() @@ -250,9 +243,7 @@ public class MTETesseractTerminal extends MTEBasicTank { aPlayer, "Frequency: " + this.mFrequency + (this.getTesseract(this.mFrequency, false) == null ? "" - : new StringBuilder().append(EnumChatFormatting.GREEN) - .append(" (Connected)") - .toString())); + : EnumChatFormatting.GREEN + " (Connected)")); } } else if (aPlayer.getUniqueID() .compareTo(this.mOwner) != 0) { @@ -275,10 +266,8 @@ public class MTETesseractTerminal extends MTEBasicTank { return null; } if (rTesseract.mFrequency != aFrequency) { - TesseractHelper.setTerminalOwnershipByPlayer( - PlayerUtils.getPlayerOnServerFromUUID(mOwner), - Integer.valueOf(aFrequency), - null); + TesseractHelper + .setTerminalOwnershipByPlayer(PlayerUtils.getPlayerOnServerFromUUID(mOwner), aFrequency, null); return null; } if (!rTesseract.isValidTesseractGenerator( @@ -539,7 +528,7 @@ public class MTETesseractTerminal extends MTEBasicTank { this.getBaseMetaTileEntity() .decreaseStoredEnergyUnits(128, false); } - } else if (this.mDidWork == true) { + } else if (this.mDidWork) { this.mDidWork = false; this.getBaseMetaTileEntity() .issueBlockUpdate(); @@ -623,7 +612,7 @@ public class MTETesseractTerminal extends MTEBasicTank { .getOwnerName() != null && !this.getBaseMetaTileEntity() .getOwnerName() - .equals("")) { + .isEmpty()) { this.mOwner = PlayerUtils.getPlayersUUIDByName( this.getBaseMetaTileEntity() .getOwnerName()); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTEGeothermalGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTEGeothermalGenerator.java index e84f4763cf..e1fc5c57f0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTEGeothermalGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTEGeothermalGenerator.java @@ -27,7 +27,7 @@ public class MTEGeothermalGenerator extends MTEBasicGenerator { public int mEfficiency; public MTEGeothermalGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires Pahoehoe Lava or Normal Lava as Fuel", new ITexture[0]); + super(aID, aName, aNameRegional, aTier, "Requires Pahoehoe Lava or Normal Lava as Fuel"); this.setEfficiency(); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERTGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERTGenerator.java index 9b51724b35..9f70912cad 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERTGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERTGenerator.java @@ -169,7 +169,7 @@ public class MTERTGenerator extends MTEBasicGenerator { } public MTERTGenerator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires RTG Pellets", new ITexture[0]); + super(aID, aName, aNameRegional, aTier, "Requires RTG Pellets"); } private byte getTier() { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERocketFuelGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERocketFuelGenerator.java index 48c3a63007..3565ac831b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERocketFuelGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERocketFuelGenerator.java @@ -21,7 +21,7 @@ public class MTERocketFuelGenerator extends MTERocketFuelGeneratorBase { public int mEfficiency; public MTERocketFuelGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires GT++ Rocket Fuels", new ITexture[0]); + super(aID, aName, aNameRegional, aTier, "Requires GT++ Rocket Fuels"); } public MTERocketFuelGenerator(final String aName, final int aTier, final String[] aDescription, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTESemiFluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTESemiFluidGenerator.java index 49c9523612..d499093247 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTESemiFluidGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTESemiFluidGenerator.java @@ -27,7 +27,7 @@ public class MTESemiFluidGenerator extends MTEBasicGenerator { public int mEfficiency; public MTESemiFluidGenerator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires semifluid Fuel", new ITexture[0]); + super(aID, aName, aNameRegional, aTier, "Requires semifluid Fuel"); this.mEfficiency = 100 - (this.mTier * 5); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAtmosphericReconditioner.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAtmosphericReconditioner.java index 6988d2f43b..438fe6a536 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAtmosphericReconditioner.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAtmosphericReconditioner.java @@ -68,14 +68,14 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { "Making sure you don't live in Gwalior - Uses 2A", 3, 0, - new ITexture[] { new GTRenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), - new GTRenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB), - new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active), - new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab), - new GTRenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast), - new GTRenderedTexture(TexturesGtBlock.Overlay_Machine_Vent), - new GTRenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), - new GTRenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB) }); + new GTRenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), + new GTRenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB), + new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active), + new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab), + new GTRenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast), + new GTRenderedTexture(TexturesGtBlock.Overlay_Machine_Vent), + new GTRenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), + new GTRenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB)); mPollutionEnabled = GTMod.gregtechproxy.mPollution; } @@ -264,8 +264,7 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { Logger.INFO("mOptimalAirFlow[1]:" + mOptimalAirFlow); // Calculate The Voltage we are running - long tVoltage = drainEU; - byte tTier = (byte) Math.max(1, GTUtility.getTier(tVoltage)); + byte tTier = (byte) Math.max(1, GTUtility.getTier(drainEU)); // Check Sides for Air, // More air means more pollution processing. @@ -295,15 +294,8 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { Logger.INFO("mCurrentPollution[4]:" + mCurrentPollution); Logger.INFO("mCurrentPollution[5]:" + reduction); - if (reduction <= mCurrentPollution) { - // Clean some Air. - toRemove = reduction; - } else { - // Makes sure we don't get negative pollution. - toRemove = mCurrentPollution; - } - - toRemove = toRemove / 2; + + toRemove = Math.min(reduction, mCurrentPollution) / 2; Logger.INFO("mCurrentPollution[6]:" + toRemove); // We are good to clean @@ -391,21 +383,13 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { mCurrentChunkPollution += getPollutionInChunk(r); } } - if (mCurrentChunkPollution > 0) { - mHasPollution = true; - } else { - mHasPollution = false; - } + mHasPollution = mCurrentChunkPollution > 0; return mCurrentChunkPollution; } public int getPollutionInChunk(Chunk aChunk) { int mCurrentChunkPollution = PollutionUtils.getPollution(aChunk); - if (mCurrentChunkPollution > 0) { - mHasPollution = true; - } else { - mHasPollution = false; - } + mHasPollution = mCurrentChunkPollution > 0; return mCurrentChunkPollution; } @@ -573,9 +557,8 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { public boolean removePollution(int toRemove) { - if (this == null || this.getBaseMetaTileEntity() == null - || this.getBaseMetaTileEntity() - .getWorld() == null) { + if (this.getBaseMetaTileEntity() == null || this.getBaseMetaTileEntity() + .getWorld() == null) { return false; } @@ -740,10 +723,8 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { if (aStack.getItem() instanceof ItemBasicScrubberTurbine) { return true; } - if (aStack.getItem() instanceof MetaGeneratedTool && aStack.getItemDamage() >= 170 - && aStack.getItemDamage() <= 179) { - return true; - } + return aStack.getItem() instanceof MetaGeneratedTool && aStack.getItemDamage() >= 170 + && aStack.getItemDamage() <= 179; } } return false; @@ -765,8 +746,7 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { @Override public String[] getInfoData() { - ArrayList<String> aTooltipSuper = new ArrayList<>(); - aTooltipSuper.addAll(Arrays.asList(super.getInfoData())); + ArrayList<String> aTooltipSuper = new ArrayList<>(Arrays.asList(super.getInfoData())); int mAirSides = getFreeSpaces(); int reduction = 0; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAutoChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAutoChisel.java index 6cdc97130b..b4f69323f4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAutoChisel.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAutoChisel.java @@ -40,14 +40,14 @@ public class MTEAutoChisel extends MTEBasicMachine { "Chisels things, Gregtech style", 1, 1, - new ITexture[] { new GTRenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), - new GTRenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB), - new GTRenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE), - new GTRenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER), - new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active), - new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab), - new GTRenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), - new GTRenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB) }); + new GTRenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), + new GTRenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB), + new GTRenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE), + new GTRenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER), + new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active), + new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab), + new GTRenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), + new GTRenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB)); } public MTEAutoChisel(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { @@ -90,8 +90,8 @@ public class MTEAutoChisel extends MTEBasicMachine { @Override protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return hasValidCache(aStack, this.getSpecialSlot(), false) ? true - : super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) && hasChiselResults(aStack); + return hasValidCache(aStack, this.getSpecialSlot(), false) + || super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) && hasChiselResults(aStack); } // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target @@ -108,7 +108,7 @@ public class MTEAutoChisel extends MTEBasicMachine { // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target private static boolean hasChiselResults(ItemStack from) { List<ItemStack> results = getItemsForChiseling(from); - return results.size() > 0; + return !results.isEmpty(); } private static List<ItemStack> getItemsForChiseling(ItemStack aStack) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTECropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTECropHarvestor.java index 9788abcf0c..f1f129606f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTECropHarvestor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTECropHarvestor.java @@ -164,7 +164,7 @@ public class MTECropHarvestor extends MTEBasicTank { }; } - private HashSet<ICropTile> mCropCache = new HashSet<>(); + private final HashSet<ICropTile> mCropCache = new HashSet<>(); private boolean mInvalidCache = false; public boolean doesInventoryHaveSpace() { @@ -213,7 +213,7 @@ public class MTECropHarvestor extends MTEBasicTank { for (int x = (-aSide); x <= aSide; x++) { for (int z = (-aSide); z <= aSide; z++) { TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(x, y, z); - if (tTileEntity != null && tTileEntity instanceof ICropTile tCrop) { + if (tTileEntity instanceof ICropTile tCrop) { this.mCropCache.add(tCrop); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionCreator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionCreator.java index 2521fb703f..0226214c44 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionCreator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionCreator.java @@ -22,10 +22,10 @@ public class MTEPollutionCreator extends GTPPMetaTileEntity { int mCurrentPollution; int mAveragePollution; - int mAveragePollutionArray[] = new int[10]; + int[] mAveragePollutionArray = new int[10]; private int mArrayPos = 0; private int mTickTimer = 0; - private int mSecondTimer = 0; + private final int mSecondTimer = 0; public MTEPollutionCreator(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionDetector.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionDetector.java index 747663f4cb..87e18931b5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionDetector.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionDetector.java @@ -24,10 +24,10 @@ public class MTEPollutionDetector extends GTPPMetaTileEntity { int mCurrentPollution; int mAveragePollution; - int mAveragePollutionArray[] = new int[10]; + int[] mAveragePollutionArray = new int[10]; private int mArrayPos = 0; private int mTickTimer = 0; - private int mSecondTimer = 0; + private final int mSecondTimer = 0; private long mRedstoneLevel = 0; public MTEPollutionDetector(final int aID, final String aName, final String aNameRegional, final int aTier, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEWirelessCharger.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEWirelessCharger.java index 1535140115..739a098331 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEWirelessCharger.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEWirelessCharger.java @@ -323,9 +323,7 @@ public class MTEWirelessCharger extends GTPPMetaTileEntity { @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } + aBaseMetaTileEntity.isClientSide(); return true; } @@ -449,18 +447,14 @@ public class MTEWirelessCharger extends GTPPMetaTileEntity { super.onFirstTick(aBaseMetaTileEntity); } - private Map<String, UUID> mWirelessChargingMap = new HashMap<>(); - private Map<String, UUID> mLocalChargingMap = new HashMap<>(); + private final Map<String, UUID> mWirelessChargingMap = new HashMap<>(); + private final Map<String, UUID> mLocalChargingMap = new HashMap<>(); private boolean isValidPlayer(EntityPlayer aPlayer) { BaseMetaTileEntity aTile = (BaseMetaTileEntity) this.getBaseMetaTileEntity(); if (mLocked || (aTile != null && aTile.privateAccess())) { - if (aPlayer.getUniqueID() - .equals(getBaseMetaTileEntity().getOwnerUuid())) { - return true; - } else { - return false; - } + return aPlayer.getUniqueID() + .equals(getBaseMetaTileEntity().getOwnerUuid()); } return true; } @@ -579,11 +573,10 @@ public class MTEWirelessCharger extends GTPPMetaTileEntity { int[] objectArray1 = new int[] { objectA.xPos, objectA.yPos, objectA.zPos }; int[] objectArray2 = new int[] { objectB.xPos, objectB.yPos, objectB.zPos }; - final double distance = Math.sqrt( + return Math.sqrt( (objectArray2[0] - objectArray1[0]) * (objectArray2[0] - objectArray1[0]) + (objectArray2[1] - objectArray1[1]) * (objectArray2[1] - objectArray1[1]) + (objectArray2[2] - objectArray1[2]) * (objectArray2[2] - objectArray1[2])); - return distance; } @Override @@ -636,7 +629,7 @@ public class MTEWirelessCharger extends GTPPMetaTileEntity { PlayerUtils.messagePlayer(aPlayer, "Players with access:"); for (String name : this.getLocalMap() .keySet()) { - PlayerUtils.messagePlayer(aPlayer, "" + name); + PlayerUtils.messagePlayer(aPlayer, name); } } else { @@ -644,7 +637,7 @@ public class MTEWirelessCharger extends GTPPMetaTileEntity { PlayerUtils.messagePlayer(aPlayer, "Players with access:"); for (String name : this.getLongRangeMap() .keySet()) { - PlayerUtils.messagePlayer(aPlayer, "" + name); + PlayerUtils.messagePlayer(aPlayer, name); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialChisel.java index 40a497fa06..d68fe3f8c7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialChisel.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialChisel.java @@ -195,7 +195,7 @@ public class MTEIndustrialChisel extends GTPPMultiBlockBase<MTEIndustrialChisel> // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target private static boolean hasChiselResults(ItemStack from) { List<ItemStack> results = getItemsForChiseling(from); - return results.size() > 0; + return !results.isEmpty(); } private static List<ItemStack> getItemsForChiseling(ItemStack aStack) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java index eb7e6baa9c..8b63f34edb 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java @@ -62,7 +62,7 @@ public class MTEIndustrialDehydrator extends GTPPMultiBlockBase<MTEIndustrialDeh implements ISurvivalConstructable { private static int CASING_TEXTURE_ID; - private static String mCasingName = "Vacuum Casing"; + private static final String mCasingName = "Vacuum Casing"; private HeatingCoilLevel mHeatingCapacity; private boolean mDehydratorMode = false; private int mCasing; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialVacuumFreezer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialVacuumFreezer.java index 8d543b7bcc..563b844574 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialVacuumFreezer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialVacuumFreezer.java @@ -72,7 +72,7 @@ public class MTEIndustrialVacuumFreezer extends GTPPMultiBlockBase<MTEIndustrial @Override public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return (IMetaTileEntity) new MTEIndustrialVacuumFreezer(this.mName); + return new MTEIndustrialVacuumFreezer(this.mName); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIsaMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIsaMill.java index 0df9417f32..5634b5f1d6 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIsaMill.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIsaMill.java @@ -256,9 +256,7 @@ public class MTEIsaMill extends GTPPMultiBlockBase<MTEIsaMill> implements ISurvi if (!aEntities.isEmpty()) { for (EntityLivingBase aFoundEntity : aEntities) { if (aFoundEntity instanceof EntityPlayer aPlayer) { - if (PlayerUtils.isCreative(aPlayer) || !PlayerUtils.canTakeDamage(aPlayer)) { - continue; - } else { + if (!PlayerUtils.isCreative(aPlayer) && PlayerUtils.canTakeDamage(aPlayer)) { if (aFoundEntity.getHealth() > 0) { EntityUtils.doDamage(aFoundEntity, mIsaMillDamageSource, getPlayerDamageValue(aPlayer, 10)); if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTECyclotron.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTECyclotron.java index 4c313a3be3..6952dd5c24 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTECyclotron.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTECyclotron.java @@ -264,7 +264,7 @@ public class MTECyclotron extends GTPPMultiBlockBase<MTECyclotron> implements IS @Override public boolean onRunningTick(ItemStack aStack) { - if (this.mOutputBusses.size() > 0) { + if (!this.mOutputBusses.isEmpty()) { for (MTEHatchOutputBus g : this.mOutputBusses) { if (g != null) { for (ItemStack s : g.mInventory) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEElementalDuplicator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEElementalDuplicator.java index a241238e42..32ea79cc55 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEElementalDuplicator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEElementalDuplicator.java @@ -152,7 +152,7 @@ public class MTEElementalDuplicator extends GTPPMultiBlockBase<MTEElementalDupli .build(), buildHatchAdder(MTEElementalDuplicator.class) .hatchClass(MTEHatchElementalDataOrbHolder.class) - .shouldReject(x -> x.mReplicatorDataOrbHatches.size() >= 1) + .shouldReject(x -> !x.mReplicatorDataOrbHatches.isEmpty()) .adder(MTEElementalDuplicator::addDataOrbHatch) .casingIndex(getCasingTextureIndex()) .dot(1) @@ -172,7 +172,7 @@ public class MTEElementalDuplicator extends GTPPMultiBlockBase<MTEElementalDupli public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mCasing = 0; boolean aDidBuild = checkPiece(STRUCTURE_PIECE_MAIN, 4, 4, 0); - if (this.mInputHatches.size() != 1 || (this.mOutputBusses.size() != 1 && this.mOutputHatches.size() != 0) + if (this.mInputHatches.size() != 1 || (this.mOutputBusses.size() != 1 && !this.mOutputHatches.isEmpty()) || this.mEnergyHatches.size() != 1 || this.mReplicatorDataOrbHatches.size() != 1) { return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEFrothFlotationCell.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEFrothFlotationCell.java index f4e9bac434..bbcbfc1322 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEFrothFlotationCell.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEFrothFlotationCell.java @@ -276,7 +276,7 @@ public class MTEFrothFlotationCell extends GTPPMultiBlockBase<MTEFrothFlotationC @Override public boolean isRecipeLockingEnabled() { - return lockedMaterialName != null && !lockedMaterialName.equals(""); + return lockedMaterialName != null && !lockedMaterialName.isEmpty(); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialRockBreaker.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialRockBreaker.java index c3bf843fd3..ee62f45ef8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialRockBreaker.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialRockBreaker.java @@ -144,7 +144,7 @@ public class MTEIndustrialRockBreaker extends GTPPMultiBlockBase<MTEIndustrialRo boolean aCheckPiece = checkPiece(mName, 1, 3, 0); boolean aCasingCount = mCasing >= 9; boolean aCheckHatch = checkHatch(); - log("" + aCheckPiece + ", " + aCasingCount + ", " + aCheckHatch); + log(aCheckPiece + ", " + aCasingCount + ", " + aCheckHatch); return aCheckPiece && aCasingCount && aCheckHatch; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTELargeRocketEngine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTELargeRocketEngine.java index f2ddecb687..b9e1d7858c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTELargeRocketEngine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTELargeRocketEngine.java @@ -132,8 +132,8 @@ public class MTELargeRocketEngine extends GTPPMultiBlockBase<MTELargeRocketEngin @Override public IStructureDefinition<MTELargeRocketEngine> getStructureDefinition() { - if (this.STRUCTURE_DEFINITION == null) { - this.STRUCTURE_DEFINITION = StructureDefinition.<MTELargeRocketEngine>builder() + if (STRUCTURE_DEFINITION == null) { + STRUCTURE_DEFINITION = StructureDefinition.<MTELargeRocketEngine>builder() .addShape( this.mName, transpose( @@ -161,7 +161,7 @@ public class MTELargeRocketEngine extends GTPPMultiBlockBase<MTELargeRocketEngin .addElement('M', Muffler.newAny(getCasingTextureIndex(), 3)) .build(); } - return this.STRUCTURE_DEFINITION; + return STRUCTURE_DEFINITION; } @Override @@ -182,7 +182,7 @@ public class MTELargeRocketEngine extends GTPPMultiBlockBase<MTELargeRocketEngin this.mAllDynamoHatches.clear(); this.mAirIntakes.clear(); return checkPiece(this.mName, 1, 1, 0) && this.mCasing >= 64 - 48 - && this.mAirIntakes.size() >= 1 + && !this.mAirIntakes.isEmpty() && checkHatch(); } @@ -270,7 +270,7 @@ public class MTELargeRocketEngine extends GTPPMultiBlockBase<MTELargeRocketEngin // reset fuel ticks in case it does not reset when it stops if (this.freeFuelTicks != 0 && this.mProgresstime == 0 && this.mEfficiency == 0) this.freeFuelTicks = 0; - if (tFluids.size() > 0 && getRecipeMap() != null) { + if (!tFluids.isEmpty() && getRecipeMap() != null) { if (this.mRuntime % 72 == 0) { if (!consumeCO2()) { this.freeFuelTicks = 0; @@ -375,7 +375,7 @@ public class MTELargeRocketEngine extends GTPPMultiBlockBase<MTELargeRocketEngin if (aEU <= 0) { return true; } - if (this.mAllDynamoHatches.size() > 0) { + if (!this.mAllDynamoHatches.isEmpty()) { return addEnergyOutputMultipleDynamos(aEU, true); } return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTENuclearReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTENuclearReactor.java index 3da77cf783..31caefe8f2 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTENuclearReactor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTENuclearReactor.java @@ -261,7 +261,7 @@ public class MTENuclearReactor extends GTPPMultiBlockBase<MTENuclearReactor> imp public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mCasing = 0; if (checkPiece(mName, 3, 3, 0) && mCasing >= 27) { - if ((mOutputHatches.size() >= 3 || canDumpFluidToME()) && mInputHatches.size() >= 1 + if ((mOutputHatches.size() >= 3 || canDumpFluidToME()) && !mInputHatches.isEmpty() && mDynamoHatches.size() == 4 && mMufflerHatches.size() == 4) { this.turnCasingActive(false); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTERefinery.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTERefinery.java index f7f992e191..9b28387849 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTERefinery.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTERefinery.java @@ -175,7 +175,7 @@ public class MTERefinery extends GTPPMultiBlockBase<MTERefinery> implements ISur mCasing = 0; if (checkPiece(mName, 1, 7, 0) && mCasing >= 7) { if (this.mInputHatches.size() >= 2 && this.mInputHatches.size() <= 4 - && this.mOutputHatches.size() >= 1 + && !this.mOutputHatches.isEmpty() && this.mOutputHatches.size() <= 2 && this.mMufflerHatches.size() == 1 && this.mMaintenanceHatches.size() == 1 diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTESolarTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTESolarTower.java index 085cb1b784..31ed44d5a3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTESolarTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTESolarTower.java @@ -281,8 +281,8 @@ public class MTESolarTower extends GTPPMultiBlockBase<MTESolarTower> implements boolean aAllCasings = aCasingCount1 && aCasingCount2 && aCasingCount3 && aCasingCount4; if (!aAllCasings || !aAllStructure || mMaintenanceHatches.size() != 1 - || mInputHatches.size() < 1 - || mOutputHatches.size() < 1) { + || mInputHatches.isEmpty() + || mOutputHatches.isEmpty()) { log( "Bad Hatches - Solar Heaters: " + mSolarHeaters.size() + ", Maint: " @@ -486,7 +486,7 @@ public class MTESolarTower extends GTPPMultiBlockBase<MTESolarTower> implements // log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size()); } } - return mSolarHeaters.size() > 0; + return !mSolarHeaters.isEmpty(); } private boolean addSolarHeater(IGregTechTileEntity aTileEntity, int a) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java index bb5754bef7..5478014c62 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java @@ -266,8 +266,7 @@ public class MTETreeFarm extends GTPPMultiBlockBase<MTETreeFarm> implements ISur * In previous versions, a saw used to go in the controller slot. We do not want an update to stop processing of * a machine set up like this. Instead, a sapling is placed in this slot at the start of the next operation. */ - if (aStack.getItem() instanceof MetaGeneratedTool01) return true; - return false; + return aStack.getItem() instanceof MetaGeneratedTool01; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/MTEAlgaePondBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/MTEAlgaePondBase.java index 49e9878bec..6b266908ce 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/MTEAlgaePondBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/MTEAlgaePondBase.java @@ -183,8 +183,8 @@ public class MTEAlgaePondBase extends GTPPMultiBlockBase<MTEAlgaePondBase> imple if (checkPiece(mName, 4, 2, 0) && mCasing >= 64 && checkMeta > 0 - && mInputHatches.size() >= 1 - && mOutputBusses.size() >= 1) { + && !mInputHatches.isEmpty() + && !mOutputBusses.isEmpty()) { mLevel = checkMeta - 1; for (MTEHatchInput inputHatch : mInputHatches) { if (inputHatch.mTier < mLevel) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/MTEChemicalPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/MTEChemicalPlant.java index a6794809ef..1e5d1bb9ea 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/MTEChemicalPlant.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/MTEChemicalPlant.java @@ -80,7 +80,7 @@ public class MTEChemicalPlant extends GTPPMultiBlockBase<MTEChemicalPlant> imple private int mPipeCasingTier = 0; private int mCoilTier = 0; private HeatingCoilLevel checkCoil; - private int[] checkCasing = new int[8]; + private final int[] checkCasing = new int[8]; private int checkMachine; private int checkPipe; private int maxTierOfHatch; @@ -114,10 +114,8 @@ public class MTEChemicalPlant extends GTPPMultiBlockBase<MTEChemicalPlant> imple if (!mTieredBlockRegistry.containsKey(aTier)) { return 10; } - int aCasingID = mTieredBlockRegistry.get(aTier) + return mTieredBlockRegistry.get(aTier) .getValue_3(); - // Logger.INFO("Found casing texture ID "+aCasingID+" for tier "+aTier); - return aCasingID; } @Override @@ -216,7 +214,7 @@ public class MTEChemicalPlant extends GTPPMultiBlockBase<MTEChemicalPlant> imple .dot(1) .build(), buildHatchAdder(MTEChemicalPlant.class).hatchClass(MTEHatchCatalysts.class) - .shouldReject(t -> t.mCatalystBuses.size() >= 1) + .shouldReject(t -> !t.mCatalystBuses.isEmpty()) .adder(MTEChemicalPlant::addChemicalPlantList) .casingIndex(getCasingTextureID()) .dot(1) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineGas.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineGas.java index 93ec17e6ea..1e44eb95c3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineGas.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineGas.java @@ -25,7 +25,6 @@ import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; import gregtech.api.util.TurbineStatCalculator; -@SuppressWarnings("deprecation") public class MTELargeTurbineGas extends MTELargerTurbineBase { private static final HashSet<Fluid> BLACKLIST = new HashSet<>(); @@ -110,7 +109,7 @@ public class MTELargeTurbineGas extends MTELargerTurbineBase { @Override long fluidIntoPower(ArrayList<FluidStack> aFluids, TurbineStatCalculator turbine) { - if (aFluids.size() >= 1) { + if (!aFluids.isEmpty()) { int tEU = 0; int actualOptimalFlow = 0; FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. @@ -153,15 +152,12 @@ public class MTELargeTurbineGas extends MTELargerTurbineBase { if (totalFlow <= 0) return 0; tEU = GTUtility.safeInt((long) totalFlow * fuelValue); - if (totalFlow == actualOptimalFlow) { - tEU = GTUtility.safeInt( - (long) (tEU * (isLooseMode() ? turbine.getLooseGasEfficiency() : turbine.getGasEfficiency()))); - } else { + if (totalFlow != actualOptimalFlow) { float efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow); tEU *= efficiency; - tEU = GTUtility.safeInt( - (long) (tEU * (isLooseMode() ? turbine.getLooseGasEfficiency() : turbine.getGasEfficiency()))); } + tEU = GTUtility + .safeInt((long) (tEU * (isLooseMode() ? turbine.getLooseGasEfficiency() : turbine.getGasEfficiency()))); return tEU; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSHSteam.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSHSteam.java index 25650fad08..5fbcb237fd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSHSteam.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSHSteam.java @@ -14,7 +14,6 @@ import gregtech.api.util.TurbineStatCalculator; import gtPlusPlus.core.lib.GTPPCore; import gtPlusPlus.core.util.math.MathUtils; -@SuppressWarnings("deprecation") public class MTELargeTurbineSHSteam extends MTELargerTurbineBase { public boolean achievement = false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSteam.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSteam.java index 0de134950c..beeaa2726b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSteam.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSteam.java @@ -14,7 +14,6 @@ import gregtech.api.util.GTModHandler; import gregtech.api.util.TurbineStatCalculator; import gtPlusPlus.core.util.math.MathUtils; -@SuppressWarnings("deprecation") public class MTELargeTurbineSteam extends MTELargerTurbineBase { private float water; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java index dc2f105bbb..fa9d60fb11 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java @@ -214,11 +214,11 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT boolean aStructure = checkPiece(STRUCTURE_PIECE_MAIN, 3, 3, 0); log("Structure Check: " + aStructure); if (mTurbineRotorHatches.size() != 12 || mMaintenanceHatches.size() != 1 - || (mDynamoHatches.size() < 1 && mTecTechDynamoHatches.size() < 1) + || (mDynamoHatches.isEmpty() && mTecTechDynamoHatches.isEmpty()) || (requiresMufflers() && mMufflerHatches.size() != 4) - || mInputBusses.size() < 1 - || mInputHatches.size() < 1 - || (requiresOutputHatch() && mOutputHatches.size() < 1)) { + || mInputBusses.isEmpty() + || mInputHatches.isEmpty() + || (requiresOutputHatch() && mOutputHatches.isEmpty())) { log( "Bad Hatches - Turbine Housings: " + mTurbineRotorHatches.size() + ", Maint: " @@ -406,7 +406,7 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT for (MTEHatchInputBus aInputBus : this.mInputBusses) { for (int slot = aInputBus.getSizeInventory() - 1; slot >= 0; slot--) { ItemStack aStack = aInputBus.getStackInSlot(slot); - if (aStack != null && GTUtility.areStacksEqual(aStack, aTurbine)) { + if (GTUtility.areStacksEqual(aStack, aTurbine)) { aStack.stackSize -= aTurbine.stackSize; updateSlots(); endRecipeProcessing(); @@ -421,7 +421,7 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT public @NotNull CheckRecipeResult checkProcessing() { try { ArrayList<MTEHatchTurbine> aEmptyTurbineRotorHatches = getEmptyTurbineAssemblies(); - if (aEmptyTurbineRotorHatches.size() > 0) { + if (!aEmptyTurbineRotorHatches.isEmpty()) { hatch: for (MTEHatchTurbine aHatch : aEmptyTurbineRotorHatches) { ArrayList<ItemStack> aTurbines = getAllBufferedTurbines(); for (ItemStack aTurbineItem : aTurbines) { @@ -436,7 +436,7 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT } } - if (getEmptyTurbineAssemblies().size() > 0 || !areAllTurbinesTheSame()) { + if (!getEmptyTurbineAssemblies().isEmpty() || !areAllTurbinesTheSame()) { stopMachine(ShutDownReasonRegistry.NO_TURBINE); return CheckRecipeResultRegistry.NO_TURBINE_FOUND; } @@ -448,7 +448,7 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT TurbineStatCalculator turbine = new TurbineStatCalculator((MetaGeneratedTool) aStack.getItem(), aStack); - if (tFluids.size() > 0) { + if (!tFluids.isEmpty()) { if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity() @@ -606,7 +606,7 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT .toLowerCase() .contains("steam"); - String[] ret = new String[] { + return new String[] { // 8 Lines available for information panels tRunning + ": " + EnumChatFormatting.RED @@ -649,7 +649,6 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT + GTUtility.formatNumbers(mPollutionReduction) + EnumChatFormatting.RESET + " %" }; - return ret; } @Override @@ -794,7 +793,7 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT if (aEU <= 0) { return true; } - if (this.mAllDynamoHatches.size() > 0) { + if (!this.mAllDynamoHatches.isEmpty()) { return addEnergyOutputMultipleDynamos(aEU, true); } return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbinePlasma.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbinePlasma.java index 3385125bb7..4f3626e7cd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbinePlasma.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbinePlasma.java @@ -23,7 +23,6 @@ import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.MTEHatchTurbine; -@SuppressWarnings("deprecation") public class MTELargerTurbinePlasma extends MTELargerTurbineBase { public MTELargerTurbinePlasma(int aID, String aName, String aNameRegional) { @@ -92,7 +91,7 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { try { ArrayList<MTEHatchTurbine> aEmptyTurbineRotorHatches = getEmptyTurbineAssemblies(); - if (aEmptyTurbineRotorHatches.size() > 0) { + if (!aEmptyTurbineRotorHatches.isEmpty()) { hatch: for (MTEHatchTurbine aHatch : aEmptyTurbineRotorHatches) { ArrayList<ItemStack> aTurbines = getAllBufferedTurbines(); for (ItemStack aTurbineItem : aTurbines) { @@ -107,7 +106,7 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { } } - if (getEmptyTurbineAssemblies().size() > 0 || !areAllTurbinesTheSame()) { + if (!getEmptyTurbineAssemblies().isEmpty() || !areAllTurbinesTheSame()) { stopMachine(ShutDownReasonRegistry.NO_TURBINE); return CheckRecipeResultRegistry.NO_TURBINE_FOUND; } @@ -122,7 +121,7 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { ArrayList<FluidStack> tFluids = getStoredFluids(); - if (tFluids.size() > 0) { + if (!tFluids.isEmpty()) { if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity() @@ -169,7 +168,7 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { // formula: // EU/t = EU/t * MIN(1, ( ( (FuelValue / 200) ^ 2 ) / EUPerTurbine)) int fuelValue = 0; - if (tFluids.size() > 0) { + if (!tFluids.isEmpty()) { fuelValue = getFuelValue(new FluidStack(tFluids.get(0), 0)); } float magicValue = (fuelValue * 0.005f) * (fuelValue * 0.005f); @@ -181,7 +180,7 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { // Magic numbers: can always change by at least 200 eu/s, but otherwise by at most 20 percent of the // difference in power level (per second) // This is how much the turbine can actually change during this tick - int maxChangeAllowed = Math.max(200, GTUtility.safeInt((long) Math.abs(difference) / 5)); + int maxChangeAllowed = Math.max(200, GTUtility.safeInt(Math.abs(difference) / 5)); if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed // change @@ -209,7 +208,7 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { } long fluidIntoPower(ArrayList<FluidStack> aFluids, TurbineStatCalculator turbine) { - if (aFluids.size() >= 1) { + if (!aFluids.isEmpty()) { int tEU = 0; int actualOptimalFlow = 0; @@ -255,18 +254,12 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { if (totalFlow <= 0) return 0; tEU = GTUtility.safeInt((long) ((fuelValue / 20D) * (double) totalFlow)); - if (totalFlow == actualOptimalFlow) { - tEU = GTUtility.safeInt( - (long) ((isLooseMode() ? turbine.getLoosePlasmaEfficiency() : turbine.getPlasmaEfficiency()) - * tEU)); - } else { + if (totalFlow != actualOptimalFlow) { double efficiency = 1.0D - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow); - tEU = (int) (tEU * efficiency); - tEU = GTUtility.safeInt( - (long) ((isLooseMode() ? turbine.getLoosePlasmaEfficiency() : turbine.getPlasmaEfficiency()) - * tEU)); } + tEU = GTUtility.safeInt( + (long) ((isLooseMode() ? turbine.getLoosePlasmaEfficiency() : turbine.getPlasmaEfficiency()) * tEU)); return tEU; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java index f392bff171..241b970ae8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java @@ -81,7 +81,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GTPPMult public class GregtechMetaTileEntity_PowerSubStationController extends GTPPMultiBlockBase<GregtechMetaTileEntity_PowerSubStationController> implements ISurvivalConstructable { - private static enum TopState { + private enum TopState { MayBeTop, Top, NotTop @@ -99,7 +99,7 @@ public class GregtechMetaTileEntity_PowerSubStationController private final int ENERGY_TAX = 5; private int mCasing; - private int[] cellCount = new int[6]; + private final int[] cellCount = new int[6]; private TopState topState = TopState.MayBeTop; private static IStructureDefinition<GregtechMetaTileEntity_PowerSubStationController> STRUCTURE_DEFINITION = null; @@ -212,17 +212,13 @@ public class GregtechMetaTileEntity_PowerSubStationController } public static int getMaxHatchTier(int aCellTier) { - switch (aCellTier) { - case 9 -> { - return GTValues.VOLTAGE_NAMES[9].equals("Ultimate High Voltage") ? 15 : 9; - } - default -> { - if (aCellTier < 4) { - return 0; - } else { - return aCellTier; - } - } + if (aCellTier == 9) { + return GTValues.VOLTAGE_NAMES[9].equals("Ultimate High Voltage") ? 15 : 9; + } + if (aCellTier < 4) { + return 0; + } else { + return aCellTier; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/MTESolarHeater.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/MTESolarHeater.java index 64925c9bb1..45721139bb 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/MTESolarHeater.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/MTESolarHeater.java @@ -266,7 +266,7 @@ public class MTESolarHeater extends MTETieredMachineBlock { } public boolean canSeeSky() { - if (this.getBaseMetaTileEntity() + return this.getBaseMetaTileEntity() .getWorld() .canBlockSeeTheSky( this.getBaseMetaTileEntity() @@ -274,17 +274,14 @@ public class MTESolarHeater extends MTETieredMachineBlock { this.getBaseMetaTileEntity() .getYCoord() + 1, this.getBaseMetaTileEntity() - .getZCoord())) { - return true; - } - return false; + .getZCoord()); } public boolean setSolarTower(MTESolarTower aTowerTile) { if (!hasSolarTower()) { this.mTX = aTowerTile.getBaseMetaTileEntity() .getXCoord(); - this.mTY = (int) aTowerTile.getBaseMetaTileEntity() + this.mTY = aTowerTile.getBaseMetaTileEntity() .getYCoord(); this.mTZ = aTowerTile.getBaseMetaTileEntity() .getZCoord(); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/MTERedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/MTERedstoneCircuitBlock.java index 20cd569e24..fceebe62d3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/MTERedstoneCircuitBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/MTERedstoneCircuitBlock.java @@ -46,7 +46,8 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; public class MTERedstoneCircuitBlock extends MTERedstoneBase implements IRedstoneCircuitBlock, IAddUIWidgets { - public int mGate = 0, mGateData[] = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }; + public int mGate = 0; + public int[] mGateData = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }; public boolean bOutput = true; public MTERedstoneCircuitBlock(int aID) { @@ -159,8 +160,7 @@ public class MTERedstoneCircuitBlock extends MTERedstoneBase implements IRedston public void switchGateForward(boolean aShift) { try { Set<Integer> tKeys = GregTechAPI.sCircuitryBehaviors.keySet(); - ArrayList<Integer> tList = new ArrayList<>(); - tList.addAll(tKeys); + ArrayList<Integer> tList = new ArrayList<>(tKeys); if (tList.size() <= 0) return; Collections.sort(tList); if (!GregTechAPI.sCircuitryBehaviors.containsKey(mGate)) mGate = tList.get(0); @@ -177,8 +177,7 @@ public class MTERedstoneCircuitBlock extends MTERedstoneBase implements IRedston public void switchGateBackward(boolean aShift) { try { Set<Integer> tKeys = GregTechAPI.sCircuitryBehaviors.keySet(); - ArrayList<Integer> tList = new ArrayList<>(); - tList.addAll(tKeys); + ArrayList<Integer> tList = new ArrayList<>(tKeys); if (tList.size() <= 0) return; Collections.sort(tList); if (!GregTechAPI.sCircuitryBehaviors.containsKey(mGate)) mGate = tList.get(0); @@ -324,7 +323,7 @@ public class MTERedstoneCircuitBlock extends MTERedstoneBase implements IRedston if (sCoversItems.isEmpty()) { initCovers(); } - return sCoversItems.get(Integer.valueOf(aStack)); + return sCoversItems.get(aStack); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/MTETieredChest.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/MTETieredChest.java index 423a71c3e1..51e5431da0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/MTETieredChest.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/MTETieredChest.java @@ -39,8 +39,7 @@ public class MTETieredChest extends MTETieredMachineBlock implements IAddUIWidge aNameRegional, aTier, 3, - "This Chest stores " + (int) (Math.pow(6.0D, (double) aTier) * mStorageFactor) + " Items", - new ITexture[0]); + "This Chest stores " + (int) (Math.pow(6.0D, aTier) * mStorageFactor) + " Items"); } public MTETieredChest(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { @@ -151,7 +150,7 @@ public class MTETieredChest extends MTETieredMachineBlock implements IAddUIWidge @Override public int getMaxItemCount() { - return (int) (Math.pow(6.0D, (double) this.mTier) * mStorageFactor - 128.0D); + return (int) (Math.pow(6.0D, this.mTier) * mStorageFactor - 128.0D); } public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/ToolAngleGrinder.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/ToolAngleGrinder.java index 196bc2a5bb..f65b3162f8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/ToolAngleGrinder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/ToolAngleGrinder.java @@ -28,7 +28,7 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; public class ToolAngleGrinder extends GTTool { public static final List<String> mEffectiveList = Arrays - .asList(new String[] { EntityIronGolem.class.getName(), "EntityTowerGuardian" }); + .asList(EntityIronGolem.class.getName(), "EntityTowerGuardian"); @Override public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, @@ -134,7 +134,7 @@ public class ToolAngleGrinder extends GTTool { @Override public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { - return (IIconContainer) (aIsToolHead ? TexturesGtTools.ANGLE_GRINDER : ItemIcons.POWER_UNIT_HV); + return aIsToolHead ? TexturesGtTools.ANGLE_GRINDER : ItemIcons.POWER_UNIT_HV; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/ToolElectricSnips.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/ToolElectricSnips.java index 78675f70d5..08b691f3e8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/ToolElectricSnips.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tools/ToolElectricSnips.java @@ -65,7 +65,7 @@ public class ToolElectricSnips extends ToolWireCutter { @Override public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { - return (IIconContainer) (aIsToolHead ? TexturesGtTools.ELECTRIC_SNIPS : ItemIcons.POWER_UNIT_MV); + return aIsToolHead ? TexturesGtTools.ELECTRIC_SNIPS : ItemIcons.POWER_UNIT_MV; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenBlastSmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenBlastSmelter.java index c64c846541..37ef0edc66 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenBlastSmelter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenBlastSmelter.java @@ -223,8 +223,7 @@ public class RecipeGenBlastSmelter extends RecipeGenBase { M.getComposites() .get(irc) .getDustStack(r))) { - final int xr = r; - if ((xr > 0) && (xr <= 100)) { + if (r > 0 && r <= 100) { final int mathmatics = (r * 1000); componentsFluid = FluidUtils.getFluidStack( M.getComposites() diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenBlastSmelterGTNH.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenBlastSmelterGTNH.java index a78b517268..8e92843e18 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenBlastSmelterGTNH.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenBlastSmelterGTNH.java @@ -24,8 +24,8 @@ import gtPlusPlus.core.util.minecraft.ItemUtils; public class RecipeGenBlastSmelterGTNH { - private static Map<String, FluidStack> mCachedIngotToFluidRegistry = new HashMap<>(); - private static Map<String, String> mCachedHotToColdRegistry = new HashMap<>(); + private static final Map<String, FluidStack> mCachedIngotToFluidRegistry = new HashMap<>(); + private static final Map<String, String> mCachedHotToColdRegistry = new HashMap<>(); private static synchronized void setIngotToFluid(final ItemStackData stack, final FluidStack fluid) { if (stack != null && fluid != null) { @@ -40,29 +40,25 @@ public class RecipeGenBlastSmelterGTNH { } private static synchronized FluidStack getFluidFromIngot(final ItemStackData ingot) { - ItemStackData h = ingot; - if (mCachedIngotToFluidRegistry.containsKey(h.getUniqueDataIdentifier())) { + if (mCachedIngotToFluidRegistry.containsKey(ingot.getUniqueDataIdentifier())) { Logger.MACHINE_INFO("[ABS] mCachedIngotToFluidRegistry contains Output Ingot."); - return mCachedIngotToFluidRegistry.get(h.getUniqueDataIdentifier()); + return mCachedIngotToFluidRegistry.get(ingot.getUniqueDataIdentifier()); } - if (mCachedHotToColdRegistry.containsKey(h.getUniqueDataIdentifier())) { + if (mCachedHotToColdRegistry.containsKey(ingot.getUniqueDataIdentifier())) { Logger.MACHINE_INFO("[ABS] mCachedHotToColdRegistry contains Output Ingot."); - return mCachedIngotToFluidRegistry.get(mCachedHotToColdRegistry.get(h.getUniqueDataIdentifier())); + return mCachedIngotToFluidRegistry.get(mCachedHotToColdRegistry.get(ingot.getUniqueDataIdentifier())); } Logger.MACHINE_INFO("[ABS] Neither Cache contains Output Ingot."); return null; } - private static boolean isValid(final ItemStack[] inputs, final ItemStack outputs[], final FluidStack[] fluidIn, + private static boolean isValid(final ItemStack[] inputs, final ItemStack[] outputs, final FluidStack[] fluidIn, final FluidStack fluidOut) { - if (inputs != null && outputs != null + return inputs != null && outputs != null && fluidIn != null && fluidOut != null && inputs.length > 0 - && outputs.length > 0) { - return true; - } - return false; + && outputs.length > 0; } public static synchronized boolean generateGTNHBlastSmelterRecipesFromEBFList() { @@ -152,7 +148,6 @@ public class RecipeGenBlastSmelterGTNH { // continue to next recipe if the Temp is too high. if (special > 3600) { Logger.MACHINE_INFO("[ABS] Skipping ABS addition for GTNH due to temp."); - continue; } else { FluidStack mMoltenStack = null; int mMoltenCount = 0; @@ -188,7 +183,7 @@ public class RecipeGenBlastSmelterGTNH { aTempList.add(recipeItem); } - inputs = aTempList.toArray(new ItemStack[aTempList.size()]); + inputs = aTempList.toArray(new ItemStack[0]); int inputLength = inputs.length; // If no circuit was found, increase array length by 1 to add circuit at newInput[0] if (!circuitFound) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenFluidCanning.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenFluidCanning.java index a334fd7de4..58aeed46d7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenFluidCanning.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenFluidCanning.java @@ -39,7 +39,7 @@ public class RecipeGenFluidCanning implements Runnable { private static boolean mHasRun = false; - private static HashSet<RecipeGenFluidCanning> mCache = new HashSet<>(); + private static final HashSet<RecipeGenFluidCanning> mCache = new HashSet<>(); private static void addRunnableToRecipeCache(RecipeGenFluidCanning r) { if (mHasRun) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenMaterialProcessing.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenMaterialProcessing.java index 352217ff95..31d097ab71 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenMaterialProcessing.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenMaterialProcessing.java @@ -76,9 +76,9 @@ public class RecipeGenMaterialProcessing extends RecipeGenBase { */ // Process Dust - if (componentMap.size() > 0 && componentMap.size() <= 6) { - ItemStack mInternalOutputs[] = new ItemStack[6]; - int mChances[] = new int[6]; + if (!componentMap.isEmpty() && componentMap.size() <= 6) { + ItemStack[] mInternalOutputs = new ItemStack[6]; + int[] mChances = new int[6]; int mCellCount = 0; int mTotalCount = 0; @@ -168,9 +168,7 @@ public class RecipeGenMaterialProcessing extends RecipeGenBase { internalOutputs.removeIf(Objects::isNull); int[] chances = new int[internalOutputs.size()]; - for (int i = 0; i < internalOutputs.size(); i++) { - chances[i] = mChances[i]; - } + System.arraycopy(mChances, 0, chances, 0, internalOutputs.size()); ItemStack[] inputs; if (emptyCell == null) { @@ -195,8 +193,8 @@ public class RecipeGenMaterialProcessing extends RecipeGenBase { "[Issue][Electrolyzer] " + material.getLocalizedName() + " is composed of over 6 materials, so an electrolyzer recipe for processing cannot be generated. Trying to create one for the Dehydrator instead."); - ItemStack mInternalOutputs[] = new ItemStack[9]; - int mChances[] = new int[9]; + ItemStack[] mInternalOutputs = new ItemStack[9]; + int[] mChances = new int[9]; int mCellCount = 0; int mTotalCount = 0; @@ -284,9 +282,7 @@ public class RecipeGenMaterialProcessing extends RecipeGenBase { List<ItemStack> internalOutputs = new ArrayList<>(Arrays.asList(mInternalOutputs)); internalOutputs.removeIf(Objects::isNull); int[] chances = new int[internalOutputs.size()]; - for (int i = 0; i < internalOutputs.size(); i++) { - chances[i] = mChances[i]; - } + System.arraycopy(mChances, 0, chances, 0, internalOutputs.size()); ItemStack[] inputs; if (emptyCell == null) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenOre.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenOre.java index c8c1d28547..eb3d27e009 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenOre.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenOre.java @@ -74,8 +74,8 @@ public class RecipeGenOre extends RecipeGenBase { Material bonusA = null; // Ni Material bonusB = null; // Tin - if (material.getComposites() - .size() >= 1 + if (!material.getComposites() + .isEmpty() && material.getComposites() .get(0) != null) { bonusA = material.getComposites() @@ -89,9 +89,7 @@ public class RecipeGenOre extends RecipeGenBase { // Setup Bonuses ArrayList<Material> aMatComp = new ArrayList<>(); - for (Material j : MaterialUtils.getCompoundMaterialsRecursively(material)) { - aMatComp.add(j); - } + aMatComp.addAll(MaterialUtils.getCompoundMaterialsRecursively(material)); if (aMatComp.size() < 3) { while (aMatComp.size() < 3) { @@ -374,10 +372,10 @@ public class RecipeGenOre extends RecipeGenBase { if (!disableOptional) { // Process Dust - if (componentMap.size() > 0 && componentMap.size() <= 6) { + if (!componentMap.isEmpty() && componentMap.size() <= 6) { - ItemStack mInternalOutputs[] = new ItemStack[6]; - int mChances[] = new int[6]; + ItemStack[] mInternalOutputs = new ItemStack[6]; + int[] mChances = new int[6]; int mCellCount = 0; int mTotalCount = 0; @@ -466,9 +464,7 @@ public class RecipeGenOre extends RecipeGenBase { List<ItemStack> internalOutputs = new ArrayList<>(Arrays.asList(mInternalOutputs)); internalOutputs.removeIf(Objects::isNull); int[] chances = new int[internalOutputs.size()]; - for (int i = 0; i < internalOutputs.size(); i++) { - chances[i] = mChances[i]; - } + System.arraycopy(mChances, 0, chances, 0, internalOutputs.size()); ItemStack[] inputs; if (emptyCell == null) { inputs = new ItemStack[] { mainDust }; @@ -490,8 +486,8 @@ public class RecipeGenOre extends RecipeGenBase { "[Issue][Electrolyzer] " + material.getLocalizedName() + " is composed of over 6 materials, so an electrolyzer recipe for processing cannot be generated. Trying to create one for the Dehydrator instead."); - ItemStack mInternalOutputs[] = new ItemStack[9]; - int mChances[] = new int[9]; + ItemStack[] mInternalOutputs = new ItemStack[9]; + int[] mChances = new int[9]; int mCellCount = 0; int mTotalCount = 0; @@ -582,9 +578,7 @@ public class RecipeGenOre extends RecipeGenBase { List<ItemStack> internalOutputs = new ArrayList<>(Arrays.asList(mInternalOutputs)); internalOutputs.removeIf(Objects::isNull); int[] chances = new int[internalOutputs.size()]; - for (int i = 0; i < internalOutputs.size(); i++) { - chances[i] = mChances[i]; - } + System.arraycopy(mChances, 0, chances, 0, internalOutputs.size()); ItemStack[] inputs; if (emptyCell == null) { @@ -607,8 +601,7 @@ public class RecipeGenOre extends RecipeGenBase { + " x" + mainDust.stackSize + ", " - + (emptyCell == null ? "No Cells" - : "" + emptyCell.getDisplayName() + " x" + emptyCell.stackSize)); + + (emptyCell == null ? "No Cells" : emptyCell.getDisplayName() + " x" + emptyCell.stackSize)); Logger.MATERIALS("Outputs " + ItemUtils.getArrayStackNames(mInternalOutputs)); Logger.MATERIALS("Time: " + ((int) Math.max(material.getMass() * 4L * 1, 1))); Logger.MATERIALS("EU: " + tVoltageMultiplier); @@ -654,7 +647,6 @@ public class RecipeGenOre extends RecipeGenBase { null, matDust); - final ItemStack normalDust = matDust; final ItemStack smallDust = material.getSmallDust(1); final ItemStack tinyDust = material.getTinyDust(1); @@ -668,28 +660,28 @@ public class RecipeGenOre extends RecipeGenBase { tinyDust, tinyDust, tinyDust, - normalDust)) { + matDust)) { Logger.WARNING("9 Tiny dust to 1 Dust Recipe: " + material.getLocalizedName() + " - Success"); } else { Logger.WARNING("9 Tiny dust to 1 Dust Recipe: " + material.getLocalizedName() + " - Failed"); } if (RecipeUtils - .addShapedRecipe(normalDust, null, null, null, null, null, null, null, null, material.getTinyDust(9))) { + .addShapedRecipe(matDust, null, null, null, null, null, null, null, null, material.getTinyDust(9))) { Logger.WARNING("9 Tiny dust from 1 Recipe: " + material.getLocalizedName() + " - Success"); } else { Logger.WARNING("9 Tiny dust from 1 Recipe: " + material.getLocalizedName() + " - Failed"); } if (RecipeUtils - .addShapedRecipe(smallDust, smallDust, null, smallDust, smallDust, null, null, null, null, normalDust)) { + .addShapedRecipe(smallDust, smallDust, null, smallDust, smallDust, null, null, null, null, matDust)) { Logger.WARNING("4 Small dust to 1 Dust Recipe: " + material.getLocalizedName() + " - Success"); } else { Logger.WARNING("4 Small dust to 1 Dust Recipe: " + material.getLocalizedName() + " - Failed"); } if (RecipeUtils - .addShapedRecipe(null, normalDust, null, null, null, null, null, null, null, material.getSmallDust(4))) { + .addShapedRecipe(null, matDust, null, null, null, null, null, null, null, material.getSmallDust(4))) { Logger.WARNING("4 Small dust from 1 Dust Recipe: " + material.getLocalizedName() + " - Success"); } else { Logger.WARNING("4 Small dust from 1 Dust Recipe: " + material.getLocalizedName() + " - Failed"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenRecycling.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenRecycling.java index 63812e2e6e..68011ace71 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenRecycling.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenRecycling.java @@ -86,7 +86,7 @@ public class RecipeGenRecycling implements Runnable { .getDisplayName()); validCounter++; } - Pair<OrePrefixes, ItemStack> temp3[] = new Pair[validCounter]; + Pair<OrePrefixes, ItemStack>[] temp3 = new Pair[validCounter]; int temp4 = 0; for (Pair<OrePrefixes, ItemStack> r : mValidPairs) { if (r == null) { @@ -250,8 +250,10 @@ public class RecipeGenRecycling implements Runnable { } return GTUtility.copyAmount( aAmount, - new Object[] { GTOreDictUnificator.getName2StackMap() - .get(aName.toString()), getFirstOre(aName, aAmount), aReplacement }); + GTOreDictUnificator.getName2StackMap() + .get(aName.toString()), + getFirstOre(aName, aAmount), + aReplacement); } public static ItemStack getFirstOre(final Object aName, final long aAmount) { @@ -320,7 +322,6 @@ public class RecipeGenRecycling implements Runnable { } public static ItemStack getItemStackOfAmountFromOreDict(String oredictName, final int amount) { - String mTemp = oredictName; // Banned Materials and replacements for GT5.8 compat. @@ -329,7 +330,7 @@ public class RecipeGenRecycling implements Runnable { return ItemUtils.getSimpleStack(Items.clay_ball, amount); } - final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(mTemp); + final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); if (!oreDictList.isEmpty()) { final ItemStack returnValue = oreDictList.get(0) .copy(); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenShapedCrafting.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenShapedCrafting.java index 97445915f2..3fd856e801 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenShapedCrafting.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenShapedCrafting.java @@ -37,8 +37,7 @@ public class RecipeGenShapedCrafting extends RecipeGenBase { if (material.getPlate(1) != null && material.getIngot(1) != null) GTModHandler.addCraftingRecipe( material.getPlate(1), GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, - new Object[] { "h", "B", "I", Character.valueOf('I'), material.getIngot(1), Character.valueOf('B'), - material.getIngot(1) }); + new Object[] { "h", "B", "I", 'I', material.getIngot(1), 'B', material.getIngot(1) }); if (ItemUtils.checkForInvalidItems(material.getPlate(1)) && ItemUtils.checkForInvalidItems(material.getIngot(1))) @@ -53,8 +52,7 @@ public class RecipeGenShapedCrafting extends RecipeGenBase { GTModHandler.addCraftingRecipe( material.getPlateDouble(1), GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, - new Object[] { "I", "B", "h", Character.valueOf('I'), material.getPlate(1), Character.valueOf('B'), - material.getPlate(1) }); + new Object[] { "I", "B", "h", 'I', material.getPlate(1), 'B', material.getPlate(1) }); if (ItemUtils.checkForInvalidItems(material.getPlateDouble(1)) && ItemUtils.checkForInvalidItems(material.getPlate(1))) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoaderAlgaeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoaderAlgaeFarm.java index 4689bb5042..0ec27e6cee 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoaderAlgaeFarm.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoaderAlgaeFarm.java @@ -95,7 +95,7 @@ public class RecipeLoaderAlgaeFarm { false, aInputs, aOutputs, - (Object) null, + null, new int[] {}, new FluidStack[] { GTValues.NF }, new FluidStack[] { GTValues.NF }, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechBufferDynamos.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechBufferDynamos.java index 9e2e29a7fc..948a918071 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechBufferDynamos.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechBufferDynamos.java @@ -91,47 +91,47 @@ public class GregtechBufferDynamos { GregtechItemList.Hatch_Buffer_Dynamo_ULV.get(1L), bitsd, new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_ULV, 'T', CI.getTieredCircuit(0), 'C', - OrePrefixes.cableGt04.get((Object) Materials.Lead) }); + OrePrefixes.cableGt04.get(Materials.Lead) }); GTModHandler.addCraftingRecipe( GregtechItemList.Hatch_Buffer_Dynamo_LV.get(1L), bitsd, new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_LV, 'T', CI.getTieredCircuit(1), 'C', - OrePrefixes.cableGt04.get((Object) Materials.Tin) }); + OrePrefixes.cableGt04.get(Materials.Tin) }); GTModHandler.addCraftingRecipe( GregtechItemList.Hatch_Buffer_Dynamo_MV.get(1L), bitsd, new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_MV, 'T', CI.getTieredCircuit(2), 'C', - OrePrefixes.cableGt04.get((Object) Materials.AnyCopper) }); + OrePrefixes.cableGt04.get(Materials.AnyCopper) }); GTModHandler.addCraftingRecipe( GregtechItemList.Hatch_Buffer_Dynamo_HV.get(1L), bitsd, new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_HV, 'T', CI.getTieredCircuit(3), 'C', - OrePrefixes.cableGt04.get((Object) Materials.Gold) }); + OrePrefixes.cableGt04.get(Materials.Gold) }); GTModHandler.addCraftingRecipe( GregtechItemList.Hatch_Buffer_Dynamo_EV.get(1L), bitsd, new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_EV, 'T', CI.getTieredCircuit(4), 'C', - OrePrefixes.cableGt04.get((Object) Materials.Aluminium) }); + OrePrefixes.cableGt04.get(Materials.Aluminium) }); GTModHandler.addCraftingRecipe( GregtechItemList.Hatch_Buffer_Dynamo_IV.get(1L), bitsd, new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_IV, 'T', CI.getTieredCircuit(5), 'C', - OrePrefixes.cableGt04.get((Object) Materials.Tungsten) }); + OrePrefixes.cableGt04.get(Materials.Tungsten) }); GTModHandler.addCraftingRecipe( GregtechItemList.Hatch_Buffer_Dynamo_LuV.get(1L), bitsd, new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_LuV, 'T', CI.getTieredCircuit(6), 'C', - OrePrefixes.cableGt04.get((Object) Materials.VanadiumGallium) }); + OrePrefixes.cableGt04.get(Materials.VanadiumGallium) }); GTModHandler.addCraftingRecipe( GregtechItemList.Hatch_Buffer_Dynamo_ZPM.get(1L), bitsd, new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_ZPM, 'T', CI.getTieredCircuit(7), 'C', - OrePrefixes.cableGt04.get((Object) Materials.Naquadah) }); + OrePrefixes.cableGt04.get(Materials.Naquadah) }); GTModHandler.addCraftingRecipe( GregtechItemList.Hatch_Buffer_Dynamo_UV.get(1L), bitsd, new Object[] { "TMC", 'M', ItemList.Hatch_Dynamo_UV, 'T', CI.getTieredCircuit(8), 'C', - OrePrefixes.wireGt12.get((Object) Materials.NaquadahAlloy) }); + OrePrefixes.wireGt12.get(Materials.NaquadahAlloy) }); GTModHandler.addCraftingRecipe( GregtechItemList.Hatch_Buffer_Dynamo_MAX.get(1L), bitsd, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java index b331479028..c65d4109ee 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java @@ -743,23 +743,23 @@ public class GregtechConduits { Logger.WARNING( "Generated pipeTiny from " + materialName + "? " - + ((ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Tiny" + output, 1) != null) ? true : false)); + + (ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Tiny" + output, 1) != null)); Logger.WARNING( "Generated pipeSmall from " + materialName + "? " - + ((ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Small" + output, 1) != null) ? true : false)); + + (ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Small" + output, 1) != null)); Logger.WARNING( "Generated pipeNormal from " + materialName + "? " - + ((ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Medium" + output, 1) != null) ? true : false)); + + (ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Medium" + output, 1) != null)); Logger.WARNING( "Generated pipeLarge from " + materialName + "? " - + ((ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Large" + output, 1) != null) ? true : false)); + + (ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Large" + output, 1) != null)); Logger.WARNING( "Generated pipeHuge from " + materialName + "? " - + ((ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Huge" + output, 1) != null) ? true : false)); + + (ItemUtils.getItemStackOfAmountFromOreDict("pipe" + "Huge" + output, 1) != null)); int eut = (int) (8 * vMulti); @@ -877,8 +877,7 @@ public class GregtechConduits { String tName = aName.toString(); if (GTUtility.isStringInvalid(tName)) return false; ArrayList<ItemStack> tList = GTOreDictUnificator.getOres(tName); - for (ItemStack itemStack : tList) - if (GTUtility.areStacksEqual((ItemStack) itemStack, aStack, true)) return false; + for (ItemStack itemStack : tList) if (GTUtility.areStacksEqual(itemStack, aStack, true)) return false; OreDictionary.registerOre(tName, GTUtility.copyAmount(1L, new Object[] { aStack })); return true; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java index 6dd9c7170c..a6c3b51673 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java @@ -110,70 +110,70 @@ public class GregtechEnergyBuffer { 1).getStackForm(1L)); GTModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_ULV.get(1L, new Object[0]), + GregtechItemList.Energy_Buffer_1by1_ULV.get(1L), GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.NOT_REMOVABLE | GTModHandler.RecipeBits.REVERSIBLE | GTModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", 'M', ItemList.Hull_ULV, 'W', OrePrefixes.wireGt08.get(Materials.Lead), 'T', GregtechOreDictNames.buffer_core }); GTModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_LV.get(1L, new Object[0]), + GregtechItemList.Energy_Buffer_1by1_LV.get(1L), GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.NOT_REMOVABLE | GTModHandler.RecipeBits.REVERSIBLE | GTModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", 'M', ItemList.Hull_LV, 'W', OrePrefixes.wireGt08.get(Materials.Tin), 'T', GregtechOreDictNames.buffer_core }); GTModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_MV.get(1L, new Object[0]), + GregtechItemList.Energy_Buffer_1by1_MV.get(1L), GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.NOT_REMOVABLE | GTModHandler.RecipeBits.REVERSIBLE | GTModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", 'M', ItemList.Hull_MV, 'W', OrePrefixes.wireGt08.get(Materials.AnyCopper), 'T', GregtechOreDictNames.buffer_core }); GTModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_HV.get(1L, new Object[0]), + GregtechItemList.Energy_Buffer_1by1_HV.get(1L), GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.NOT_REMOVABLE | GTModHandler.RecipeBits.REVERSIBLE | GTModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", 'M', ItemList.Hull_HV, 'W', OrePrefixes.wireGt08.get(Materials.Gold), 'T', GregtechOreDictNames.buffer_core }); GTModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_EV.get(1L, new Object[0]), + GregtechItemList.Energy_Buffer_1by1_EV.get(1L), GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.NOT_REMOVABLE | GTModHandler.RecipeBits.REVERSIBLE | GTModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", 'M', ItemList.Hull_EV, 'W', OrePrefixes.wireGt08.get(Materials.Aluminium), 'T', GregtechOreDictNames.buffer_core }); GTModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_IV.get(1L, new Object[0]), + GregtechItemList.Energy_Buffer_1by1_IV.get(1L), GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.NOT_REMOVABLE | GTModHandler.RecipeBits.REVERSIBLE | GTModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", 'M', ItemList.Hull_IV, 'W', OrePrefixes.wireGt08.get(Materials.Tungsten), 'T', GregtechOreDictNames.buffer_core }); GTModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_LuV.get(1L, new Object[0]), + GregtechItemList.Energy_Buffer_1by1_LuV.get(1L), GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.NOT_REMOVABLE | GTModHandler.RecipeBits.REVERSIBLE | GTModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", 'M', ItemList.Hull_LuV, 'W', OrePrefixes.wireGt08.get(Materials.Osmium), 'T', GregtechOreDictNames.buffer_core }); GTModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_ZPM.get(1L, new Object[0]), + GregtechItemList.Energy_Buffer_1by1_ZPM.get(1L), GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.NOT_REMOVABLE | GTModHandler.RecipeBits.REVERSIBLE | GTModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", 'M', ItemList.Hull_ZPM, 'W', OrePrefixes.wireGt08.get(Materials.Osmium), 'T', GregtechOreDictNames.buffer_core }); GTModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_UV.get(1L, new Object[0]), + GregtechItemList.Energy_Buffer_1by1_UV.get(1L), GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.NOT_REMOVABLE | GTModHandler.RecipeBits.REVERSIBLE | GTModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", 'M', ItemList.Hull_UV, 'W', OrePrefixes.wireGt08.get(Materials.Osmium), 'T', GregtechOreDictNames.buffer_core }); GTModHandler.addCraftingRecipe( - GregtechItemList.Energy_Buffer_1by1_MAX.get(1L, new Object[0]), + GregtechItemList.Energy_Buffer_1by1_MAX.get(1L), GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.NOT_REMOVABLE | GTModHandler.RecipeBits.REVERSIBLE | GTModHandler.RecipeBits.BUFFERED, |