diff --git a/src/main/java/cofh/api/energy/TileEnergyHandler.java b/src/main/java/cofh/api/energy/TileEnergyHandler.java index a7fabeb77..86436b014 100644 --- a/src/main/java/cofh/api/energy/TileEnergyHandler.java +++ b/src/main/java/cofh/api/energy/TileEnergyHandler.java @@ -12,7 +12,7 @@ import net.minecraftforge.common.util.ForgeDirection; */ public class TileEnergyHandler extends TileEntity implements IEnergyHandler { - protected EnergyStorage storage = new EnergyStorage(32000); + protected final EnergyStorage storage = new EnergyStorage(32000); @Override public void readFromNBT(NBTTagCompound nbt) { diff --git a/src/main/java/forestry/apiculture/BeekeepingLogic.java b/src/main/java/forestry/apiculture/BeekeepingLogic.java index a8c8fc21d..fa1c70e86 100755 --- a/src/main/java/forestry/apiculture/BeekeepingLogic.java +++ b/src/main/java/forestry/apiculture/BeekeepingLogic.java @@ -32,7 +32,7 @@ import forestry.plugins.PluginApiculture; public class BeekeepingLogic implements IBeekeepingLogic { private static final int MAX_POLLINATION_ATTEMPTS = 20; - IBeeHousing housing; + private final IBeeHousing housing; // Breeding private int breedingTime; private final int totalBreedingTime = Defaults.APIARY_BREEDING_TIME; diff --git a/src/main/java/forestry/apiculture/VillageHandlerApiculture.java b/src/main/java/forestry/apiculture/VillageHandlerApiculture.java index 584dd81da..c592a3229 100755 --- a/src/main/java/forestry/apiculture/VillageHandlerApiculture.java +++ b/src/main/java/forestry/apiculture/VillageHandlerApiculture.java @@ -59,7 +59,7 @@ public class VillageHandlerApiculture implements IVillageCreationHandler, IVilla @Override public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int size) { - return new StructureVillagePieces.PieceWeight(ComponentVillageBeeHouse.class, 15, MathHelper.getRandomIntegerInRange(random, 0 + size, 1 + size)); + return new StructureVillagePieces.PieceWeight(ComponentVillageBeeHouse.class, 15, MathHelper.getRandomIntegerInRange(random, size, 1 + size)); } @Override diff --git a/src/main/java/forestry/apiculture/commands/CommandBeekeepingGiveBee.java b/src/main/java/forestry/apiculture/commands/CommandBeekeepingGiveBee.java index 90774095d..4c94c1db9 100644 --- a/src/main/java/forestry/apiculture/commands/CommandBeekeepingGiveBee.java +++ b/src/main/java/forestry/apiculture/commands/CommandBeekeepingGiveBee.java @@ -31,8 +31,8 @@ import java.util.List; public class CommandBeekeepingGiveBee extends SubCommand { - private String beeTypeHelpString; - private String[] beeTypeArr; + private final String beeTypeHelpString; + private final String[] beeTypeArr; public CommandBeekeepingGiveBee() { super("give"); diff --git a/src/main/java/forestry/apiculture/commands/CommandBeekeepingModeInfo.java b/src/main/java/forestry/apiculture/commands/CommandBeekeepingModeInfo.java index 92e9efcfe..dce83b61b 100644 --- a/src/main/java/forestry/apiculture/commands/CommandBeekeepingModeInfo.java +++ b/src/main/java/forestry/apiculture/commands/CommandBeekeepingModeInfo.java @@ -25,8 +25,8 @@ import java.util.List; public class CommandBeekeepingModeInfo extends SubCommand { - private String[] modeStringArr; - private String helpString; + private final String[] modeStringArr; + private final String helpString; public CommandBeekeepingModeInfo() { super("info"); diff --git a/src/main/java/forestry/apiculture/commands/CommandBeekeepingModeSet.java b/src/main/java/forestry/apiculture/commands/CommandBeekeepingModeSet.java index 450e571d2..13aa6bb34 100644 --- a/src/main/java/forestry/apiculture/commands/CommandBeekeepingModeSet.java +++ b/src/main/java/forestry/apiculture/commands/CommandBeekeepingModeSet.java @@ -21,7 +21,7 @@ import java.util.ArrayList; import java.util.List; public class CommandBeekeepingModeSet extends SubCommand { - private String[] modeStringArr; + private final String[] modeStringArr; public CommandBeekeepingModeSet() { super("set"); diff --git a/src/main/java/forestry/apiculture/gadgets/StructureLogicAlveary.java b/src/main/java/forestry/apiculture/gadgets/StructureLogicAlveary.java index db5306048..57846bbb0 100755 --- a/src/main/java/forestry/apiculture/gadgets/StructureLogicAlveary.java +++ b/src/main/java/forestry/apiculture/gadgets/StructureLogicAlveary.java @@ -40,7 +40,7 @@ public class StructureLogicAlveary extends StructureLogic { slabBlocks.add(ForestryBlock.slabs1.block()); slabBlocks.add(ForestryBlock.slabs2.block()); slabBlocks.add(ForestryBlock.slabs3.block()); - if (ForestryBlock.slabs4 != null) + if (ForestryBlock.slabs4.block() != null) slabBlocks.add(ForestryBlock.slabs4.block()); } diff --git a/src/main/java/forestry/apiculture/gadgets/TileAlveary.java b/src/main/java/forestry/apiculture/gadgets/TileAlveary.java index 49bd13ef5..a4a28c98e 100755 --- a/src/main/java/forestry/apiculture/gadgets/TileAlveary.java +++ b/src/main/java/forestry/apiculture/gadgets/TileAlveary.java @@ -36,6 +36,11 @@ import java.util.LinkedList; public abstract class TileAlveary extends TileForestry implements IAlvearyComponent { + private final IStructureLogic structureLogic; + private boolean isMaster; + protected int masterX, masterZ; + protected int masterY = -99; + protected TileInventoryAdapter inventory; protected final int componentBlockMeta; @@ -126,11 +131,6 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon } /* ITILESTRUCTURE */ - IStructureLogic structureLogic; - - private boolean isMaster; - protected int masterX, masterZ; - protected int masterY = -99; @Override public String getTypeUID() { diff --git a/src/main/java/forestry/apiculture/gadgets/TileAlvearyClimatiser.java b/src/main/java/forestry/apiculture/gadgets/TileAlvearyClimatiser.java index d5890a940..a6a487c0e 100755 --- a/src/main/java/forestry/apiculture/gadgets/TileAlvearyClimatiser.java +++ b/src/main/java/forestry/apiculture/gadgets/TileAlvearyClimatiser.java @@ -32,8 +32,8 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner this.boundaryUp = boundaryUp; } } - protected EnergyManager energyManager; - ClimateControl climateControl; + protected final EnergyManager energyManager; + private final ClimateControl climateControl; private int transferTime = 0; private int animationDelay = 0; private final int textureOff; diff --git a/src/main/java/forestry/apiculture/gadgets/TileAlvearyHygroregulator.java b/src/main/java/forestry/apiculture/gadgets/TileAlvearyHygroregulator.java index a12b5af36..64f6aa013 100755 --- a/src/main/java/forestry/apiculture/gadgets/TileAlvearyHygroregulator.java +++ b/src/main/java/forestry/apiculture/gadgets/TileAlvearyHygroregulator.java @@ -59,9 +59,9 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory private final HygroregulatorRecipe[] recipes; /* MEMBERS */ - InventoryAdapter canInventory = new InventoryAdapter(1, "CanInv"); + private final InventoryAdapter canInventory = new InventoryAdapter(1, "CanInv"); private final TankManager tankManager; - private FilteredTank liquidTank; + private final FilteredTank liquidTank; private HygroregulatorRecipe currentRecipe; private int transferTime; diff --git a/src/main/java/forestry/apiculture/gadgets/TileAlvearySieve.java b/src/main/java/forestry/apiculture/gadgets/TileAlvearySieve.java index 59108854a..d5d21d206 100755 --- a/src/main/java/forestry/apiculture/gadgets/TileAlvearySieve.java +++ b/src/main/java/forestry/apiculture/gadgets/TileAlvearySieve.java @@ -34,7 +34,7 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe public static final int SLOTS_POLLEN_COUNT = 4; public static final int SLOT_SIEVE = 4; - InventoryAdapter inventory = new InventoryAdapter(5, "Items", 1); + private final InventoryAdapter inventory = new InventoryAdapter(5, "Items", 1); public TileAlvearySieve() { super(BLOCK_META); diff --git a/src/main/java/forestry/apiculture/gadgets/TileBeehouse.java b/src/main/java/forestry/apiculture/gadgets/TileBeehouse.java index de5a90c9b..d343f4a03 100755 --- a/src/main/java/forestry/apiculture/gadgets/TileBeehouse.java +++ b/src/main/java/forestry/apiculture/gadgets/TileBeehouse.java @@ -39,7 +39,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; -import net.minecraftforge.common.BiomeDictionary; public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised { @@ -47,15 +46,16 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised { public static final int SLOT_QUEEN = 0; public static final int SLOT_DRONE = 1; public static final int SLOT_INVENTORY_1 = 2; - protected static int SLOT_PRODUCT_1 = 2; - protected static int SLOT_PRODUCT_COUNT = 7; + public static final int SLOT_PRODUCT_1 = 2; + public static final int SLOT_PRODUCT_COUNT = 7; public static final int SLOT_FRAMES_1 = 9; public static final int SLOT_FRAMES_2 = 10; public static final int SLOT_FRAMES_3 = 11; public static final int SLOT_INVENTORY_COUNT = 7; public static final int SLOT_FRAMES_COUNT = 3; + // Inventory - protected InventoryAdapter inventory = new InventoryAdapter(12, "Items"); + protected final InventoryAdapter inventory = new InventoryAdapter(12, "Items"); private final IBeekeepingLogic logic; private BiomeGenBase biome; private int displayHealthMax = 0; diff --git a/src/main/java/forestry/apiculture/gadgets/TileSwarm.java b/src/main/java/forestry/apiculture/gadgets/TileSwarm.java index 9485739c2..509566fe9 100755 --- a/src/main/java/forestry/apiculture/gadgets/TileSwarm.java +++ b/src/main/java/forestry/apiculture/gadgets/TileSwarm.java @@ -18,7 +18,7 @@ import forestry.core.utils.InventoryAdapter; public class TileSwarm extends TileEntity { - public InventoryAdapter contained = new InventoryAdapter(2, "Contained"); + public final InventoryAdapter contained = new InventoryAdapter(2, "Contained"); @Override public boolean canUpdate() { diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectAggressive.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectAggressive.java index 7ed997d76..ecfd9b7c3 100755 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectAggressive.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectAggressive.java @@ -25,7 +25,7 @@ import forestry.core.utils.DamageSourceForestry; public class AlleleEffectAggressive extends AlleleEffectThrottled { - public static DamageSource damageSourceBeeAggressive = new DamageSourceForestry("bee.aggressive"); + public static final DamageSource damageSourceBeeAggressive = new DamageSourceForestry("bee.aggressive"); public AlleleEffectAggressive(String uid) { super(uid, "aggressive", true, 40, false, false); diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectCreeper.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectCreeper.java index 4cc0d65ce..f3b932bf2 100755 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectCreeper.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectCreeper.java @@ -25,9 +25,9 @@ import forestry.core.genetics.EffectData; public class AlleleEffectCreeper extends AlleleEffectThrottled { private final int explosionChance = 50; - byte defaultForce = 12; - byte indexExplosionTimer = 1; - byte indexExplosionForce = 2; + private final byte defaultForce = 12; + private final byte indexExplosionTimer = 1; + private final byte indexExplosionForce = 2; public AlleleEffectCreeper(String uid) { super(uid, "creeper", true, 20, false, true); diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectIgnition.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectIgnition.java index 25dbbca5c..b834d766f 100755 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectIgnition.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectIgnition.java @@ -25,8 +25,8 @@ import forestry.plugins.PluginApiculture; public class AlleleEffectIgnition extends AlleleEffectThrottled { - int ignitionChance = 50; - int fireDuration = 500; + private final int ignitionChance = 50; + private final int fireDuration = 500; public AlleleEffectIgnition(String uid) { super(uid, "ignition", false, 20, false, true); diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectMisanthrope.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectMisanthrope.java index 8c9e34656..9599517b5 100755 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectMisanthrope.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectMisanthrope.java @@ -24,7 +24,7 @@ import forestry.core.utils.DamageSourceForestry; public class AlleleEffectMisanthrope extends AlleleEffectThrottled { - public static DamageSource damageSourceBeeEnd = new DamageSourceForestry("bee.end"); + public static final DamageSource damageSourceBeeEnd = new DamageSourceForestry("bee.end"); public AlleleEffectMisanthrope(String uid) { super(uid, "misanthrope", true, 20, false, false); diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectRadioactive.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectRadioactive.java index 30447af0f..fb7601ad9 100755 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectRadioactive.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectRadioactive.java @@ -32,7 +32,7 @@ import forestry.core.utils.Vect; public class AlleleEffectRadioactive extends AlleleEffectThrottled { - public static DamageSource damageSourceBeeRadioactive = new DamageSourceForestry("bee.radioactive"); + public static final DamageSource damageSourceBeeRadioactive = new DamageSourceForestry("bee.radioactive"); public AlleleEffectRadioactive(String uid) { super(uid, "radioactive", true, 40, false, true); diff --git a/src/main/java/forestry/apiculture/genetics/AlleleFlowers.java b/src/main/java/forestry/apiculture/genetics/AlleleFlowers.java index 58b63a81e..e8c28c576 100755 --- a/src/main/java/forestry/apiculture/genetics/AlleleFlowers.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleFlowers.java @@ -16,7 +16,7 @@ import forestry.core.genetics.Allele; public class AlleleFlowers extends Allele implements IAlleleFlowers { - IFlowerProvider provider; + private final IFlowerProvider provider; public AlleleFlowers(String uid, IFlowerProvider provider) { this(uid, provider, false); diff --git a/src/main/java/forestry/apiculture/genetics/Bee.java b/src/main/java/forestry/apiculture/genetics/Bee.java index cdfb5d460..45e056863 100755 --- a/src/main/java/forestry/apiculture/genetics/Bee.java +++ b/src/main/java/forestry/apiculture/genetics/Bee.java @@ -69,12 +69,6 @@ public class Bee extends IndividualLiving implements IBee { this.isIrregularMating = mate.isNatural() != this.isNatural; } - public Bee(IBeeGenome genome, IBee mate) { - this(genome); - this.mate = mate.getGenome(); - this.isIrregularMating = mate.isNatural() != this.isNatural; - } - public Bee(World world, IBeeGenome genome) { this(world, genome, true, 0); } diff --git a/src/main/java/forestry/apiculture/genetics/BeeHelper.java b/src/main/java/forestry/apiculture/genetics/BeeHelper.java index 84376c5f5..6bc34f5ba 100755 --- a/src/main/java/forestry/apiculture/genetics/BeeHelper.java +++ b/src/main/java/forestry/apiculture/genetics/BeeHelper.java @@ -204,7 +204,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot { } /* TEMPLATES */ - public static ArrayList beeTemplates = new ArrayList(); + public static final ArrayList beeTemplates = new ArrayList(); @Override public ArrayList getIndividualTemplates() { @@ -248,7 +248,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot { } /* BREEDING MODES */ - ArrayList beekeepingModes = new ArrayList(); + final ArrayList beekeepingModes = new ArrayList(); public static IBeekeepingMode activeBeekeepingMode; @Override diff --git a/src/main/java/forestry/apiculture/genetics/BeekeepingMode.java b/src/main/java/forestry/apiculture/genetics/BeekeepingMode.java index e0202d63b..1b928a23e 100755 --- a/src/main/java/forestry/apiculture/genetics/BeekeepingMode.java +++ b/src/main/java/forestry/apiculture/genetics/BeekeepingMode.java @@ -23,11 +23,11 @@ import forestry.api.apiculture.IBeekeepingMode; public class BeekeepingMode implements IBeekeepingMode { - public static IBeekeepingMode easy = new BeekeepingMode("EASY", 2.0f, 1.0f, 1.0f, false, false); - public static IBeekeepingMode normal = new BeekeepingMode("NORMAL", 1.0f, 1.0f, 1.0f, false, true); - public static IBeekeepingMode hard = new BeekeepingMode("HARD", 0.75f, 1.5f, 1.0f, false, true); - public static IBeekeepingMode hardcore = new BeekeepingMode("HARDCORE", 0.5f, 5.0f, 0.8f, true, true); - public static IBeekeepingMode insane = new BeekeepingMode("INSANE", 0.2f, 10.0f, 0.6f, true, true); + public static final IBeekeepingMode easy = new BeekeepingMode("EASY", 2.0f, 1.0f, 1.0f, false, false); + public static final IBeekeepingMode normal = new BeekeepingMode("NORMAL", 1.0f, 1.0f, 1.0f, false, true); + public static final IBeekeepingMode hard = new BeekeepingMode("HARD", 0.75f, 1.5f, 1.0f, false, true); + public static final IBeekeepingMode hardcore = new BeekeepingMode("HARDCORE", 0.5f, 5.0f, 0.8f, true, true); + public static final IBeekeepingMode insane = new BeekeepingMode("INSANE", 0.2f, 10.0f, 0.6f, true, true); final Random rand; final String name; diff --git a/src/main/java/forestry/apiculture/genetics/HiveDrop.java b/src/main/java/forestry/apiculture/genetics/HiveDrop.java index d33fe0712..11c20ea35 100755 --- a/src/main/java/forestry/apiculture/genetics/HiveDrop.java +++ b/src/main/java/forestry/apiculture/genetics/HiveDrop.java @@ -23,9 +23,9 @@ import java.util.Collections; public class HiveDrop implements IHiveDrop { - private IAllele[] template; - private ArrayList additional = new ArrayList(); - private int chance; + private final IAllele[] template; + private final ArrayList additional = new ArrayList(); + private final int chance; private float ignobleShare = 0.0f; public HiveDrop(IAllele[] template, ItemStack[] bonus, int chance) { diff --git a/src/main/java/forestry/apiculture/genetics/MutationEMC.java b/src/main/java/forestry/apiculture/genetics/MutationEMC.java index d699a5fef..1b18779ff 100755 --- a/src/main/java/forestry/apiculture/genetics/MutationEMC.java +++ b/src/main/java/forestry/apiculture/genetics/MutationEMC.java @@ -24,9 +24,9 @@ import forestry.core.utils.Vect; public class MutationEMC extends MutationReqRes { - int emcRequired = 0; - Class condenserClass; - Field emcField; + private final int emcRequired; + private final Class condenserClass; + private final Field emcField; public MutationEMC(IAllele allele0, IAllele allele1, IAllele[] template, int chance, ItemStack blockRequired, Class condenserClass, Field emcField, int emcRequired) { diff --git a/src/main/java/forestry/apiculture/genetics/MutationTimeLimited.java b/src/main/java/forestry/apiculture/genetics/MutationTimeLimited.java index f3d1e1fb9..244c1a07b 100755 --- a/src/main/java/forestry/apiculture/genetics/MutationTimeLimited.java +++ b/src/main/java/forestry/apiculture/genetics/MutationTimeLimited.java @@ -19,12 +19,12 @@ import forestry.api.genetics.IGenome; public class MutationTimeLimited extends BeeMutation { /** - * Fed up with Date and Calendar and their shinenigans + * Fed up with Date and Calendar and their shenanigans */ public static class DayMonth { - public int day; - public int month; + public final int day; + public final int month; public DayMonth() { this.day = Calendar.getInstance().get(Calendar.DAY_OF_MONTH); @@ -93,8 +93,9 @@ public class MutationTimeLimited extends BeeMutation { return day + "." + month; } } - DayMonth start; - DayMonth end; + + private final DayMonth start; + private final DayMonth end; public MutationTimeLimited(IAllele allele0, IAllele allele1, IAllele[] template, int chance, DayMonth start) { this(allele0, allele1, template, chance, start, null); @@ -113,7 +114,7 @@ public class MutationTimeLimited extends BeeMutation { if (chance == 0) return 0; - if (start == null && end == null) + if (start == null) return chance; DayMonth now = new DayMonth(); diff --git a/src/main/java/forestry/apiculture/gui/ContainerAlveary.java b/src/main/java/forestry/apiculture/gui/ContainerAlveary.java index ad04c9e04..6c1d21c4a 100755 --- a/src/main/java/forestry/apiculture/gui/ContainerAlveary.java +++ b/src/main/java/forestry/apiculture/gui/ContainerAlveary.java @@ -22,7 +22,7 @@ import forestry.core.gui.slots.SlotCustom; public class ContainerAlveary extends ContainerForestry { - private TileAlvearyPlain tile; + private final TileAlvearyPlain tile; public ContainerAlveary(InventoryPlayer player, TileAlvearyPlain tile) { super(tile); @@ -31,10 +31,10 @@ public class ContainerAlveary extends ContainerForestry { tile.sendNetworkUpdate(); // Queen/Princess - this.addSlot(new SlotCustom(tile, TileAlvearyPlain.SLOT_QUEEN, 29, 39, new Object[] { ForestryItem.beePrincessGE, ForestryItem.beeQueenGE })); + this.addSlot(new SlotCustom(tile, TileAlvearyPlain.SLOT_QUEEN, 29, 39, ForestryItem.beePrincessGE, ForestryItem.beeQueenGE)); // Drone - this.addSlot(new SlotCustom(tile, TileAlvearyPlain.SLOT_DRONE, 29, 65, new Object[] { ForestryItem.beeDroneGE })); + this.addSlot(new SlotCustom(tile, TileAlvearyPlain.SLOT_DRONE, 29, 65, ForestryItem.beeDroneGE)); // Product Inventory this.addSlot(new SlotClosed(tile, 2, 116, 52)); @@ -62,8 +62,8 @@ public class ContainerAlveary extends ContainerForestry { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) - tile.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) + tile.sendGUINetworkData(this, (ICrafting) crafter); } } diff --git a/src/main/java/forestry/apiculture/gui/ContainerAlvearyHygroregulator.java b/src/main/java/forestry/apiculture/gui/ContainerAlvearyHygroregulator.java index 3f02bc80f..dfe03c829 100755 --- a/src/main/java/forestry/apiculture/gui/ContainerAlvearyHygroregulator.java +++ b/src/main/java/forestry/apiculture/gui/ContainerAlvearyHygroregulator.java @@ -10,17 +10,15 @@ ******************************************************************************/ package forestry.apiculture.gui; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; - import forestry.apiculture.gadgets.TileAlvearyHygroregulator; import forestry.core.gui.ContainerLiquidTanks; import forestry.core.gui.slots.SlotLiquidContainer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; public class ContainerAlvearyHygroregulator extends ContainerLiquidTanks { - TileAlvearyHygroregulator tile; + private final TileAlvearyHygroregulator tile; public ContainerAlvearyHygroregulator(IInventory inventory, TileAlvearyHygroregulator tile) { super(inventory, tile); diff --git a/src/main/java/forestry/apiculture/gui/ContainerAlvearySieve.java b/src/main/java/forestry/apiculture/gui/ContainerAlvearySieve.java index 43b702e73..20eeedf67 100755 --- a/src/main/java/forestry/apiculture/gui/ContainerAlvearySieve.java +++ b/src/main/java/forestry/apiculture/gui/ContainerAlvearySieve.java @@ -22,7 +22,7 @@ import forestry.core.gui.slots.SlotCustom; public class ContainerAlvearySieve extends ContainerForestry { - TileAlvearySieve tile; + private final TileAlvearySieve tile; public ContainerAlvearySieve(InventoryPlayer player, TileAlvearySieve tile) { super(tile.getInternalInventory()); @@ -30,10 +30,10 @@ public class ContainerAlvearySieve extends ContainerForestry { this.tile = tile; IInventory inventory = tile.getInternalInventory(); - addSlot(new SlotCustom(inventory, 0, 94, 52, new Object[0]).setCrafter(tile)); - addSlot(new SlotCustom(inventory, 1, 115, 39, new Object[0]).setCrafter(tile)); - addSlot(new SlotCustom(inventory, 2, 73, 39, new Object[0]).setCrafter(tile)); - addSlot(new SlotCustom(inventory, 3, 94, 26, new Object[0]).setCrafter(tile)); + addSlot(new SlotCustom(inventory, 0, 94, 52).setCrafter(tile)); + addSlot(new SlotCustom(inventory, 1, 115, 39).setCrafter(tile)); + addSlot(new SlotCustom(inventory, 2, 73, 39).setCrafter(tile)); + addSlot(new SlotCustom(inventory, 3, 94, 26).setCrafter(tile)); addSlot(new SlotCustom(inventory, TileAlvearySieve.SLOT_SIEVE, 43, 39, ForestryItem.craftingMaterial.getItemStack(1, 3)).setCrafter(tile)); diff --git a/src/main/java/forestry/apiculture/gui/ContainerApiary.java b/src/main/java/forestry/apiculture/gui/ContainerApiary.java index 4a7d5347c..7a3af8172 100755 --- a/src/main/java/forestry/apiculture/gui/ContainerApiary.java +++ b/src/main/java/forestry/apiculture/gui/ContainerApiary.java @@ -77,8 +77,8 @@ public class ContainerApiary extends ContainerForestry { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - tile.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + tile.sendGUINetworkData(this, (ICrafting) crafter); } } diff --git a/src/main/java/forestry/apiculture/gui/ContainerHabitatLocator.java b/src/main/java/forestry/apiculture/gui/ContainerHabitatLocator.java index 52e2fc4a9..af5b2bbe2 100755 --- a/src/main/java/forestry/apiculture/gui/ContainerHabitatLocator.java +++ b/src/main/java/forestry/apiculture/gui/ContainerHabitatLocator.java @@ -24,7 +24,7 @@ import forestry.core.proxy.Proxies; public class ContainerHabitatLocator extends ContainerItemInventory { - public BiomefinderInventory inventory; + public final BiomefinderInventory inventory; public ContainerHabitatLocator(InventoryPlayer inventoryplayer, BiomefinderInventory inventory) { super(inventory, inventoryplayer.player); @@ -32,12 +32,12 @@ public class ContainerHabitatLocator extends ContainerItemInventory { this.inventory = inventory; // Energy - this.addSlot(new SlotCustom(inventory, 2, 152, 8, new Object[] { ForestryItem.honeydew, ForestryItem.honeyDrop })); + this.addSlot(new SlotCustom(inventory, 2, 152, 8, ForestryItem.honeydew, ForestryItem.honeyDrop)); // Bee to analyze - this.addSlot(new SlotCustom(inventory, 0, 152, 32, new Object[] { ItemBeeGE.class })); + this.addSlot(new SlotCustom(inventory, 0, 152, 32, ItemBeeGE.class)); // Analyzed bee - this.addSlot(new SlotCustom(inventory, 1, 152, 75, new Object[] { ItemBeeGE.class })); + this.addSlot(new SlotCustom(inventory, 1, 152, 75, ItemBeeGE.class)); // Player inventory for (int i1 = 0; i1 < 3; i1++) diff --git a/src/main/java/forestry/apiculture/gui/ContainerImprinter.java b/src/main/java/forestry/apiculture/gui/ContainerImprinter.java index b66ba35a6..1e871c94e 100755 --- a/src/main/java/forestry/apiculture/gui/ContainerImprinter.java +++ b/src/main/java/forestry/apiculture/gui/ContainerImprinter.java @@ -28,17 +28,17 @@ import forestry.core.proxy.Proxies; public class ContainerImprinter extends ContainerForestry implements IGuiSelectable { - public ImprinterInventory inventory; - private boolean isNetSynched = false; + public final ImprinterInventory inventory; + private boolean isNetSynced = false; public ContainerImprinter(InventoryPlayer inventoryplayer, ImprinterInventory inventory) { super(inventory); this.inventory = inventory; // Input - this.addSlot(new SlotCustom(inventory, 0, 152, 12, new Object[] { ItemBeeGE.class })); + this.addSlot(new SlotCustom(inventory, 0, 152, 12, ItemBeeGE.class)); // Output - this.addSlot(new SlotCustom(inventory, 1, 152, 72, new Object[] { ItemBeeGE.class })); + this.addSlot(new SlotCustom(inventory, 1, 152, 72, ItemBeeGE.class)); // Player inventory for (int i1 = 0; i1 < 3; i1++) @@ -84,7 +84,7 @@ public class ContainerImprinter extends ContainerForestry implements IGuiSelecta private void sendSelectionChange(PacketPayload payload) { PacketUpdate packet = new PacketUpdate(PacketIds.GUI_SELECTION_CHANGE, payload); Proxies.net.sendToServer(packet); - isNetSynched = false; + isNetSynced = false; } @Override @@ -94,8 +94,8 @@ public class ContainerImprinter extends ContainerForestry implements IGuiSelecta } public void updateContainer(World world) { - if (!isNetSynched && !Proxies.common.isSimulating(world)) { - isNetSynched = true; + if (!isNetSynced && !Proxies.common.isSimulating(world)) { + isNetSynced = true; Proxies.net.sendToServer(new PacketUpdate(PacketIds.IMPRINT_SELECTION_GET)); } } diff --git a/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java b/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java index fdf5b5184..2c0e012a2 100755 --- a/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java +++ b/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java @@ -140,7 +140,7 @@ public class GuiBeealyzer extends GuiAlyzer { .getArea().toString(), bee, EnumBeeChromosome.TERRITORY); drawRow(StringUtil.localize("gui.effect"), bee.getGenome().getEffect().getName(), - ((IAlleleBeeEffect) bee.getGenome().getInactiveAllele(EnumBeeChromosome.EFFECT.ordinal())).getName(), bee, + bee.getGenome().getInactiveAllele(EnumBeeChromosome.EFFECT.ordinal()).getName(), bee, EnumBeeChromosome.EFFECT); newLine(); diff --git a/src/main/java/forestry/apiculture/items/ItemBeeGE.java b/src/main/java/forestry/apiculture/items/ItemBeeGE.java index b98831192..5f19e8b7f 100755 --- a/src/main/java/forestry/apiculture/items/ItemBeeGE.java +++ b/src/main/java/forestry/apiculture/items/ItemBeeGE.java @@ -39,7 +39,7 @@ import java.util.List; public class ItemBeeGE extends ItemGE { - EnumBeeType type; + private final EnumBeeType type; public ItemBeeGE(EnumBeeType type) { super(); @@ -141,7 +141,7 @@ public class ItemBeeGE extends ItemGE { public int getColourFromSpecies(IAlleleSpecies species, int renderPass) { if (species != null && species instanceof IAlleleBeeSpecies) - return ((IAlleleBeeSpecies) species).getIconColour(renderPass); + return species.getIconColour(renderPass); else return 0xffffff; diff --git a/src/main/java/forestry/apiculture/items/ItemHoneycomb.java b/src/main/java/forestry/apiculture/items/ItemHoneycomb.java index 0f98654db..1c2ba6041 100755 --- a/src/main/java/forestry/apiculture/items/ItemHoneycomb.java +++ b/src/main/java/forestry/apiculture/items/ItemHoneycomb.java @@ -27,9 +27,9 @@ public class ItemHoneycomb extends ItemForestryMultiPass { private static class CombInfo { - public String name; - public int primaryColor; - public int secondaryColor; + public final String name; + public final int primaryColor; + public final int secondaryColor; public boolean isSecret = false; public CombInfo(String name, int primaryColor, int secondaryColor) { @@ -43,7 +43,8 @@ public class ItemHoneycomb extends ItemForestryMultiPass { return this; } } - public CombInfo[] combs = new CombInfo[]{new CombInfo("honey", 0xe8d56a, 0xffa12b), // 0 + public final CombInfo[] combs = new CombInfo[]{ + new CombInfo("honey", 0xe8d56a, 0xffa12b), // 0 new CombInfo("cocoa", 0x674016, 0xffb62b).setIsSecret(), // 1 new CombInfo("simmering", 0x981919, 0xffb62b), // 2 new CombInfo("stringy", 0xc8be67, 0xbda93e), // 3 diff --git a/src/main/java/forestry/apiculture/items/ItemImprinter.java b/src/main/java/forestry/apiculture/items/ItemImprinter.java index e763d17b3..3c61ff934 100755 --- a/src/main/java/forestry/apiculture/items/ItemImprinter.java +++ b/src/main/java/forestry/apiculture/items/ItemImprinter.java @@ -37,7 +37,7 @@ public class ItemImprinter extends ItemForestry { private int primaryIndex = 0; private int secondaryIndex = 0; - EntityPlayer player; + private final EntityPlayer player; public ImprinterInventory(EntityPlayer player) { this.player = player; diff --git a/src/main/java/forestry/apiculture/render/ModelBee.java b/src/main/java/forestry/apiculture/render/ModelBee.java index bda42e419..56ff58961 100755 --- a/src/main/java/forestry/apiculture/render/ModelBee.java +++ b/src/main/java/forestry/apiculture/render/ModelBee.java @@ -22,18 +22,18 @@ import forestry.api.apiculture.EnumBeeType; public class ModelBee extends ModelBase { //fields - ModelRenderer snout; - ModelRenderer torsoWing; - ModelRenderer rump; - ModelRenderer tail; - ModelRenderer tailEnd; - ModelRenderer bridge; - ModelRenderer eyeRight; - ModelRenderer eyeLeft; - ModelRenderer wingLeft; - ModelRenderer wingRight; - ModelRenderer crownQueen; - ModelRenderer crownPrincess; + private final ModelRenderer snout; + private final ModelRenderer torsoWing; + private final ModelRenderer rump; + private final ModelRenderer tail; + private final ModelRenderer tailEnd; + private final ModelRenderer bridge; + private final ModelRenderer eyeRight; + private final ModelRenderer eyeLeft; + private final ModelRenderer wingLeft; + private final ModelRenderer wingRight; + private final ModelRenderer crownQueen; + private final ModelRenderer crownPrincess; EnumBeeType type = EnumBeeType.DRONE; diff --git a/src/main/java/forestry/apiculture/render/RenderBee.java b/src/main/java/forestry/apiculture/render/RenderBee.java index e3248fe1b..61ff1608c 100755 --- a/src/main/java/forestry/apiculture/render/RenderBee.java +++ b/src/main/java/forestry/apiculture/render/RenderBee.java @@ -18,7 +18,7 @@ import forestry.apiculture.entities.EntityBee; public class RenderBee extends RenderLiving { - ModelBee beeModel; + private final ModelBee beeModel; public RenderBee() { super(new ModelBee(), 0.15f); diff --git a/src/main/java/forestry/apiculture/render/TextureBiomefinder.java b/src/main/java/forestry/apiculture/render/TextureBiomefinder.java index 07b71bc73..65c909ef9 100755 --- a/src/main/java/forestry/apiculture/render/TextureBiomefinder.java +++ b/src/main/java/forestry/apiculture/render/TextureBiomefinder.java @@ -42,7 +42,7 @@ public class TextureBiomefinder extends TextureAtlasSprite { if (minecraft.theWorld != null && minecraft.thePlayer != null) updateCompass(minecraft.theWorld, minecraft.thePlayer.posX, minecraft.thePlayer.posZ, minecraft.thePlayer.rotationYaw, false, true); else - updateCompass((World)null, 0.0d, 0.0d, 0.0d, true, true); + updateCompass(null, 0.0d, 0.0d, 0.0d, true, true); } public void updateCompass(World world, double playerX, double playerZ, double playerYaw, boolean par8, boolean hasSpin) { diff --git a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java index 6278b8c04..f3001bb05 100755 --- a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java +++ b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java @@ -45,7 +45,7 @@ import forestry.plugins.PluginApiculture; public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { - protected ItemStack[] buildingBlocks = new ItemStack[]{ForestryBlock.planks1.getItemStack(1, 15), new ItemStack(Blocks.log, 1, 0),}; + protected final ItemStack[] buildingBlocks = new ItemStack[]{ForestryBlock.planks1.getItemStack(1, 15), new ItemStack(Blocks.log, 1, 0),}; protected int averageGroundLevel = -1; protected boolean isInDesert = false; protected boolean hasChest = false; diff --git a/src/main/java/forestry/arboriculture/CommandTreekeepingMode.java b/src/main/java/forestry/arboriculture/CommandTreekeepingMode.java index ccb51a941..d21ca6daa 100755 --- a/src/main/java/forestry/arboriculture/CommandTreekeepingMode.java +++ b/src/main/java/forestry/arboriculture/CommandTreekeepingMode.java @@ -45,7 +45,7 @@ import forestry.plugins.PluginArboriculture; public class CommandTreekeepingMode extends CommandMC { - String[] modeStrings; + private final String[] modeStrings; public CommandTreekeepingMode() { modeStrings = new String[PluginArboriculture.treeInterface.getTreekeepingModes().size()]; diff --git a/src/main/java/forestry/arboriculture/PacketHandlerArboriculture.java b/src/main/java/forestry/arboriculture/PacketHandlerArboriculture.java index 373b52605..9f275d5c2 100755 --- a/src/main/java/forestry/arboriculture/PacketHandlerArboriculture.java +++ b/src/main/java/forestry/arboriculture/PacketHandlerArboriculture.java @@ -43,7 +43,7 @@ public class PacketHandlerArboriculture implements IPacketHandler { private void onLeafUpdate(PacketLeafUpdate packet) { - TileEntity tile = ((ILocatedPacket) packet).getTarget(Proxies.common.getRenderWorld()); + TileEntity tile = packet.getTarget(Proxies.common.getRenderWorld()); if (tile instanceof TileLeaves) ((TileLeaves) tile).fromPacket(packet); diff --git a/src/main/java/forestry/arboriculture/WorldGenHelper.java b/src/main/java/forestry/arboriculture/WorldGenHelper.java deleted file mode 100755 index 0e3f725bc..000000000 --- a/src/main/java/forestry/arboriculture/WorldGenHelper.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v3 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: - * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges - ******************************************************************************/ -package forestry.arboriculture; - -import forestry.api.arboriculture.ITree; -import forestry.api.genetics.IIndividual; -import forestry.api.world.IWorldGenInterface; -import forestry.plugins.PluginArboriculture; -import net.minecraft.world.gen.feature.WorldGenerator; - -import java.util.ArrayList; -import java.util.Collections; - -public class WorldGenHelper implements IWorldGenInterface { - - @SuppressWarnings({"unchecked", "rawtypes"}) - @Override - public Class[] getTreeGenerators(String ident) { - - ArrayList> generators = new ArrayList>(); - for (IIndividual tree : PluginArboriculture.treeInterface.getIndividualTemplates()) - if (tree.getIdent().equals(ident)) - Collections.addAll(generators, ((ITree) tree).getGenome().getPrimary().getGeneratorClasses()); - - return generators.toArray(new Class[generators.size()]); - } - -} diff --git a/src/main/java/forestry/arboriculture/gadgets/BlockFireproofLog.java b/src/main/java/forestry/arboriculture/gadgets/BlockFireproofLog.java index 561969364..45264459f 100644 --- a/src/main/java/forestry/arboriculture/gadgets/BlockFireproofLog.java +++ b/src/main/java/forestry/arboriculture/gadgets/BlockFireproofLog.java @@ -19,7 +19,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class BlockFireproofLog extends BlockLog implements IWoodFireproof { - public static Material fireproofWood = new Material(MapColor.woodColor); + private static final Material fireproofWood = new Material(MapColor.woodColor); public BlockFireproofLog(LogCat cat) { super(cat, fireproofWood); diff --git a/src/main/java/forestry/arboriculture/gadgets/BlockFireproofPlanks.java b/src/main/java/forestry/arboriculture/gadgets/BlockFireproofPlanks.java index 8e71992e8..45b0a66ff 100644 --- a/src/main/java/forestry/arboriculture/gadgets/BlockFireproofPlanks.java +++ b/src/main/java/forestry/arboriculture/gadgets/BlockFireproofPlanks.java @@ -19,7 +19,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class BlockFireproofPlanks extends BlockPlanks implements IWoodFireproof { - public static Material fireproofWood = new Material(MapColor.woodColor); + private static final Material fireproofWood = new Material(MapColor.woodColor); public BlockFireproofPlanks(PlankCat cat) { super(cat, fireproofWood); diff --git a/src/main/java/forestry/arboriculture/genetics/AlleleFruit.java b/src/main/java/forestry/arboriculture/genetics/AlleleFruit.java index 30d1d4c4d..924e03064 100755 --- a/src/main/java/forestry/arboriculture/genetics/AlleleFruit.java +++ b/src/main/java/forestry/arboriculture/genetics/AlleleFruit.java @@ -16,7 +16,7 @@ import forestry.core.genetics.Allele; public class AlleleFruit extends Allele implements IAlleleFruit { - private IFruitProvider provider; + private final IFruitProvider provider; public AlleleFruit(String uid, IFruitProvider provider) { this(uid, provider, false); diff --git a/src/main/java/forestry/arboriculture/genetics/AlleleGrowth.java b/src/main/java/forestry/arboriculture/genetics/AlleleGrowth.java index 8d1439167..c1786011e 100755 --- a/src/main/java/forestry/arboriculture/genetics/AlleleGrowth.java +++ b/src/main/java/forestry/arboriculture/genetics/AlleleGrowth.java @@ -16,7 +16,7 @@ import forestry.core.genetics.Allele; public class AlleleGrowth extends Allele implements IAlleleGrowth { - IGrowthProvider provider; + private final IGrowthProvider provider; public AlleleGrowth(String uid, IGrowthProvider provider) { this(uid, provider, false); diff --git a/src/main/java/forestry/arboriculture/genetics/AlleleLeafEffectNone.java b/src/main/java/forestry/arboriculture/genetics/AlleleLeafEffectNone.java index 0356889b7..8013dc1ae 100755 --- a/src/main/java/forestry/arboriculture/genetics/AlleleLeafEffectNone.java +++ b/src/main/java/forestry/arboriculture/genetics/AlleleLeafEffectNone.java @@ -21,7 +21,7 @@ import forestry.core.utils.Vect; public class AlleleLeafEffectNone extends Allele implements IAlleleLeafEffect { - int[] DEFAULT_EFFECT_AREA = new int[] { 12, 12, 12 }; + private static final int[] DEFAULT_EFFECT_AREA = new int[] { 12, 12, 12 }; public AlleleLeafEffectNone(String uid) { super(uid, true); diff --git a/src/main/java/forestry/arboriculture/genetics/AlleleTreeSpecies.java b/src/main/java/forestry/arboriculture/genetics/AlleleTreeSpecies.java index ef410bfb0..d42d2e990 100755 --- a/src/main/java/forestry/arboriculture/genetics/AlleleTreeSpecies.java +++ b/src/main/java/forestry/arboriculture/genetics/AlleleTreeSpecies.java @@ -60,7 +60,7 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci } } - private static HashMap leafTypes = new HashMap(); + private static final HashMap leafTypes = new HashMap(); static { leafTypes.put("deciduous", new LeafType("deciduous", (short) 10, (short) 11, (short) 12)); leafTypes.put("conifers", new LeafType("conifers", (short) 15, (short) 16, (short) 17)); @@ -175,7 +175,7 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci @SuppressWarnings("rawtypes") public WorldGenerator getGenerator(ITree tree, World world, int x, int y, int z) { try { - return generatorClass.getConstructor(new Class[] { ITreeGenData.class }).newInstance(new Object[] { tree }); + return generatorClass.getConstructor(new Class[] { ITreeGenData.class }).newInstance(tree); } catch (Exception ex) { throw new RuntimeException("Failed to instantiate generator of class " + generatorClass.getName()); } @@ -226,7 +226,7 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci } @SideOnly(Side.CLIENT) - IIcon icon; + private IIcon icon; @Override @SideOnly(Side.CLIENT) diff --git a/src/main/java/forestry/arboriculture/genetics/TreeHelper.java b/src/main/java/forestry/arboriculture/genetics/TreeHelper.java index c417d3002..03150c448 100755 --- a/src/main/java/forestry/arboriculture/genetics/TreeHelper.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeHelper.java @@ -60,16 +60,20 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot { public static final String UID = "rootTrees"; public static int treeSpeciesCount = -1; + public static ITreekeepingMode activeTreekeepingMode; + public static final ArrayList treeTemplates = new ArrayList(); + + private final ArrayList treekeepingModes = new ArrayList(); + + public TreeHelper() { + setResearchSuitability(new ItemStack(Blocks.sapling, 1, Defaults.WILDCARD), 1.0f); + } @Override public String getUID() { return UID; } - public TreeHelper() { - setResearchSuitability(new ItemStack(Blocks.sapling, 1, Defaults.WILDCARD), 1.0f); - } - @Override public Class getMemberClass() { return ITree.class; @@ -290,8 +294,6 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot { } /* BREEDING MODES */ - ArrayList treekeepingModes = new ArrayList(); - public static ITreekeepingMode activeTreekeepingMode; @Override public ArrayList getTreekeepingModes() { @@ -337,7 +339,6 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot { } /* TEMPLATES */ - public static ArrayList treeTemplates = new ArrayList(); @Override public ArrayList getIndividualTemplates() { @@ -356,7 +357,7 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot { } /* MUTATIONS */ - private static ArrayList treeMutations = new ArrayList(); + private static final ArrayList treeMutations = new ArrayList(); @Override public ArrayList getMutations(boolean shuffle) { diff --git a/src/main/java/forestry/arboriculture/genetics/TreeMutation.java b/src/main/java/forestry/arboriculture/genetics/TreeMutation.java index 70e3b72fc..043572ee5 100755 --- a/src/main/java/forestry/arboriculture/genetics/TreeMutation.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeMutation.java @@ -24,7 +24,7 @@ import forestry.plugins.PluginArboriculture; public class TreeMutation extends Mutation implements ITreeMutation { - private ITreeRoot root; + private final ITreeRoot root; public TreeMutation(IAllele allele0, IAllele allele1, IAllele[] template, int chance) { super(allele0, allele1, template, chance); diff --git a/src/main/java/forestry/arboriculture/genetics/TreekeepingMode.java b/src/main/java/forestry/arboriculture/genetics/TreekeepingMode.java index b467211bc..e7083d3d9 100755 --- a/src/main/java/forestry/arboriculture/genetics/TreekeepingMode.java +++ b/src/main/java/forestry/arboriculture/genetics/TreekeepingMode.java @@ -12,28 +12,25 @@ package forestry.arboriculture.genetics; import java.util.ArrayList; import java.util.Locale; -import java.util.Random; import forestry.api.arboriculture.ITreeGenome; import forestry.api.arboriculture.ITreekeepingMode; public class TreekeepingMode implements ITreekeepingMode { - public static ITreekeepingMode easy = new TreekeepingMode("EASY", 1.4f, 1.3f, 1.2f, 1.2f); - public static ITreekeepingMode normal = new TreekeepingMode("NORMAL", 1f, 1f, 1f, 1f); - public static ITreekeepingMode hard = new TreekeepingMode("HARD", 0.9f, 0.9f, 0.9f, 0.9f); - public static ITreekeepingMode hardcore = new TreekeepingMode("HARDCORE", 0.7f, 0.7f, 0.5f, 0.5f); - public static ITreekeepingMode insane = new TreekeepingMode("INSANE", 0.5f, 0.5f, 0.2f, 0.1f); + public static final ITreekeepingMode easy = new TreekeepingMode("EASY", 1.4f, 1.3f, 1.2f, 1.2f); + public static final ITreekeepingMode normal = new TreekeepingMode("NORMAL", 1f, 1f, 1f, 1f); + public static final ITreekeepingMode hard = new TreekeepingMode("HARD", 0.9f, 0.9f, 0.9f, 0.9f); + public static final ITreekeepingMode hardcore = new TreekeepingMode("HARDCORE", 0.7f, 0.7f, 0.5f, 0.5f); + public static final ITreekeepingMode insane = new TreekeepingMode("INSANE", 0.5f, 0.5f, 0.2f, 0.1f); - final Random rand; - final String name; - private float yieldModifier; - private float sappinessModifier; - private float maturationModifier; - private float mutationModifier; + private final String name; + private final float yieldModifier; + private final float sappinessModifier; + private final float maturationModifier; + private final float mutationModifier; public TreekeepingMode(String name, float yieldModifier, float sappinessModifier, float maturationModifier, float mutationModifier) { - this.rand = new Random(); this.name = name; this.yieldModifier = yieldModifier; this.sappinessModifier = sappinessModifier; diff --git a/src/main/java/forestry/arboriculture/gui/GuiTreealyzer.java b/src/main/java/forestry/arboriculture/gui/GuiTreealyzer.java index 8b6b8a383..bae895bae 100755 --- a/src/main/java/forestry/arboriculture/gui/GuiTreealyzer.java +++ b/src/main/java/forestry/arboriculture/gui/GuiTreealyzer.java @@ -17,7 +17,6 @@ import forestry.api.arboriculture.IAlleleGrowth; import forestry.api.arboriculture.ITree; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IAllele; -import forestry.api.genetics.IAlleleEffect; import forestry.api.genetics.IAlleleFloat; import forestry.api.genetics.IAlleleInteger; import forestry.api.genetics.IFruitFamily; @@ -42,8 +41,6 @@ import java.util.Locale; public class GuiTreealyzer extends GuiAlyzer { - private ItemStack[] tempProductList; - public GuiTreealyzer(EntityPlayer player, TreealyzerInventory inventory) { super(AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees"), player, new ContainerTreealyzer(player.inventory, inventory), inventory, 1, inventory.getSizeInventory()); @@ -189,7 +186,7 @@ public class GuiTreealyzer extends GuiAlyzer { newLine(); drawRow(StringUtil.localize("gui.effect"), tree.getGenome().getEffect().getName(), - ((IAlleleEffect) tree.getGenome().getInactiveAllele(EnumTreeChromosome.EFFECT.ordinal())).getName(), tree, + tree.getGenome().getInactiveAllele(EnumTreeChromosome.EFFECT.ordinal()).getName(), tree, EnumTreeChromosome.EFFECT); newLine(); @@ -299,15 +296,13 @@ public class GuiTreealyzer extends GuiAlyzer { private void drawAnalyticsPage3(ITree tree) { - tempProductList = tree.getProduceList(); - startPage(COLUMN_0, COLUMN_1, COLUMN_2); drawLine(StringUtil.localize("gui.beealyzer.produce") + ":", COLUMN_0); newLine(); int x = COLUMN_0; - for (ItemStack stack : tempProductList) { + for (ItemStack stack : tree.getProduceList()) { itemRender.renderItemIntoGUI(fontRendererObj, mc.renderEngine, stack, (int) ((guiLeft + x) * (1 / factor)), (int) ((guiTop + getLineY()) * (1 / factor))); x += 18; diff --git a/src/main/java/forestry/arboriculture/render/LeavesRenderingHandler.java b/src/main/java/forestry/arboriculture/render/LeavesRenderingHandler.java index fe0fc2c4d..95d5bb74d 100755 --- a/src/main/java/forestry/arboriculture/render/LeavesRenderingHandler.java +++ b/src/main/java/forestry/arboriculture/render/LeavesRenderingHandler.java @@ -52,10 +52,8 @@ public class LeavesRenderingHandler extends OverlayRenderingHandler implements I // Render overlay for fruit leaves. IIcon fruitIcon = null; int fruitColor = 0xffffff; - if (tile != null) { - fruitIcon = tile.getFruitTexture(); - fruitColor = tile.getFruitColour(); - } + fruitIcon = tile.getFruitTexture(); + fruitColor = tile.getFruitColour(); if (fruitIcon != null) renderFruitOverlay(world, block, x, y, z, renderer, fruitIcon, fruitColor); diff --git a/src/main/java/forestry/arboriculture/worldgen/BlockTypeLeaf.java b/src/main/java/forestry/arboriculture/worldgen/BlockTypeLeaf.java index ccf0eb716..c2af659d4 100755 --- a/src/main/java/forestry/arboriculture/worldgen/BlockTypeLeaf.java +++ b/src/main/java/forestry/arboriculture/worldgen/BlockTypeLeaf.java @@ -20,7 +20,7 @@ import forestry.core.worldgen.BlockType; public class BlockTypeLeaf extends BlockType { - private GameProfile owner; + private final GameProfile owner; public BlockTypeLeaf(GameProfile owner) { super(ForestryBlock.leaves, 0); diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java index f97a08730..8d4f87a4a 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java @@ -24,11 +24,17 @@ import forestry.core.worldgen.WorldGenBase; public abstract class WorldGenArboriculture extends WorldGenBase { + private static final BlockType vine = new BlockType(Blocks.vine, 0); + private static final BlockType air = new BlockTypeVoid(); + protected final ITreeGenData tree; protected int startX; protected int startY; protected int startZ; + protected BlockType leaf; + protected BlockType wood; + protected boolean spawnPods = false; protected int minPodHeight = 3; @@ -74,11 +80,6 @@ public abstract class WorldGenArboriculture extends WorldGenBase { public abstract BlockType getWood(); - BlockType leaf; - BlockType wood; - BlockType vine = new BlockType(Blocks.vine, 0); - BlockType air = new BlockTypeVoid(); - public final Vect getStartVector() { return new Vect(startX, startY, startZ); } diff --git a/src/main/java/forestry/core/TickHandlerCoreClient.java b/src/main/java/forestry/core/TickHandlerCoreClient.java index f1a3fa469..99ffeb4f6 100755 --- a/src/main/java/forestry/core/TickHandlerCoreClient.java +++ b/src/main/java/forestry/core/TickHandlerCoreClient.java @@ -26,17 +26,18 @@ import forestry.core.proxy.Proxies; import forestry.core.utils.Utils; public class TickHandlerCoreClient { + + private static final ConcurrentLinkedQueue messages = new ConcurrentLinkedQueue(); + private boolean naggedVersion, naggedVerify; + private boolean hasNaturalistView; + public TickHandlerCoreClient() { FMLCommonHandler.instance().bus().register(this); } - private static ConcurrentLinkedQueue messages = new ConcurrentLinkedQueue(); - public void queueChatMessage(String message) { messages.add(message); } - private boolean naggedVersion, naggedVerify; - private boolean hasNaturalistView; @SubscribeEvent public void onPlayerTick(PlayerTickEvent event) { diff --git a/src/main/java/forestry/core/circuits/Circuit.java b/src/main/java/forestry/core/circuits/Circuit.java index def28d61a..ac8b4989e 100755 --- a/src/main/java/forestry/core/circuits/Circuit.java +++ b/src/main/java/forestry/core/circuits/Circuit.java @@ -18,9 +18,9 @@ import forestry.core.utils.StringUtil; public abstract class Circuit implements ICircuit { - String uid; - int limit = 1; - boolean requiresDiscovery; + private final String uid; + private final boolean requiresDiscovery; + private int limit = 1; public Circuit(String uid, boolean requiresDiscovery) { this.uid = uid; diff --git a/src/main/java/forestry/core/circuits/CircuitLayout.java b/src/main/java/forestry/core/circuits/CircuitLayout.java index 9113f7086..e649a9017 100755 --- a/src/main/java/forestry/core/circuits/CircuitLayout.java +++ b/src/main/java/forestry/core/circuits/CircuitLayout.java @@ -15,7 +15,7 @@ import forestry.core.utils.StringUtil; public class CircuitLayout implements ICircuitLayout { - String uid; + private final String uid; public CircuitLayout(String uid) { this.uid = uid; diff --git a/src/main/java/forestry/core/circuits/CircuitRegistry.java b/src/main/java/forestry/core/circuits/CircuitRegistry.java index 1392f7266..bfcac9040 100755 --- a/src/main/java/forestry/core/circuits/CircuitRegistry.java +++ b/src/main/java/forestry/core/circuits/CircuitRegistry.java @@ -26,9 +26,9 @@ import forestry.core.config.ForestryItem; public class CircuitRegistry implements ICircuitRegistry { - private LinkedHashMap layoutMap = new LinkedHashMap(); - private LinkedHashMap circuitMap = new LinkedHashMap(); - private HashMap legacyMap = new HashMap(); + private final LinkedHashMap layoutMap = new LinkedHashMap(); + private final LinkedHashMap circuitMap = new LinkedHashMap(); + private final HashMap legacyMap = new HashMap(); @Override public ICircuitLibrary getCircuitLibrary(World world, String playername) { diff --git a/src/main/java/forestry/core/circuits/ContainerSolderingIron.java b/src/main/java/forestry/core/circuits/ContainerSolderingIron.java index 975456819..5c4555a28 100755 --- a/src/main/java/forestry/core/circuits/ContainerSolderingIron.java +++ b/src/main/java/forestry/core/circuits/ContainerSolderingIron.java @@ -35,10 +35,10 @@ public class ContainerSolderingIron extends ContainerItemInventory implements IG this.inventory = inventory; // Input - this.addSlot(new SlotCustom(inventory, 0, 152, 12, new Object[] { ItemCircuitBoard.class })); + this.addSlot(new SlotCustom(inventory, 0, 152, 12, ItemCircuitBoard.class)); // Output - this.addSlot(new SlotCustom(inventory, 1, 152, 92, new Object[] { ItemCircuitBoard.class })); + this.addSlot(new SlotCustom(inventory, 1, 152, 92, ItemCircuitBoard.class)); // Ingredients this.addSlot(new Slot(inventory, 2, 12, 32)); diff --git a/src/main/java/forestry/core/circuits/ItemSolderingIron.java b/src/main/java/forestry/core/circuits/ItemSolderingIron.java index f10347eb5..0a6e3413e 100755 --- a/src/main/java/forestry/core/circuits/ItemSolderingIron.java +++ b/src/main/java/forestry/core/circuits/ItemSolderingIron.java @@ -35,9 +35,9 @@ import forestry.core.utils.ItemInventory; public class ItemSolderingIron extends ItemForestry implements ISolderingIron { public static class CircuitRecipe { - ICircuitLayout layout; - ItemStack resource; - ICircuit circuit; + private final ICircuitLayout layout; + private final ItemStack resource; + public final ICircuit circuit; public CircuitRecipe(ICircuitLayout layout, ItemStack resource, ICircuit circuit) { this.resource = resource; @@ -54,7 +54,7 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron { } public static class SolderManager implements ISolderManager { - public static ArrayList recipes = new ArrayList(); + public static final ArrayList recipes = new ArrayList(); @Override public void addRecipe(ICircuitLayout layout, ItemStack resource, ICircuit circuit) { @@ -82,12 +82,12 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron { // / INVENTORY MANAGMENT public static class SolderingInventory extends ItemInventory implements IErrorSource { - ICircuitLayout layout; - EnumErrorCode errorState; + private ICircuitLayout layout; + private EnumErrorCode errorState; - short blankSlot = 0; - short finishedSlot = 1; - short ingredientSlot1 = 2; + private final short blankSlot = 0; + private final short finishedSlot = 1; + private final short ingredientSlot1 = 2; public SolderingInventory() { super(ItemSolderingIron.class, 6); diff --git a/src/main/java/forestry/core/commands/SubCommand.java b/src/main/java/forestry/core/commands/SubCommand.java index b5b826e6d..4256b3991 100644 --- a/src/main/java/forestry/core/commands/SubCommand.java +++ b/src/main/java/forestry/core/commands/SubCommand.java @@ -27,7 +27,7 @@ public abstract class SubCommand implements IForestryCommand { public enum PermLevel { EVERYONE(0), ADMIN(2); - int permLevel; + public final int permLevel; private PermLevel(int permLevel) { this.permLevel = permLevel; diff --git a/src/main/java/forestry/core/config/Config.java b/src/main/java/forestry/core/config/Config.java index b91b21aba..52b01dc0f 100755 --- a/src/main/java/forestry/core/config/Config.java +++ b/src/main/java/forestry/core/config/Config.java @@ -32,7 +32,7 @@ public class Config { public static String gameMode; - public static HashSet disabledStructures = new HashSet(); + public static final HashSet disabledStructures = new HashSet(); public static boolean isDebug = false; @@ -80,7 +80,7 @@ public class Config { } public static boolean craftingStampsEnabled = true; - public static ArrayList collectorStamps = new ArrayList(); + public static final ArrayList collectorStamps = new ArrayList(); public static boolean applePickup = true; public static boolean squareFarms = false; @@ -90,7 +90,7 @@ public class Config { // Hints public static boolean disableHints = false; - public static HashMap hints = new HashMap(); + public static final HashMap hints = new HashMap(); public static boolean disableEnergyStat = false; public static void load() { diff --git a/src/main/java/forestry/core/config/Configuration.java b/src/main/java/forestry/core/config/Configuration.java index 156063505..2f6eabbc9 100755 --- a/src/main/java/forestry/core/config/Configuration.java +++ b/src/main/java/forestry/core/config/Configuration.java @@ -27,9 +27,9 @@ import java.util.TreeMap; public class Configuration { - private String newLine; - private ArrayList purge = new ArrayList(); - private TreeMap> categorized = new TreeMap>(); + private final String newLine; + private final ArrayList purge = new ArrayList(); + private final TreeMap> categorized = new TreeMap>(); public Configuration() { newLine = System.getProperty("line.separator"); diff --git a/src/main/java/forestry/core/config/ForestryItem.java b/src/main/java/forestry/core/config/ForestryItem.java index 11507bcf0..6d586e14e 100755 --- a/src/main/java/forestry/core/config/ForestryItem.java +++ b/src/main/java/forestry/core/config/ForestryItem.java @@ -216,7 +216,6 @@ public enum ForestryItem { cratedMulch, cratedSilver, cratedBrass, - cratedNikolite, cratedCookies, cratedHoneycombs, cratedBeeswax, diff --git a/src/main/java/forestry/core/config/SessionVars.java b/src/main/java/forestry/core/config/SessionVars.java index 4bd1ab285..721ddb9b8 100755 --- a/src/main/java/forestry/core/config/SessionVars.java +++ b/src/main/java/forestry/core/config/SessionVars.java @@ -14,7 +14,7 @@ import java.util.HashMap; public class SessionVars { - private static HashMap stringVars = new HashMap(); + private static final HashMap stringVars = new HashMap(); private static Class openedLedger; diff --git a/src/main/java/forestry/core/config/Version.java b/src/main/java/forestry/core/config/Version.java index b9696cb74..0d675b126 100755 --- a/src/main/java/forestry/core/config/Version.java +++ b/src/main/java/forestry/core/config/Version.java @@ -89,19 +89,19 @@ public class Version { public static String retrieveRemoteString(String location, String defaultValue) { try { - HttpURLConnection conn = null; - while (location != null && !location.isEmpty()) { + HttpURLConnection conn; + do { URL url = new URL(location); conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)"); conn.connect(); location = conn.getHeaderField("Location"); - } + } while (location != null && !location.isEmpty()); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); - String line = null; + String line; if ((line = reader.readLine()) != null) return line; @@ -174,17 +174,16 @@ public class Version { public static String[] grabChangelog(String version) { try { - String location = REMOTE_CHANGELOG_ROOT + version; HttpURLConnection conn = null; - while (location != null && !location.isEmpty()) { + do { URL url = new URL(location); conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)"); conn.connect(); location = conn.getHeaderField("Location"); - } + } while (location != null && !location.isEmpty()); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); diff --git a/src/main/java/forestry/core/fluids/TankManager.java b/src/main/java/forestry/core/fluids/TankManager.java index 93d853f1b..dbef0aeab 100644 --- a/src/main/java/forestry/core/fluids/TankManager.java +++ b/src/main/java/forestry/core/fluids/TankManager.java @@ -167,7 +167,7 @@ public class TankManager extends ForwardingList implements IFluidH fluidAmount = fluidStack.amount; } - player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidId); + player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA, fluidId); PacketGuiInteger packet = new PacketGuiInteger(container.windowId, tankIndex * NETWORK_DATA + 1, fluidAmount); Proxies.net.sendToPlayer(packet, (EntityPlayerMP)player); } @@ -192,12 +192,12 @@ public class TankManager extends ForwardingList implements IFluidH fluidId = fluidStack.fluidID; fluidAmount = fluidStack.amount; } - player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidId); + player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA, fluidId); PacketGuiInteger packet = new PacketGuiInteger(container.windowId, tankIndex * NETWORK_DATA + 1, fluidAmount); Proxies.net.sendToPlayer(packet, player); } else if (fluidStack != null && prev != null) { if (fluidStack.getFluid() != prev.getFluid()) - player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidStack.fluidID); + player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA, fluidStack.fluidID); if (fluidStack.amount != prev.amount) { PacketGuiInteger packet = new PacketGuiInteger(container.windowId, tankIndex * NETWORK_DATA + 1, fluidStack.amount); Proxies.net.sendToPlayer(packet, player); diff --git a/src/main/java/forestry/core/fluids/tanks/FilteredTank.java b/src/main/java/forestry/core/fluids/tanks/FilteredTank.java index 59e973a4d..18c67dbce 100644 --- a/src/main/java/forestry/core/fluids/tanks/FilteredTank.java +++ b/src/main/java/forestry/core/fluids/tanks/FilteredTank.java @@ -78,8 +78,7 @@ public class FilteredTank extends StandardTank { if (rarity == null) rarity = EnumRarity.common; FluidStack filterFluidStack = FluidRegistry.getFluidStack(filter.getName(), 0); - ToolTipLine name = new ToolTipLine(filter.getLocalizedName(filterFluidStack), rarity.rarityColor); - name.setSpacing(2); + ToolTipLine name = new ToolTipLine(filter.getLocalizedName(filterFluidStack), rarity.rarityColor, 2); toolTip.add(name); if (getFluid() != null) amount = getFluid().amount; diff --git a/src/main/java/forestry/core/fluids/tanks/StandardTank.java b/src/main/java/forestry/core/fluids/tanks/StandardTank.java index c8f250199..d2dae22b1 100644 --- a/src/main/java/forestry/core/fluids/tanks/StandardTank.java +++ b/src/main/java/forestry/core/fluids/tanks/StandardTank.java @@ -154,8 +154,7 @@ public class StandardTank extends FluidTank { EnumRarity rarity = fluidType.getRarity(); if (rarity == null) rarity = EnumRarity.common; - ToolTipLine fluidName = new ToolTipLine(fluidType.getLocalizedName(getFluid()), rarity.rarityColor); - fluidName.setSpacing(2); + ToolTipLine fluidName = new ToolTipLine(fluidType.getLocalizedName(getFluid()), rarity.rarityColor, 2); toolTip.add(fluidName); amount = getFluid().amount; } diff --git a/src/main/java/forestry/core/gadgets/BlockForestry.java b/src/main/java/forestry/core/gadgets/BlockForestry.java index ff22e8f2e..ba26d000a 100755 --- a/src/main/java/forestry/core/gadgets/BlockForestry.java +++ b/src/main/java/forestry/core/gadgets/BlockForestry.java @@ -28,13 +28,9 @@ import forestry.core.utils.Utils; public abstract class BlockForestry extends BlockContainer { - protected static boolean keepInventory = false; - protected Random furnaceRand; - public BlockForestry(Material material) { super(material); setHardness(1.5f); - furnaceRand = new Random(); setCreativeTab(CreativeTabForestry.tabForestry); } diff --git a/src/main/java/forestry/core/gadgets/StructureLogic.java b/src/main/java/forestry/core/gadgets/StructureLogic.java index 5474895fa..2dcc57c02 100755 --- a/src/main/java/forestry/core/gadgets/StructureLogic.java +++ b/src/main/java/forestry/core/gadgets/StructureLogic.java @@ -25,10 +25,10 @@ import forestry.core.utils.Vect; public abstract class StructureLogic implements IStructureLogic { - protected ITileStructure structure; - protected TileEntity structureTile; + protected final ITileStructure structure; + protected final TileEntity structureTile; - protected String uid; + protected final String uid; protected Schemata[] schematas; protected short activeSchemata = -1; protected boolean isRotated = false; diff --git a/src/main/java/forestry/core/gadgets/TileAnalyzer.java b/src/main/java/forestry/core/gadgets/TileAnalyzer.java index 4d8b24d6e..22a1c007b 100755 --- a/src/main/java/forestry/core/gadgets/TileAnalyzer.java +++ b/src/main/java/forestry/core/gadgets/TileAnalyzer.java @@ -62,7 +62,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui private int analyzeTime; @EntityNetData - public FilteredTank resourceTank; + public final FilteredTank resourceTank; private final TankManager tankManager; diff --git a/src/main/java/forestry/core/gadgets/TilePowered.java b/src/main/java/forestry/core/gadgets/TilePowered.java index 0805bd7da..41fea59e5 100644 --- a/src/main/java/forestry/core/gadgets/TilePowered.java +++ b/src/main/java/forestry/core/gadgets/TilePowered.java @@ -29,7 +29,7 @@ import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData; @Optional.Interface(iface = "buildcraft.api.tiles.IHasWork", modid = "BuildCraftAPI|tiles") public abstract class TilePowered extends TileBase implements IRenderableMachine, IPowerHandler, IHasWork { - public static int WORK_CYCLES = 4; + public static final int WORK_CYCLES = 4; @Override public PacketPayload getPacketPayload() { diff --git a/src/main/java/forestry/core/genetics/Allele.java b/src/main/java/forestry/core/genetics/Allele.java index af3246431..e5e3b8d9a 100755 --- a/src/main/java/forestry/core/genetics/Allele.java +++ b/src/main/java/forestry/core/genetics/Allele.java @@ -23,8 +23,8 @@ import forestry.core.utils.StringUtil; public class Allele implements IAllele { - protected String uid; - boolean isDominant; + protected final String uid; + protected final boolean isDominant; protected String name; public Allele(String uid, boolean isDominant) { diff --git a/src/main/java/forestry/core/genetics/AlleleArea.java b/src/main/java/forestry/core/genetics/AlleleArea.java index 7237a5354..88d7b57f5 100755 --- a/src/main/java/forestry/core/genetics/AlleleArea.java +++ b/src/main/java/forestry/core/genetics/AlleleArea.java @@ -16,7 +16,7 @@ import forestry.core.utils.Vect; public class AlleleArea extends Allele implements IAlleleArea { - private int[] area; + private final int[] area; public AlleleArea(String uid, int[] value) { this(uid, value, false); diff --git a/src/main/java/forestry/core/genetics/AlleleBoolean.java b/src/main/java/forestry/core/genetics/AlleleBoolean.java index 3c930ec51..43344ad38 100755 --- a/src/main/java/forestry/core/genetics/AlleleBoolean.java +++ b/src/main/java/forestry/core/genetics/AlleleBoolean.java @@ -14,8 +14,7 @@ import forestry.api.genetics.IAlleleBoolean; public class AlleleBoolean extends Allele implements IAlleleBoolean { - boolean value; - boolean isDominant; + final boolean value; public AlleleBoolean(String uid, boolean value) { this(uid, value, false); diff --git a/src/main/java/forestry/core/genetics/AlleleFloat.java b/src/main/java/forestry/core/genetics/AlleleFloat.java index ce3518896..33686ffdd 100755 --- a/src/main/java/forestry/core/genetics/AlleleFloat.java +++ b/src/main/java/forestry/core/genetics/AlleleFloat.java @@ -15,7 +15,7 @@ import forestry.core.utils.StringUtil; public class AlleleFloat extends Allele implements IAlleleFloat { - float value; + private final float value; public AlleleFloat(String uid, float value) { this(uid, value, false); diff --git a/src/main/java/forestry/core/genetics/AlleleInteger.java b/src/main/java/forestry/core/genetics/AlleleInteger.java index 0f26b2500..d536562c5 100755 --- a/src/main/java/forestry/core/genetics/AlleleInteger.java +++ b/src/main/java/forestry/core/genetics/AlleleInteger.java @@ -15,7 +15,7 @@ import forestry.core.utils.StringUtil; public class AlleleInteger extends Allele implements IAlleleInteger { - int value; + private final int value; public AlleleInteger(String uid, int value) { this(uid, value, false); diff --git a/src/main/java/forestry/core/genetics/AllelePlantType.java b/src/main/java/forestry/core/genetics/AllelePlantType.java index 9b9333ae2..756f9737c 100755 --- a/src/main/java/forestry/core/genetics/AllelePlantType.java +++ b/src/main/java/forestry/core/genetics/AllelePlantType.java @@ -18,7 +18,7 @@ import forestry.api.genetics.IAllelePlantType; public class AllelePlantType extends Allele implements IAllelePlantType { - private EnumSet types; + private final EnumSet types; protected AllelePlantType(String uid, EnumPlantType type) { this(uid, type, false); diff --git a/src/main/java/forestry/core/genetics/AlleleRegistry.java b/src/main/java/forestry/core/genetics/AlleleRegistry.java index aac8c79a2..3b3f8588c 100755 --- a/src/main/java/forestry/core/genetics/AlleleRegistry.java +++ b/src/main/java/forestry/core/genetics/AlleleRegistry.java @@ -38,7 +38,7 @@ import forestry.core.genetics.ItemResearchNote.EnumNoteType; public class AlleleRegistry implements IAlleleRegistry, ILegacyHandler { - public static final int ALLELE_ARRAY_SIZE = 2048; + private static final int ALLELE_ARRAY_SIZE = 2048; /* SPECIES ROOT */ private final LinkedHashMap rootMap = new LinkedHashMap(16); diff --git a/src/main/java/forestry/core/genetics/AlleleTolerance.java b/src/main/java/forestry/core/genetics/AlleleTolerance.java index 005ad11c1..e046cc4d6 100755 --- a/src/main/java/forestry/core/genetics/AlleleTolerance.java +++ b/src/main/java/forestry/core/genetics/AlleleTolerance.java @@ -16,7 +16,7 @@ import forestry.core.utils.StringUtil; public class AlleleTolerance extends Allele implements IAlleleTolerance { - EnumTolerance value; + private final EnumTolerance value; public AlleleTolerance(String uid, EnumTolerance value) { this(uid, value, false); diff --git a/src/main/java/forestry/core/genetics/BreedingTracker.java b/src/main/java/forestry/core/genetics/BreedingTracker.java index 3de3094da..b3b1d8c1d 100755 --- a/src/main/java/forestry/core/genetics/BreedingTracker.java +++ b/src/main/java/forestry/core/genetics/BreedingTracker.java @@ -36,7 +36,7 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin private ArrayList discoveredMutations = new ArrayList(); private String modeName; - GameProfile username; + private final GameProfile username; public BreedingTracker(String s, GameProfile username) { super(s); diff --git a/src/main/java/forestry/core/genetics/Classification.java b/src/main/java/forestry/core/genetics/Classification.java index ed0d8a594..1641cbe72 100755 --- a/src/main/java/forestry/core/genetics/Classification.java +++ b/src/main/java/forestry/core/genetics/Classification.java @@ -20,14 +20,14 @@ import forestry.core.utils.StringUtil; public class Classification implements IClassification { - private EnumClassLevel level; - private String uid; - private String scientific; + private final EnumClassLevel level; + private final String uid; + private final String scientific; private IClassification parent; - private ArrayList members = new ArrayList(); - private ArrayList groups = new ArrayList(); + private final ArrayList members = new ArrayList(); + private final ArrayList groups = new ArrayList(); public Classification(EnumClassLevel level, String uid, String scientific) { this.level = level; diff --git a/src/main/java/forestry/core/genetics/Genome.java b/src/main/java/forestry/core/genetics/Genome.java index 98d092724..af3ca541e 100755 --- a/src/main/java/forestry/core/genetics/Genome.java +++ b/src/main/java/forestry/core/genetics/Genome.java @@ -149,16 +149,15 @@ public abstract class Genome implements IGenome { for (int i = 0; i < chromosomes.length; i++) { IChromosome chromosome = chromosomes[i]; - if (chromosome == null && genetics[i] != null) - return false; - if (chromosome != null && genetics[i] == null) - return false; - if (chromosome == null && genetics[i] == null) + IChromosome otherChromosome = genetics[i]; + if (chromosome == null && otherChromosome == null) continue; - - if (!chromosome.getPrimaryAllele().getUID().equals(genetics[i].getPrimaryAllele().getUID())) + if (chromosome == null || otherChromosome == null) return false; - if (!chromosome.getSecondaryAllele().getUID().equals(genetics[i].getSecondaryAllele().getUID())) + + if (!chromosome.getPrimaryAllele().getUID().equals(otherChromosome.getPrimaryAllele().getUID())) + return false; + if (!chromosome.getSecondaryAllele().getUID().equals(otherChromosome.getSecondaryAllele().getUID())) return false; } diff --git a/src/main/java/forestry/core/genetics/ItemResearchNote.java b/src/main/java/forestry/core/genetics/ItemResearchNote.java index fd59c750b..0025a41ef 100755 --- a/src/main/java/forestry/core/genetics/ItemResearchNote.java +++ b/src/main/java/forestry/core/genetics/ItemResearchNote.java @@ -47,7 +47,7 @@ public class ItemResearchNote extends ItemForestry { public static enum EnumNoteType { NONE, MUTATION, SPECIES; - public static EnumNoteType[] VALUES = values(); + public static final EnumNoteType[] VALUES = values(); private IMutation getEncodedMutation(ISpeciesRoot root, NBTTagCompound compound) { IAllele allele0 = AlleleManager.alleleRegistry.getAllele(compound.getString("AL0")); @@ -180,9 +180,9 @@ public class ItemResearchNote extends ItemForestry { public static class ResearchNote { - private GameProfile researcher; - private EnumNoteType type = EnumNoteType.NONE; - private NBTTagCompound inner; + private final GameProfile researcher; + private final EnumNoteType type; + private final NBTTagCompound inner; public ResearchNote(GameProfile researcher, EnumNoteType type, NBTTagCompound inner) { this.researcher = researcher; @@ -193,12 +193,17 @@ public class ItemResearchNote extends ItemForestry { public ResearchNote(NBTTagCompound compound) { if(compound != null) { if (compound.hasKey("res")) { - researcher = NBTUtil.func_152459_a(compound.getCompoundTag("res")); + this.researcher = NBTUtil.func_152459_a(compound.getCompoundTag("res")); + } else { + this.researcher = null; } this.type = EnumNoteType.VALUES[compound.getByte("TYP")]; this.inner = compound.getCompoundTag("INN"); - } else + } else { + this.type = EnumNoteType.NONE; + this.researcher = null; this.inner = new NBTTagCompound(); + } } public void writeToNBT(NBTTagCompound compound) { diff --git a/src/main/java/forestry/core/genetics/Mutation.java b/src/main/java/forestry/core/genetics/Mutation.java index abe8c4a1b..41cfc1ffa 100755 --- a/src/main/java/forestry/core/genetics/Mutation.java +++ b/src/main/java/forestry/core/genetics/Mutation.java @@ -21,20 +21,20 @@ import forestry.api.genetics.IMutation; public abstract class Mutation implements IMutation { - protected int chance; + protected final int chance; boolean isSecret = false; - protected IAllele allele0; - protected IAllele allele1; + protected final IAllele allele0; + protected final IAllele allele1; - IAllele[] template; + private final IAllele[] template; protected float minTemperature = 0.0f; protected float maxTemperature = 2.0f; protected float minRainfall = 0.0f; protected float maxRainfall = 2.0f; - protected ArrayList specialConditions = new ArrayList(); + protected final ArrayList specialConditions = new ArrayList(); public Mutation(IAllele allele0, IAllele allele1, IAllele[] template, int chance) { this.allele0 = allele0; diff --git a/src/main/java/forestry/core/genetics/SpeciesRoot.java b/src/main/java/forestry/core/genetics/SpeciesRoot.java index f4c783a82..20556ffa1 100755 --- a/src/main/java/forestry/core/genetics/SpeciesRoot.java +++ b/src/main/java/forestry/core/genetics/SpeciesRoot.java @@ -28,7 +28,7 @@ import forestry.api.genetics.ISpeciesRoot; public abstract class SpeciesRoot implements ISpeciesRoot { /* RESEARCH */ - LinkedHashMap researchCatalysts = new LinkedHashMap(); + private final LinkedHashMap researchCatalysts = new LinkedHashMap(); @Override public Map getResearchCatalysts() { @@ -41,7 +41,7 @@ public abstract class SpeciesRoot implements ISpeciesRoot { } /* TEMPLATES */ - public HashMap speciesTemplates = new HashMap(); + public final HashMap speciesTemplates = new HashMap(); @Override public Map getGenomeTemplates() { diff --git a/src/main/java/forestry/core/gui/ClimateLedger.java b/src/main/java/forestry/core/gui/ClimateLedger.java index 1e0731786..2e88ee8ee 100755 --- a/src/main/java/forestry/core/gui/ClimateLedger.java +++ b/src/main/java/forestry/core/gui/ClimateLedger.java @@ -20,7 +20,7 @@ import forestry.core.utils.StringUtil; */ public class ClimateLedger extends Ledger { - IClimatised tile; + private final IClimatised tile; public ClimateLedger(LedgerManager manager, IClimatised tile) { super(manager); diff --git a/src/main/java/forestry/core/gui/ContainerAnalyzer.java b/src/main/java/forestry/core/gui/ContainerAnalyzer.java index 6d9af06e2..b6cfbd5f2 100755 --- a/src/main/java/forestry/core/gui/ContainerAnalyzer.java +++ b/src/main/java/forestry/core/gui/ContainerAnalyzer.java @@ -37,7 +37,7 @@ public class ContainerAnalyzer extends ContainerLiquidTanks { addSlot(new SlotCustom(tile, TileAnalyzer.SLOT_INPUT_1 + i * 2 + k, 8 + k * 18, 28 + i * 18, ItemGE.class)); // Analyze slot - addSlot(new SlotCustom(tile, TileAnalyzer.SLOT_ANALYZE, 73, 59, new Object[]{})); + addSlot(new SlotCustom(tile, TileAnalyzer.SLOT_ANALYZE, 73, 59)); // Can slot addSlot(new SlotLiquidContainer(tile, TileAnalyzer.SLOT_CAN, 143, 24, false, Fluids.HONEY.get()) { diff --git a/src/main/java/forestry/core/gui/ContainerEscritoire.java b/src/main/java/forestry/core/gui/ContainerEscritoire.java index 789fb7909..cb279ddc9 100755 --- a/src/main/java/forestry/core/gui/ContainerEscritoire.java +++ b/src/main/java/forestry/core/gui/ContainerEscritoire.java @@ -46,7 +46,7 @@ public class ContainerEscritoire extends ContainerForestry implements IGuiSelect addSlot(new SlotCustom(tile, TileEscritoire.SLOT_ANALYZE, 97, 67, filters.toArray()).setCrafter(tile)); for (int i = 0; i < TileEscritoire.SLOTS_INPUT_COUNT; i++) { - addSlot(new SlotCustom(tile, TileEscritoire.SLOT_INPUT_1 + i, 17, 49 + i * 18, true).setBlockedTexture("slots/blocked_2")); + addSlot(new SlotCustom(tile, TileEscritoire.SLOT_INPUT_1 + i, 17, 49 + i * 18).setExclusion(true).setBlockedTexture("slots/blocked_2")); } for(int i = 0; i < 3; i++) diff --git a/src/main/java/forestry/core/gui/ContainerForestry.java b/src/main/java/forestry/core/gui/ContainerForestry.java index 7b0706a95..15a947fcb 100755 --- a/src/main/java/forestry/core/gui/ContainerForestry.java +++ b/src/main/java/forestry/core/gui/ContainerForestry.java @@ -24,13 +24,15 @@ import net.minecraft.item.ItemStack; public class ContainerForestry extends Container { - protected IInventory inventory; - protected TileForestry inventoryForestry; + protected final IInventory inventory; + protected final TileForestry inventoryForestry; public ContainerForestry(IInventory inventory) { this.inventory = inventory; if (inventory instanceof TileForestry) this.inventoryForestry = (TileForestry)inventory; + else + this.inventoryForestry = null; } /** @@ -108,7 +110,7 @@ public class ContainerForestry extends Container { stackSlot.stackSize = stackSize; if (stackSlot.stackSize <= 0) - slot.putStack((ItemStack) null); + slot.putStack(null); } protected void fillPhantomSlot(Slot slot, ItemStack stackHeld, int mouseButton, int modifier) { diff --git a/src/main/java/forestry/core/gui/ContainerLiquidTanks.java b/src/main/java/forestry/core/gui/ContainerLiquidTanks.java index 7ecd8b350..1def8b1f0 100755 --- a/src/main/java/forestry/core/gui/ContainerLiquidTanks.java +++ b/src/main/java/forestry/core/gui/ContainerLiquidTanks.java @@ -28,7 +28,7 @@ import forestry.core.proxy.Proxies; public class ContainerLiquidTanks extends ContainerForestry { - private ILiquidTankContainer tile; + private final ILiquidTankContainer tile; public ContainerLiquidTanks(IInventory inventory, ILiquidTankContainer tile) { super(inventory); @@ -82,8 +82,8 @@ public class ContainerLiquidTanks extends ContainerForestry { public void detectAndSendChanges() { super.detectAndSendChanges(); tile.getTankManager().updateGuiData(this, crafters); - for (int i = 0; i < crafters.size(); i++) - tile.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) + tile.sendGUINetworkData(this, (ICrafting) crafter); } @Override diff --git a/src/main/java/forestry/core/gui/ContainerNaturalistInventory.java b/src/main/java/forestry/core/gui/ContainerNaturalistInventory.java index c38374b47..156ba3b65 100755 --- a/src/main/java/forestry/core/gui/ContainerNaturalistInventory.java +++ b/src/main/java/forestry/core/gui/ContainerNaturalistInventory.java @@ -33,7 +33,7 @@ public class ContainerNaturalistInventory extends ContainerForestry implements I // Inventory for (int x = 0; x < 5; x++) { for (int y = 0; y < 5; y++) { - addSlot(new SlotCustom(inventory, y + page * pageSize + x * 5, 100 + y * 18, 21 + x * 18, new Object[]{speciesRoot})); + addSlot(new SlotCustom(inventory, y + page * pageSize + x * 5, 100 + y * 18, 21 + x * 18, speciesRoot)); } } diff --git a/src/main/java/forestry/core/gui/GuiForestry.java b/src/main/java/forestry/core/gui/GuiForestry.java index 02d49fc82..2aa119094 100755 --- a/src/main/java/forestry/core/gui/GuiForestry.java +++ b/src/main/java/forestry/core/gui/GuiForestry.java @@ -10,32 +10,10 @@ ******************************************************************************/ package forestry.core.gui; -import java.awt.Color; -import java.util.Collection; -import java.util.List; - import codechicken.nei.VisiblityData; import codechicken.nei.api.INEIGuiHandler; import codechicken.nei.api.TaggedInventoryArea; - import cpw.mods.fml.common.Optional; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - import forestry.core.config.Config; import forestry.core.gadgets.TileForestry; import forestry.core.gui.slots.SlotForestry; @@ -50,17 +28,33 @@ import forestry.core.interfaces.IOwnable; import forestry.core.interfaces.IPowerHandler; import forestry.core.proxy.Proxies; import forestry.core.utils.FontColour; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import java.awt.Color; +import java.util.Collection; +import java.util.List; @Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems") public abstract class GuiForestry extends GuiContainer implements INEIGuiHandler { /* WIDGETS */ - protected WidgetManager widgetManager; + protected final WidgetManager widgetManager; /* LEDGERS */ - protected LedgerManager ledgerManager = new LedgerManager(this); - protected T tile; - public ResourceLocation textureFile; - protected FontColour fontColor; + protected final LedgerManager ledgerManager; + protected final T tile; + protected final FontColour fontColor; + public final ResourceLocation textureFile; public GuiForestry(String texture, ContainerForestry container) { this(new ResourceLocation("forestry", texture), container, null); @@ -85,6 +79,8 @@ public abstract class GuiForestry extends GuiContainer i if (inventory instanceof TileForestry) this.tile = (T) inventory; + else + this.tile = null; fontColor = new FontColour(Proxies.common.getSelectedTexturePack(Proxies.common.getClientInstance())); initLedgers(inventory); @@ -188,27 +184,6 @@ public abstract class GuiForestry extends GuiContainer i fontRendererObj.drawSplitString(text, (int) ((guiLeft + x) * (1 / factor)), (int) ((guiTop + line) * (1 / factor)), (int) (maxWidth * (1 / factor)), color); } - public void spinTextureIcon(int par1, int par2, IIcon par3Icon, int par4, int par5, int rotation) { - par1 += width / 2 - xSize / 2; - par2 += height / 2 - ySize / 2; - - float x = par1 + par4 / 2; - float y = par2 + par5 / 2; - GL11.glPushMatrix(); - GL11.glTranslatef(x, y, 0); - GL11.glRotatef(rotation, 0, 0, 1); - GL11.glTranslatef(-x, -y, 0); - - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(par1 + 0, par2 + par5, this.zLevel, par3Icon.getMinU(), par3Icon.getMaxV()); - tessellator.addVertexWithUV(par1 + par4, par2 + par5, this.zLevel, par3Icon.getMaxU(), par3Icon.getMaxV()); - tessellator.addVertexWithUV(par1 + par4, par2 + 0, this.zLevel, par3Icon.getMaxU(), par3Icon.getMinV()); - tessellator.addVertexWithUV(par1 + 0, par2 + 0, this.zLevel, par3Icon.getMinU(), par3Icon.getMinV()); - tessellator.draw(); - GL11.glPopMatrix(); - } - /* CORE GUI HANDLING */ protected int getCenteredOffset(String string) { return getCenteredOffset(string, xSize); @@ -261,65 +236,6 @@ public abstract class GuiForestry extends GuiContainer i return this.func_146978_c(par1Slot.xDisplayPosition, par1Slot.yDisplayPosition, 16, 16, par2, par3); } - @SuppressWarnings("rawtypes") - protected void drawTooltip(int mouseX, int mouseY, float zLevel, List information, EnumRarity rarity) { - - if (information.size() > 0) { - this.zLevel = 0f; - itemRender.zLevel = 0f; - - int tooltipWidth = 0; - - for (int i = 0; i < information.size(); ++i) { - int textWidth = this.fontRendererObj.getStringWidth((String) information.get(i)); - - if (textWidth > tooltipWidth) - tooltipWidth = textWidth; - } - - int xPos = mouseX - this.guiLeft + 12; - int yPos = mouseY - this.guiTop - 12; - int var14 = 8; - - if (information.size() > 1) - var14 += 2 + (information.size() - 1) * 10; - - this.zLevel = zLevel; - itemRender.zLevel = zLevel; - int var15 = -267386864; - this.drawGradientRect(xPos - 3, yPos - 4, xPos + tooltipWidth + 3, yPos - 3, var15, var15); - this.drawGradientRect(xPos - 3, yPos + var14 + 3, xPos + tooltipWidth + 3, yPos + var14 + 4, var15, var15); - this.drawGradientRect(xPos - 3, yPos - 3, xPos + tooltipWidth + 3, yPos + var14 + 3, var15, var15); - this.drawGradientRect(xPos - 4, yPos - 3, xPos - 3, yPos + var14 + 3, var15, var15); - this.drawGradientRect(xPos + tooltipWidth + 3, yPos - 3, xPos + tooltipWidth + 4, yPos + var14 + 3, var15, var15); - int var16 = 1347420415; - int var17 = (var16 & 16711422) >> 1 | var16 & -16777216; - this.drawGradientRect(xPos - 3, yPos - 3 + 1, xPos - 3 + 1, yPos + var14 + 3 - 1, var16, var17); - this.drawGradientRect(xPos + tooltipWidth + 2, yPos - 3 + 1, xPos + tooltipWidth + 3, yPos + var14 + 3 - 1, var16, var17); - this.drawGradientRect(xPos - 3, yPos - 3, xPos + tooltipWidth + 3, yPos - 3 + 1, var16, var16); - this.drawGradientRect(xPos - 3, yPos + var14 + 2, xPos + tooltipWidth + 3, yPos + var14 + 3, var17, var17); - - for (int i = 0; i < information.size(); ++i) { - String line = (String) information.get(i); - - if (i == 0) - line = "\u00a7" + rarity.rarityColor.getFormattingCode() + line; - else - line = "\u00a77" + line; - - this.fontRendererObj.drawStringWithShadow(line, xPos, yPos, -1); - - if (i == 0) - yPos += 2; - - yPos += 10; - } - - this.zLevel = 0.0F; - itemRender.zLevel = 0.0F; - } - } - public void drawToolTips(ToolTip toolTips, int mouseX, int mouseY) { if (toolTips == null) return; @@ -334,7 +250,7 @@ public abstract class GuiForestry extends GuiContainer i int y; for (ToolTipLine tip : toolTips) { - y = this.fontRendererObj.getStringWidth(tip.text); + y = this.fontRendererObj.getStringWidth(tip.getText()); height += 10 + tip.getSpacing(); if (y > length) @@ -364,12 +280,12 @@ public abstract class GuiForestry extends GuiContainer i this.drawGradientRect(x - 3, y + height, x + length + 2, y + height + 1, borderColorBottomInt, borderColorBottomInt); for (ToolTipLine tip : toolTips) { - String line = tip.text; + String line = tip.getText(); - if (tip.color == null) + if (tip.getColor() == null) line = "\u00a77" + line; else - line = "\u00a7" + tip.color.getFormattingCode() + line; + line = "\u00a7" + tip.getColor().getFormattingCode() + line; this.fontRendererObj.drawStringWithShadow(line, x, y, -1); diff --git a/src/main/java/forestry/core/gui/GuiTextBox.java b/src/main/java/forestry/core/gui/GuiTextBox.java index 28b9ef33f..48a92b981 100755 --- a/src/main/java/forestry/core/gui/GuiTextBox.java +++ b/src/main/java/forestry/core/gui/GuiTextBox.java @@ -69,21 +69,19 @@ public class GuiTextBox extends GuiTextField { @SuppressWarnings("unchecked") private void drawScrolledSplitString(String text, int startX, int startY, int width, int textColour) { - List list = fontRendererObj.listFormattedStringToWidth(text, width); - maxLines = list.size(); + List lines = fontRendererObj.listFormattedStringToWidth(text, width); + maxLines = lines.size(); int count = 0; int lineY = startY; - for (Iterator iterator = list.iterator(); iterator.hasNext();) { - if(count < lineScroll) { + for (String line : lines) { + if (count < lineScroll) { count++; continue; - } - else if(lineY + fontRendererObj.FONT_HEIGHT - startY > height) + } else if (lineY + fontRendererObj.FONT_HEIGHT - startY > height) break; - String line = iterator.next(); fontRendererObj.drawString(line, startX, lineY, textColour); lineY += fontRendererObj.FONT_HEIGHT; diff --git a/src/main/java/forestry/core/gui/HintLedger.java b/src/main/java/forestry/core/gui/HintLedger.java index aca55c209..61a2f4141 100755 --- a/src/main/java/forestry/core/gui/HintLedger.java +++ b/src/main/java/forestry/core/gui/HintLedger.java @@ -18,8 +18,8 @@ import forestry.core.utils.StringUtil; public class HintLedger extends Ledger { - int position; - String[] hints; + private final int position; + private final String[] hints; public HintLedger(LedgerManager manager, IHintSource tile) { super(manager); diff --git a/src/main/java/forestry/core/gui/Ledger.java b/src/main/java/forestry/core/gui/Ledger.java index 7e6745aa1..c011ee618 100755 --- a/src/main/java/forestry/core/gui/Ledger.java +++ b/src/main/java/forestry/core/gui/Ledger.java @@ -29,7 +29,7 @@ public abstract class Ledger { private static final int OPEN_SPEED = 8; private static final ResourceLocation ledgerTexture = new ForestryResource(Defaults.TEXTURE_PATH_GUI + "/ledger.png"); - protected LedgerManager manager; + protected final LedgerManager manager; private boolean open; diff --git a/src/main/java/forestry/core/gui/LedgerManager.java b/src/main/java/forestry/core/gui/LedgerManager.java index 96eefa8be..69aa3353c 100755 --- a/src/main/java/forestry/core/gui/LedgerManager.java +++ b/src/main/java/forestry/core/gui/LedgerManager.java @@ -22,10 +22,10 @@ import forestry.core.proxy.Proxies; public class LedgerManager { - public GuiForestry gui; - public Minecraft minecraft; + public final GuiForestry gui; + public final Minecraft minecraft; - protected ArrayList ledgers = new ArrayList(); + protected final ArrayList ledgers = new ArrayList(); public LedgerManager(GuiForestry gui) { this.gui = gui; @@ -52,8 +52,7 @@ public class LedgerManager { int xShift = ((gui.width - gui.getSizeX()) / 2) + gui.getSizeX(); int yShift = ((gui.height - gui.getSizeY()) / 2) + 8; - for (int i = 0; i < ledgers.size(); i++) { - Ledger ledger = ledgers.get(i); + for (Ledger ledger : ledgers) { if (!ledger.isVisible()) continue; diff --git a/src/main/java/forestry/core/gui/OwnerLedger.java b/src/main/java/forestry/core/gui/OwnerLedger.java index cfd3ee538..0fa6803b4 100755 --- a/src/main/java/forestry/core/gui/OwnerLedger.java +++ b/src/main/java/forestry/core/gui/OwnerLedger.java @@ -27,7 +27,7 @@ import forestry.core.utils.StringUtil; */ public class OwnerLedger extends Ledger { - IOwnable tile; + private final IOwnable tile; public OwnerLedger(LedgerManager manager, IOwnable tile) { super(manager); diff --git a/src/main/java/forestry/core/gui/PlainLedger.java b/src/main/java/forestry/core/gui/PlainLedger.java index 3b5fa3856..44dd0ad70 100755 --- a/src/main/java/forestry/core/gui/PlainLedger.java +++ b/src/main/java/forestry/core/gui/PlainLedger.java @@ -17,8 +17,8 @@ import net.minecraft.util.IIcon; */ public class PlainLedger extends Ledger { - private IIcon icon; - private String text; + private final IIcon icon; + private final String text; public PlainLedger(LedgerManager manager, IIcon icon, String text) { super(manager); diff --git a/src/main/java/forestry/core/gui/PowerLedger.java b/src/main/java/forestry/core/gui/PowerLedger.java index 87ca3b98d..4762dcff6 100755 --- a/src/main/java/forestry/core/gui/PowerLedger.java +++ b/src/main/java/forestry/core/gui/PowerLedger.java @@ -17,7 +17,7 @@ import forestry.energy.EnergyManager; public class PowerLedger extends Ledger { - IPowerHandler tile; + private final IPowerHandler tile; public PowerLedger(LedgerManager manager, IPowerHandler tile) { super(manager); diff --git a/src/main/java/forestry/core/gui/WidgetManager.java b/src/main/java/forestry/core/gui/WidgetManager.java index 4e66d7a76..f96f66a4b 100755 --- a/src/main/java/forestry/core/gui/WidgetManager.java +++ b/src/main/java/forestry/core/gui/WidgetManager.java @@ -22,9 +22,9 @@ import forestry.core.proxy.Proxies; public class WidgetManager { - public GuiForestry gui; - public Minecraft minecraft; - protected ArrayList widgets = new ArrayList(); + public final GuiForestry gui; + public final Minecraft minecraft; + protected final ArrayList widgets = new ArrayList(); public WidgetManager(GuiForestry gui) { this.gui = gui; diff --git a/src/main/java/forestry/core/gui/slots/SlotCraftAuto.java b/src/main/java/forestry/core/gui/slots/SlotCraftAuto.java index 40c7095ae..51687ae8c 100755 --- a/src/main/java/forestry/core/gui/slots/SlotCraftAuto.java +++ b/src/main/java/forestry/core/gui/slots/SlotCraftAuto.java @@ -20,8 +20,8 @@ import forestry.core.interfaces.IContainerCrafting; */ public class SlotCraftAuto extends Slot { - private IContainerCrafting eventHandler; - private int slot; + private final IContainerCrafting eventHandler; + private final int slot; public SlotCraftAuto(IContainerCrafting container, IInventory iinventory, int slotNumber, int x, int y) { super(iinventory, slotNumber, x, y); diff --git a/src/main/java/forestry/core/gui/slots/SlotCrafter.java b/src/main/java/forestry/core/gui/slots/SlotCrafter.java index c5bd06007..91bc54acf 100755 --- a/src/main/java/forestry/core/gui/slots/SlotCrafter.java +++ b/src/main/java/forestry/core/gui/slots/SlotCrafter.java @@ -19,7 +19,7 @@ import forestry.core.interfaces.ICrafter; public class SlotCrafter extends Slot { - ICrafter crafter; + private final ICrafter crafter; public SlotCrafter(IInventory inventory, ICrafter crafter, int slot, int xPos, int yPos) { super(inventory, slot, xPos, yPos); diff --git a/src/main/java/forestry/core/gui/slots/SlotCustom.java b/src/main/java/forestry/core/gui/slots/SlotCustom.java index e7624ccd1..50ce36767 100755 --- a/src/main/java/forestry/core/gui/slots/SlotCustom.java +++ b/src/main/java/forestry/core/gui/slots/SlotCustom.java @@ -10,18 +10,8 @@ ******************************************************************************/ package forestry.core.gui.slots; -import java.util.Collection; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - import forestry.api.genetics.ISpeciesRoot; import forestry.core.config.Defaults; import forestry.core.config.ForestryBlock; @@ -29,6 +19,12 @@ import forestry.core.config.ForestryItem; import forestry.core.interfaces.ICrafter; import forestry.core.render.TextureManager; import forestry.core.utils.StackUtils; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; /** * Slot which only specific items. (With permission by RichardG.) @@ -37,30 +33,11 @@ import forestry.core.utils.StackUtils; */ public class SlotCustom extends SlotForestry { - protected Object[] items; + protected final Object[] items; private boolean exclusion; private ICrafter crafter; private String blockedTexture = "slots/blocked"; - public SlotCustom(IInventory iinventory, int slotIndex, int xPos, int yPos, boolean exclusion) { - super(iinventory, slotIndex, xPos, yPos); - items = new Object[0]; - this.exclusion = exclusion; - } - - /*public SlotCustom(IInventory iinventory, ArrayList items, int i, int j, int k) { - this(iinventory, i, j, k, items.toArray()); - }*/ - - public SlotCustom(IInventory iinventory, Collection items, int slotIndex, int xPos, int yPos) { - this(iinventory, slotIndex, xPos, yPos, items.toArray()); - } - - public SlotCustom(IInventory iinventory, int slotIndex, int xPos, int yPos, boolean exclusion, Object... items) { - this(iinventory, slotIndex, xPos, yPos, items); - this.exclusion = exclusion; - } - public SlotCustom(IInventory iinventory, int slotIndex, int xPos, int yPos, Object... items) { super(iinventory, slotIndex, xPos, yPos); this.items = items; @@ -71,6 +48,11 @@ public class SlotCustom extends SlotForestry { return this; } + public SlotCustom setExclusion(boolean exclusion) { + this.exclusion = exclusion; + return this; + } + @Override public boolean isItemValid(ItemStack itemstack) { if (itemstack == null) @@ -124,7 +106,7 @@ public class SlotCustom extends SlotForestry { } else if (filter instanceof Block) { if (StackUtils.equals((Block) filter, itemstack)) return true; } else if (filter instanceof Item) { - if (itemstack.getItem() == (Item) filter) return true; + if (itemstack.getItem() == filter) return true; } else if (filter instanceof ForestryItem) { if (((ForestryItem) filter).isItemEqual(itemstack)) return true; } else if (filter instanceof ForestryBlock) { diff --git a/src/main/java/forestry/core/gui/slots/SlotItemInventory.java b/src/main/java/forestry/core/gui/slots/SlotItemInventory.java index a5e3a055e..d2f99fb1b 100755 --- a/src/main/java/forestry/core/gui/slots/SlotItemInventory.java +++ b/src/main/java/forestry/core/gui/slots/SlotItemInventory.java @@ -20,7 +20,7 @@ import forestry.core.gui.ContainerItemInventory; public class SlotItemInventory extends Slot { private final EntityPlayer player; - private ContainerItemInventory container; + private final ContainerItemInventory container; public SlotItemInventory(ContainerItemInventory container, IInventory inventory, EntityPlayer player, int par2, int par3, int par4) { super(inventory, par2, par3, par4); diff --git a/src/main/java/forestry/core/gui/tooltips/ToolTip.java b/src/main/java/forestry/core/gui/tooltips/ToolTip.java index a29384c37..d254a0ff8 100755 --- a/src/main/java/forestry/core/gui/tooltips/ToolTip.java +++ b/src/main/java/forestry/core/gui/tooltips/ToolTip.java @@ -67,7 +67,7 @@ public class ToolTip extends ForwardingList { public List convertToStrings() { List tips = new ArrayList(size()); for (ToolTipLine line : this) { - tips.add(line.text); + tips.add(line.getText()); } return tips; } diff --git a/src/main/java/forestry/core/gui/tooltips/ToolTipLine.java b/src/main/java/forestry/core/gui/tooltips/ToolTipLine.java index cd9f85b8f..a8fe70cc2 100755 --- a/src/main/java/forestry/core/gui/tooltips/ToolTipLine.java +++ b/src/main/java/forestry/core/gui/tooltips/ToolTipLine.java @@ -18,29 +18,34 @@ import net.minecraft.util.EnumChatFormatting; */ public class ToolTipLine { - public String text; - public final EnumChatFormatting color; - public int spacing; + private final String text; + private final EnumChatFormatting color; + private final int spacing; - public ToolTipLine(String text, EnumChatFormatting color) { + public ToolTipLine(String text, EnumChatFormatting color, int spacing) { this.text = text; this.color = color; + this.spacing = spacing; } public ToolTipLine(String text) { - this(text, null); + this(text, null, 0); } public ToolTipLine() { - this("", null); - } - - public void setSpacing(int spacing) { - this.spacing = spacing; + this("", null, 0); } public int getSpacing() { return spacing; } + public String getText() { + return text; + } + + public EnumChatFormatting getColor() { + return color; + } + } diff --git a/src/main/java/forestry/core/gui/widgets/SocketWidget.java b/src/main/java/forestry/core/gui/widgets/SocketWidget.java index b20f1926d..68d10ad25 100755 --- a/src/main/java/forestry/core/gui/widgets/SocketWidget.java +++ b/src/main/java/forestry/core/gui/widgets/SocketWidget.java @@ -27,8 +27,8 @@ import forestry.core.utils.StringUtil; public class SocketWidget extends Widget { - ISocketable tile; - int slot = 0; + private final ISocketable tile; + private final int slot; public SocketWidget(WidgetManager manager, int xPos, int yPos, ISocketable tile, int slot) { super(manager, xPos, yPos); diff --git a/src/main/java/forestry/core/gui/widgets/Widget.java b/src/main/java/forestry/core/gui/widgets/Widget.java index 9169ddde4..e0e2e45d6 100755 --- a/src/main/java/forestry/core/gui/widgets/Widget.java +++ b/src/main/java/forestry/core/gui/widgets/Widget.java @@ -22,7 +22,7 @@ import forestry.core.proxy.Proxies; */ public abstract class Widget implements IToolTipProvider { - protected WidgetManager manager; + protected final WidgetManager manager; protected int xPos; protected int yPos; protected int width = 16; diff --git a/src/main/java/forestry/core/inventory/ItemStackSizeSorter.java b/src/main/java/forestry/core/inventory/ItemStackSizeSorter.java deleted file mode 100755 index 71a8b7472..000000000 --- a/src/main/java/forestry/core/inventory/ItemStackSizeSorter.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v3 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: - * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges - ******************************************************************************/ -package forestry.core.inventory; - -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import net.minecraft.item.ItemStack; - -public class ItemStackSizeSorter implements Comparator { - - private static ItemStackSizeSorter instance; - - private static ItemStackSizeSorter getInstance() { - if (instance == null) { - instance = new ItemStackSizeSorter(); - } - return instance; - } - - public static void sort(List list) { - Collections.sort(list, getInstance()); - } - - @Override - public int compare(ItemStack o1, ItemStack o2) { - return o1.stackSize - o2.stackSize; - } - -} diff --git a/src/main/java/forestry/core/inventory/wrappers/InventoryIterator.java b/src/main/java/forestry/core/inventory/wrappers/InventoryIterator.java index 2837ee3e3..654e0e243 100755 --- a/src/main/java/forestry/core/inventory/wrappers/InventoryIterator.java +++ b/src/main/java/forestry/core/inventory/wrappers/InventoryIterator.java @@ -60,7 +60,7 @@ public class InventoryIterator implements Iterable { private class InvSlot implements IInvSlot { - private int slot; + private final int slot; public InvSlot(int slot) { this.slot = slot; diff --git a/src/main/java/forestry/core/inventory/wrappers/SidedInventoryIterator.java b/src/main/java/forestry/core/inventory/wrappers/SidedInventoryIterator.java index 88532074b..71ca7007a 100755 --- a/src/main/java/forestry/core/inventory/wrappers/SidedInventoryIterator.java +++ b/src/main/java/forestry/core/inventory/wrappers/SidedInventoryIterator.java @@ -29,7 +29,7 @@ public class SidedInventoryIterator implements Iterable { @Override public Iterator iterator() { return new Iterator() { - int[] slots = inv.getAccessibleSlotsFromSide(0); + final int[] slots = inv.getAccessibleSlotsFromSide(0); int index = 0; @Override @@ -52,7 +52,7 @@ public class SidedInventoryIterator implements Iterable { private class InvSlot implements IInvSlot { - private int slot; + private final int slot; public InvSlot(int slot) { this.slot = slot; diff --git a/src/main/java/forestry/core/items/ItemForestryTool.java b/src/main/java/forestry/core/items/ItemForestryTool.java index f5735de0a..866bcc48e 100755 --- a/src/main/java/forestry/core/items/ItemForestryTool.java +++ b/src/main/java/forestry/core/items/ItemForestryTool.java @@ -10,28 +10,28 @@ ******************************************************************************/ package forestry.core.items; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import forestry.core.proxy.Proxies; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.world.World; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; - import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -import forestry.core.proxy.Proxies; +import java.util.Arrays; +import java.util.List; public class ItemForestryTool extends ItemForestry { private final ItemStack remnants; protected float efficiencyOnProperMaterial; - private final Block[] blocksEffectiveAgainst; + private final List blocksEffectiveAgainst; public ItemForestryTool(Block[] blocksEffectiveAgainst, ItemStack remnants) { super(); - this.blocksEffectiveAgainst = blocksEffectiveAgainst; + this.blocksEffectiveAgainst = Arrays.asList(blocksEffectiveAgainst); this.maxStackSize = 1; efficiencyOnProperMaterial = 6F; setMaxDamage(200); @@ -40,9 +40,8 @@ public class ItemForestryTool extends ItemForestry { @Override public float func_150893_a(ItemStack itemstack, Block block) { - for (int i = 0; i < blocksEffectiveAgainst.length; i++) - if (blocksEffectiveAgainst[i] == block) - return efficiencyOnProperMaterial; + if (blocksEffectiveAgainst.contains(block)) + return efficiencyOnProperMaterial; return 1.0F; } @@ -71,11 +70,6 @@ public class ItemForestryTool extends ItemForestry { return true; } - /*@Override - public float getDamageVsEntity(Entity entity, ItemStack itemstack) { - return 1; - }*/ - @Override public boolean isFull3D() { return true; diff --git a/src/main/java/forestry/core/items/ItemInventoried.java b/src/main/java/forestry/core/items/ItemInventoried.java index af0052575..936027863 100755 --- a/src/main/java/forestry/core/items/ItemInventoried.java +++ b/src/main/java/forestry/core/items/ItemInventoried.java @@ -28,7 +28,7 @@ public abstract class ItemInventoried extends ItemForestry implements IInventori if (itemstack != null && player instanceof EntityPlayerMP && player.openContainer instanceof ContainerItemInventory) - ((EntityPlayerMP) player).closeScreen(); + player.closeScreen(); return super.onDroppedByPlayer(itemstack, player); } diff --git a/src/main/java/forestry/core/items/ItemLiquids.java b/src/main/java/forestry/core/items/ItemLiquids.java deleted file mode 100755 index cdaf6cf0e..000000000 --- a/src/main/java/forestry/core/items/ItemLiquids.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v3 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: - * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges - ******************************************************************************/ -package forestry.core.items; - -public class ItemLiquids extends ItemForestry { - - public ItemLiquids() { - super(); - setCreativeTab(null); - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean isRepairable() { - return false; - } - - /* - * //@Override Client side only public String getItemStackDisplayName(ItemStack itemstack) { switch(itemstack.getItemDamage()) { case 0: return "Liquid Honey"; - * case 1: return "Liquid Mead"; default: return "Unknown Item"; } } - * - * //@Override Client side only public int getIconFromDamage(int damage) { switch(damage) { case 0: return 76; case 1: return 77; default: return 0; } } - * - * @Override public void addCreativeItems(ArrayList itemList) { //for(int i = 0; i < 2; i++) // itemList.add(new ItemStack(this, 1, i)); } - */ -} diff --git a/src/main/java/forestry/core/items/ItemMisc.java b/src/main/java/forestry/core/items/ItemMisc.java index efb5f1f21..f166f60b8 100755 --- a/src/main/java/forestry/core/items/ItemMisc.java +++ b/src/main/java/forestry/core/items/ItemMisc.java @@ -10,23 +10,20 @@ ******************************************************************************/ package forestry.core.items; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import forestry.core.render.TextureManager; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import forestry.core.render.TextureManager; -import java.util.Locale; +import java.util.List; public class ItemMisc extends ItemForestry { - String[] definition = new String[]{"pulsatingDust", "pulsatingMesh", "silkWisp", "wovenSilk", "dissipationCharge", "iceShard", "scentedPaneling"}; + private final String[] definition = new String[]{"pulsatingDust", "pulsatingMesh", "silkWisp", "wovenSilk", "dissipationCharge", "iceShard", "scentedPaneling"}; public ItemMisc() { super(); diff --git a/src/main/java/forestry/core/items/ItemOverlay.java b/src/main/java/forestry/core/items/ItemOverlay.java index b5d233f7c..910835fdc 100755 --- a/src/main/java/forestry/core/items/ItemOverlay.java +++ b/src/main/java/forestry/core/items/ItemOverlay.java @@ -29,9 +29,9 @@ public class ItemOverlay extends ItemForestry { public static class OverlayInfo { - public String name; - public int primaryColor = 0; - public int secondaryColor = 0; + public final String name; + public final int primaryColor; + public final int secondaryColor; public boolean isSecret = false; public OverlayInfo(String name, int primaryColor, int secondaryColor) { diff --git a/src/main/java/forestry/core/network/ClassMap.java b/src/main/java/forestry/core/network/ClassMap.java index 9791bcd6b..02fb6b930 100755 --- a/src/main/java/forestry/core/network/ClassMap.java +++ b/src/main/java/forestry/core/network/ClassMap.java @@ -23,7 +23,7 @@ import forestry.core.gadgets.TileForestry; public class ClassMap { @SuppressWarnings("rawtypes") - public static HashMap classMappers = new HashMap(); + public static final HashMap classMappers = new HashMap(); private final LinkedList intMember = new LinkedList(); private final LinkedList floatMember = new LinkedList(); diff --git a/src/main/java/forestry/core/network/PacketSocketUpdate.java b/src/main/java/forestry/core/network/PacketSocketUpdate.java index d27be4f52..0a8991727 100755 --- a/src/main/java/forestry/core/network/PacketSocketUpdate.java +++ b/src/main/java/forestry/core/network/PacketSocketUpdate.java @@ -38,8 +38,8 @@ public class PacketSocketUpdate extends PacketCoordinates { super.writeData(data); data.writeShort(itemstacks.length); - for (int i = 0; i < itemstacks.length; i++) - writeItemStack(itemstacks[i], data); + for (ItemStack itemstack : itemstacks) + writeItemStack(itemstack, data); } @Override diff --git a/src/main/java/forestry/core/proxy/Proxies.java b/src/main/java/forestry/core/proxy/Proxies.java index 7fd3240c3..ca6d94ec7 100755 --- a/src/main/java/forestry/core/proxy/Proxies.java +++ b/src/main/java/forestry/core/proxy/Proxies.java @@ -20,5 +20,5 @@ public class Proxies { @SidedProxy(clientSide = "forestry.core.proxy.ClientProxyRender", serverSide = "forestry.core.proxy.ProxyRender") public static ProxyRender render; - public static ProxyLog log = new ProxyLog(); + public static final ProxyLog log = new ProxyLog(); } diff --git a/src/main/java/forestry/core/proxy/ProxyCommon.java b/src/main/java/forestry/core/proxy/ProxyCommon.java index ebe76bdb6..9e34c3563 100755 --- a/src/main/java/forestry/core/proxy/ProxyCommon.java +++ b/src/main/java/forestry/core/proxy/ProxyCommon.java @@ -243,7 +243,7 @@ public class ProxyCommon { } public void closeGUI(EntityPlayer player) { - ((EntityPlayerMP) player).closeScreen(); + player.closeScreen(); } /* DEPENDENCY HANDLING */ diff --git a/src/main/java/forestry/core/proxy/ProxyNetwork.java b/src/main/java/forestry/core/proxy/ProxyNetwork.java index 516c76eaa..29264c722 100755 --- a/src/main/java/forestry/core/proxy/ProxyNetwork.java +++ b/src/main/java/forestry/core/proxy/ProxyNetwork.java @@ -28,9 +28,9 @@ public class ProxyNetwork { return; World[] worlds = DimensionManager.getWorlds(); - for (int i = 0; i < worlds.length; i++) - for (int j = 0; j < worlds[i].playerEntities.size(); j++) { - EntityPlayerMP player = (EntityPlayerMP) worlds[i].playerEntities.get(j); + for (World world : worlds) + for (int j = 0; j < world.playerEntities.size(); j++) { + EntityPlayerMP player = (EntityPlayerMP) world.playerEntities.get(j); if (Math.abs(player.posX - x) <= Defaults.NET_MAX_UPDATE_DISTANCE && Math.abs(player.posY - y) <= Defaults.NET_MAX_UPDATE_DISTANCE && Math.abs(player.posZ - z) <= Defaults.NET_MAX_UPDATE_DISTANCE) diff --git a/src/main/java/forestry/core/render/BlockRenderingHandler.java b/src/main/java/forestry/core/render/BlockRenderingHandler.java index 23e16a9e5..1993f8e65 100755 --- a/src/main/java/forestry/core/render/BlockRenderingHandler.java +++ b/src/main/java/forestry/core/render/BlockRenderingHandler.java @@ -23,7 +23,7 @@ import forestry.core.interfaces.IBlockRenderer; public class BlockRenderingHandler implements ISimpleBlockRenderingHandler { - public static HashMap byBlockRenderer = new HashMap(); + public static final HashMap byBlockRenderer = new HashMap(); @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { diff --git a/src/main/java/forestry/core/render/ModelEscritoire.java b/src/main/java/forestry/core/render/ModelEscritoire.java index 8229ecf4f..848bd0310 100755 --- a/src/main/java/forestry/core/render/ModelEscritoire.java +++ b/src/main/java/forestry/core/render/ModelEscritoire.java @@ -17,16 +17,16 @@ import net.minecraft.entity.Entity; public class ModelEscritoire extends ModelBase { //fields - ModelRenderer desk; - ModelRenderer standRB; - ModelRenderer standRF; - ModelRenderer standLB; - ModelRenderer standLF; - ModelRenderer drawers; - ModelRenderer standLowLF; - ModelRenderer standLowRB; - ModelRenderer standLowRF; - ModelRenderer standLowLB; + private final ModelRenderer desk; + private final ModelRenderer standRB; + private final ModelRenderer standRF; + private final ModelRenderer standLB; + private final ModelRenderer standLF; + private final ModelRenderer drawers; + private final ModelRenderer standLowLF; + private final ModelRenderer standLowRB; + private final ModelRenderer standLowRF; + private final ModelRenderer standLowLB; public ModelEscritoire() { textureWidth = 64; diff --git a/src/main/java/forestry/core/render/RenderEscritoire.java b/src/main/java/forestry/core/render/RenderEscritoire.java index cbb170a54..64b8441fd 100755 --- a/src/main/java/forestry/core/render/RenderEscritoire.java +++ b/src/main/java/forestry/core/render/RenderEscritoire.java @@ -29,8 +29,8 @@ import forestry.core.utils.ForestryResource; public class RenderEscritoire extends TileEntitySpecialRenderer implements IBlockRenderer { - ModelEscritoire modelEscritoire; - ResourceLocation texture = new ForestryResource(Defaults.TEXTURE_PATH_BLOCKS + "/escritoire.png"); + private final ModelEscritoire modelEscritoire; + private final ResourceLocation texture = new ForestryResource(Defaults.TEXTURE_PATH_BLOCKS + "/escritoire.png"); //private final EntityItem dummyEntityItem = new EntityItem(null); private final RenderItem customRenderItem; diff --git a/src/main/java/forestry/core/render/TextureManager.java b/src/main/java/forestry/core/render/TextureManager.java index 35ee497b1..66b5e09dc 100755 --- a/src/main/java/forestry/core/render/TextureManager.java +++ b/src/main/java/forestry/core/render/TextureManager.java @@ -37,39 +37,31 @@ public class TextureManager implements ITextureManager { return instance; } - String[] defaultIconNames = new String[] { "habitats/desert", "habitats/end", "habitats/forest", "habitats/hills", "habitats/jungle", "habitats/mushroom", - "habitats/nether", "habitats/ocean", "habitats/plains", "habitats/snow", "habitats/swamp", "habitats/taiga", "misc/access.private", - "misc/access.viewable", "misc/access.shared", "misc/energy", "misc/hint", - "analyzer/anything", "analyzer/bee", "analyzer/cave", "analyzer/closed", "analyzer/drone", "analyzer/flyer", - "analyzer/item", "analyzer/nocturnal", "analyzer/princess", "analyzer/pure_breed", "analyzer/pure_cave", - "analyzer/pure_flyer", "analyzer/pure_nocturnal", "analyzer/queen", - "particles/ember", "particles/flame", "particles/poison", "particles/swarm_bee", "errors/errored", - "slots/blocked", "slots/blocked_2", "slots/liquid", "slots/container", "slots/locked", - "mail/carrier.player", "mail/carrier.trader" }; - HashMap defaultIcons = new HashMap(); + private final HashMap defaultIcons = new HashMap(); + + private final IIcon[] textures = new IIcon[2048]; + + private final ArrayList iconProvider = new ArrayList(); + + private TextureManager() { + } public void initDefaultIcons(IIconRegister register) { + String[] defaultIconNames = new String[] { "habitats/desert", "habitats/end", "habitats/forest", "habitats/hills", "habitats/jungle", "habitats/mushroom", + "habitats/nether", "habitats/ocean", "habitats/plains", "habitats/snow", "habitats/swamp", "habitats/taiga", "misc/access.private", + "misc/access.viewable", "misc/access.shared", "misc/energy", "misc/hint", + "analyzer/anything", "analyzer/bee", "analyzer/cave", "analyzer/closed", "analyzer/drone", "analyzer/flyer", + "analyzer/item", "analyzer/nocturnal", "analyzer/princess", "analyzer/pure_breed", "analyzer/pure_cave", + "analyzer/pure_flyer", "analyzer/pure_nocturnal", "analyzer/queen", + "particles/ember", "particles/flame", "particles/poison", "particles/swarm_bee", "errors/errored", + "slots/blocked", "slots/blocked_2", "slots/liquid", "slots/container", "slots/locked", + "mail/carrier.player", "mail/carrier.trader" }; for (String str : defaultIconNames) - defaultIcons.put(str, TextureManager.getInstance().registerTex(register, str)); + defaultIcons.put(str, registerTex(register, str)); } public IIcon getDefault(String ident) { - if (defaultIcons.containsKey(ident)) - return defaultIcons.get(ident); - else - return null; - } - - //public TextureMap terrainMap; - //public TextureMap itemMap; - - IIcon[] textures = new IIcon[2048]; - - ArrayList iconProvider = new ArrayList(); - - public TextureManager() { - //this.terrainMap = textureMap; - //this.itemMap = itemMap; + return defaultIcons.get(ident); } public IIcon registerTex(IIconRegister register, String identifier) { diff --git a/src/main/java/forestry/core/render/TileRendererIndex.java b/src/main/java/forestry/core/render/TileRendererIndex.java index a91522ded..190602ad7 100755 --- a/src/main/java/forestry/core/render/TileRendererIndex.java +++ b/src/main/java/forestry/core/render/TileRendererIndex.java @@ -13,8 +13,8 @@ package forestry.core.render; import net.minecraft.block.Block; public class TileRendererIndex { - private Block block; - private int meta; + private final Block block; + private final int meta; public TileRendererIndex(Block block, int meta) { this.block = block; diff --git a/src/main/java/forestry/core/utils/BlockUtil.java b/src/main/java/forestry/core/utils/BlockUtil.java index a606d49b3..772aff52c 100644 --- a/src/main/java/forestry/core/utils/BlockUtil.java +++ b/src/main/java/forestry/core/utils/BlockUtil.java @@ -99,13 +99,13 @@ public class BlockUtil { } - public static ArrayList filterPipeDirections(ForgeDirection[] all, ForgeDirection[] exclude) { + public static ArrayList filterPipeDirections(ForgeDirection[] allDirections, ForgeDirection[] exclude) { ArrayList filtered = new ArrayList(); ArrayList excludeList = new ArrayList(Arrays.asList(exclude)); - for (int i = 0; i < all.length; i++) - if (!excludeList.contains(all[i])) - filtered.add(all[i]); + for (ForgeDirection direction : allDirections) + if (!excludeList.contains(direction)) + filtered.add(direction); return filtered; diff --git a/src/main/java/forestry/core/utils/FluidMap.java b/src/main/java/forestry/core/utils/FluidMap.java index 89b3053ef..6810327f8 100755 --- a/src/main/java/forestry/core/utils/FluidMap.java +++ b/src/main/java/forestry/core/utils/FluidMap.java @@ -22,9 +22,9 @@ public class FluidMap extends StackMap { if (b instanceof FluidStack) return ((FluidStack) b).getFluid() == a; if (b instanceof Fluid) - return ((Fluid) b) == a; + return b == a; if (b instanceof String) - return ((String) b).equals(a.getName()); + return b.equals(a.getName()); return false; } diff --git a/src/main/java/forestry/core/utils/FluidStackMap.java b/src/main/java/forestry/core/utils/FluidStackMap.java index 4e8c31f70..757c2b466 100755 --- a/src/main/java/forestry/core/utils/FluidStackMap.java +++ b/src/main/java/forestry/core/utils/FluidStackMap.java @@ -24,7 +24,7 @@ public class FluidStackMap extends StackMap { if(b instanceof Fluid) { return ((Fluid)b).getID() == a.getFluid().getID(); } if(b instanceof String) - return ((String)b).equals(a.getFluid().getName()); + return b.equals(a.getFluid().getName()); return false; } diff --git a/src/main/java/forestry/core/utils/IDAllocator.java b/src/main/java/forestry/core/utils/IDAllocator.java deleted file mode 100755 index 236339981..000000000 --- a/src/main/java/forestry/core/utils/IDAllocator.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v3 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: - * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges - ******************************************************************************/ -package forestry.core.utils; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.world.World; -import net.minecraft.world.WorldSavedData; - -public class IDAllocator extends WorldSavedData { - - public static String SAVE_NAME = "IDAlloc"; - - public static IDAllocator cachedIDAllocator; - - private final int maxId = 2048; - - public static IDAllocator getIDAllocator(World world, String type) { - if (cachedIDAllocator != null) - return cachedIDAllocator; - - IDAllocator allocator = (IDAllocator) world.loadItemData(IDAllocator.class, SAVE_NAME + "." + type); - if (allocator == null) { - allocator = new IDAllocator(SAVE_NAME + "." + type); - world.setItemData(SAVE_NAME + type, allocator); - } - - cachedIDAllocator = allocator; - return allocator; - } - - public IDAllocator(String par1Str) { - super(par1Str); - } - - public HashMap idMap = new HashMap(); - - public int getId(String uid) { - if (idMap.containsKey(uid)) - return idMap.get(uid); - - for (int i = 0; i < maxId; i++) - if (!idMap.containsValue(i)) { - idMap.put(uid, i); - this.markDirty(); - return i; - } - - throw new RuntimeException("No ids left for the type: " + uid); - } - - @Override - public void readFromNBT(NBTTagCompound nbttagcompound) { - - NBTTagList nbttaglist = nbttagcompound.getTagList("IdMap", 10); - for (int i = 0; i < nbttaglist.tagCount(); i++) { - NBTTagCompound subcompound = nbttaglist.getCompoundTagAt(i); - idMap.put(subcompound.getString("UID"), subcompound.getInteger("Id")); - } - - } - - @Override - public void writeToNBT(NBTTagCompound nbttagcompound) { - - NBTTagList nbttaglist = new NBTTagList(); - Iterator> it = idMap.entrySet().iterator(); - while (it.hasNext()) { - Entry entry = it.next(); - NBTTagCompound subcompound = new NBTTagCompound(); - subcompound.setString("UID", entry.getKey()); - subcompound.setInteger("Id", entry.getValue()); - nbttaglist.appendTag(subcompound); - } - nbttagcompound.setTag("IdMap", nbttaglist); - - } - -} diff --git a/src/main/java/forestry/core/utils/ItemStackMap.java b/src/main/java/forestry/core/utils/ItemStackMap.java index 73c215c70..2cecc37d4 100755 --- a/src/main/java/forestry/core/utils/ItemStackMap.java +++ b/src/main/java/forestry/core/utils/ItemStackMap.java @@ -26,7 +26,7 @@ public class ItemStackMap extends StackMap { return a.isItemEqual(b2) && ItemStack.areItemStackTagsEqual(a, b2); } if(b instanceof Item) { - return a.getItem() == (Item) b; + return a.getItem() == b; } if(b instanceof String) { for(ItemStack stack : OreDictionary.getOres((String) b)) { diff --git a/src/main/java/forestry/core/utils/Schemata.java b/src/main/java/forestry/core/utils/Schemata.java index 039b7b42a..968d6a698 100755 --- a/src/main/java/forestry/core/utils/Schemata.java +++ b/src/main/java/forestry/core/utils/Schemata.java @@ -16,7 +16,7 @@ public class Schemata { public enum EnumStructureBlock { ANY('X'), FOREIGN('F'), AIR('O'), MASTER('M'), GLASS('G'), BLOCK_A('A'), BLOCK_B('B'), BLOCK_C('C'), BLOCK_D('D'), BLOCK_E('E'); - private char key; + private final char key; private EnumStructureBlock(char key) { this.key = key; @@ -28,8 +28,10 @@ public class Schemata { } private final String uid; - private EnumStructureBlock[][][] structure; - private int width, height, depth; + private final EnumStructureBlock[][][] structure; + private final int width; + private final int height; + private final int depth; private int xOffset, yOffset, zOffset = -1; public Schemata(String uid, int width, int height, int depth, String... patterns) { diff --git a/src/main/java/forestry/core/utils/ShapedRecipeCustom.java b/src/main/java/forestry/core/utils/ShapedRecipeCustom.java index 5ca111b38..b81c79518 100755 --- a/src/main/java/forestry/core/utils/ShapedRecipeCustom.java +++ b/src/main/java/forestry/core/utils/ShapedRecipeCustom.java @@ -198,8 +198,7 @@ public class ShapedRecipeCustom implements IDescriptiveRecipe { int rows = 0; if (materials[index] instanceof String[]) { String as[] = (String[]) materials[index++]; - for (int l = 0; l < as.length; l++) { - String pattern = as[l]; + for (String pattern : as) { rows++; columns = pattern.length(); s = (new StringBuilder()).append(s).append(pattern).toString(); diff --git a/src/main/java/forestry/core/utils/TileInventoryAdapter.java b/src/main/java/forestry/core/utils/TileInventoryAdapter.java index f21e26290..d88b17f40 100755 --- a/src/main/java/forestry/core/utils/TileInventoryAdapter.java +++ b/src/main/java/forestry/core/utils/TileInventoryAdapter.java @@ -16,7 +16,7 @@ import forestry.core.gadgets.TileForestry; public class TileInventoryAdapter extends InventoryAdapter { - TileForestry tile; + private final TileForestry tile; public TileInventoryAdapter(TileForestry tile, int size, String name) { super(size, name); diff --git a/src/main/java/forestry/core/utils/Utils.java b/src/main/java/forestry/core/utils/Utils.java index 03a463e4c..06bc7b70f 100755 --- a/src/main/java/forestry/core/utils/Utils.java +++ b/src/main/java/forestry/core/utils/Utils.java @@ -126,14 +126,6 @@ public class Utils { && ((IArmorNaturalist) armorItem.getItem()).canSeePollination(player, armorItem, true); } - @SuppressWarnings("rawtypes") - public static void broadcastMessage(World world, String message) { - for (Iterator iterator = world.playerEntities.iterator(); iterator.hasNext();) { - EntityPlayer entityplayer = (EntityPlayer) iterator.next(); - entityplayer.addChatMessage(new ChatComponentText(message)); - } - } - public static IInventory getChest(IInventory inventory) { if (!(inventory instanceof TileEntityChest)) return inventory; @@ -264,7 +256,7 @@ public class Utils { spawn.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0f), 0.0f); living.rotationYawHead = living.rotationYaw; living.renderYawOffset = living.rotationYaw; - living.onSpawnWithEgg((IEntityLivingData) null); + living.onSpawnWithEgg(null); world.spawnEntityInWorld(spawn); living.playLivingSound(); } diff --git a/src/main/java/forestry/core/worldgen/BlockType.java b/src/main/java/forestry/core/worldgen/BlockType.java index 3b08bfe27..549a49498 100755 --- a/src/main/java/forestry/core/worldgen/BlockType.java +++ b/src/main/java/forestry/core/worldgen/BlockType.java @@ -19,8 +19,8 @@ import forestry.core.config.ForestryBlock; public class BlockType { - Block block; - int meta; + private final Block block; + private final int meta; public BlockType(Block block, int meta) { this.block = block; diff --git a/src/main/java/forestry/core/worldgen/WorldGenBase.java b/src/main/java/forestry/core/worldgen/WorldGenBase.java index 4ac9c3b6b..488863351 100755 --- a/src/main/java/forestry/core/worldgen/WorldGenBase.java +++ b/src/main/java/forestry/core/worldgen/WorldGenBase.java @@ -29,9 +29,9 @@ public abstract class WorldGenBase extends WorldGenerator { this.y = h; this.z = g; } - float x; - float y; - float z; + public final float x; + public final float y; + public final float z; public static double distance(Vector a, Vector b) { return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2) + Math.pow(a.z - b.z, 2)); diff --git a/src/main/java/forestry/energy/gadgets/EngineTin.java b/src/main/java/forestry/energy/gadgets/EngineTin.java index 21c80ae32..e584daadc 100755 --- a/src/main/java/forestry/energy/gadgets/EngineTin.java +++ b/src/main/java/forestry/energy/gadgets/EngineTin.java @@ -357,13 +357,11 @@ public class EngineTin extends Engine implements ISocketable, IInventory { chipset.onRemoval(this); } + sockets.setInventorySlotContents(slot, stack); if (stack == null) { - sockets.setInventorySlotContents(slot, stack); return; } - sockets.setInventorySlotContents(slot, stack); - ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitboard(stack); if (chipset != null) chipset.onInsertion(this); diff --git a/src/main/java/forestry/energy/gadgets/MachineGenerator.java b/src/main/java/forestry/energy/gadgets/MachineGenerator.java index 949663f03..bcec54700 100755 --- a/src/main/java/forestry/energy/gadgets/MachineGenerator.java +++ b/src/main/java/forestry/energy/gadgets/MachineGenerator.java @@ -52,11 +52,11 @@ public class MachineGenerator extends TileBase implements ISpecialInventory, ILi public static final int maxEnergy = 30000; @EntityNetData - public FilteredTank resourceTank; + public final FilteredTank resourceTank; private final TankManager tankManager; private int tickCount = 0; - InventoryAdapter inventory = new InventoryAdapter(1, "Items"); + private final InventoryAdapter inventory = new InventoryAdapter(1, "Items"); protected BasicSource ic2EnergySource; public MachineGenerator() { diff --git a/src/main/java/forestry/energy/gui/ContainerEngineBronze.java b/src/main/java/forestry/energy/gui/ContainerEngineBronze.java index a7fdf5c87..c0f4c498e 100755 --- a/src/main/java/forestry/energy/gui/ContainerEngineBronze.java +++ b/src/main/java/forestry/energy/gui/ContainerEngineBronze.java @@ -10,17 +10,15 @@ ******************************************************************************/ package forestry.energy.gui; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - import forestry.core.gui.ContainerLiquidTanks; import forestry.core.gui.slots.SlotLiquidContainer; import forestry.energy.gadgets.EngineBronze; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; public class ContainerEngineBronze extends ContainerLiquidTanks { - protected EngineBronze engine; + protected final EngineBronze engine; public ContainerEngineBronze(InventoryPlayer player, EngineBronze engine) { super(engine, engine); diff --git a/src/main/java/forestry/energy/gui/ContainerEngineCopper.java b/src/main/java/forestry/energy/gui/ContainerEngineCopper.java index b174f3c99..bd678ff3d 100755 --- a/src/main/java/forestry/energy/gui/ContainerEngineCopper.java +++ b/src/main/java/forestry/energy/gui/ContainerEngineCopper.java @@ -20,7 +20,7 @@ import forestry.core.gui.slots.SlotClosed; import forestry.energy.gadgets.EngineCopper; public class ContainerEngineCopper extends ContainerForestry { - protected EngineCopper engine; + protected final EngineCopper engine; public ContainerEngineCopper(InventoryPlayer player, EngineCopper tile) { super(tile); @@ -52,8 +52,8 @@ public class ContainerEngineCopper extends ContainerForestry { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) - engine.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) + engine.sendGUINetworkData(this, (ICrafting) crafter); } @Override diff --git a/src/main/java/forestry/energy/gui/ContainerEngineTin.java b/src/main/java/forestry/energy/gui/ContainerEngineTin.java index ab80a60ae..d026931ce 100755 --- a/src/main/java/forestry/energy/gui/ContainerEngineTin.java +++ b/src/main/java/forestry/energy/gui/ContainerEngineTin.java @@ -19,7 +19,7 @@ import forestry.energy.gadgets.EngineTin; public class ContainerEngineTin extends ContainerSocketed { - protected EngineTin tile; + protected final EngineTin tile; public ContainerEngineTin(InventoryPlayer player, EngineTin tile) { super(tile, tile); @@ -49,8 +49,8 @@ public class ContainerEngineTin extends ContainerSocketed { if (tile == null) return; - for (int i = 0; i < crafters.size(); i++) - tile.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) + tile.sendGUINetworkData(this, (ICrafting) crafter); } } diff --git a/src/main/java/forestry/energy/gui/ContainerGenerator.java b/src/main/java/forestry/energy/gui/ContainerGenerator.java index 8f4f75d35..570a909d2 100755 --- a/src/main/java/forestry/energy/gui/ContainerGenerator.java +++ b/src/main/java/forestry/energy/gui/ContainerGenerator.java @@ -10,18 +10,16 @@ ******************************************************************************/ package forestry.energy.gui; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - import forestry.core.gui.ContainerLiquidTanks; import forestry.core.gui.slots.SlotLiquidContainer; import forestry.energy.gadgets.MachineGenerator; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; public class ContainerGenerator extends ContainerLiquidTanks { - protected MachineGenerator tile; + protected final MachineGenerator tile; public ContainerGenerator(InventoryPlayer player, MachineGenerator tile) { super(tile, tile); diff --git a/src/main/java/forestry/energy/gui/GuiEngineCopper.java b/src/main/java/forestry/energy/gui/GuiEngineCopper.java index df8193097..304746688 100755 --- a/src/main/java/forestry/energy/gui/GuiEngineCopper.java +++ b/src/main/java/forestry/energy/gui/GuiEngineCopper.java @@ -34,7 +34,7 @@ public class GuiEngineCopper extends GuiEngine { int progress; if (engine.isBurning()) { progress = engine.getBurnTimeRemainingScaled(12); - this.drawTexturedModalRect(guiLeft + 45, guiTop + 27 + 12 - progress, 176, 0 + 12 - progress, 14, progress + 2); + this.drawTexturedModalRect(guiLeft + 45, guiTop + 27 + 12 - progress, 176, 12 - progress, 14, progress + 2); } } } diff --git a/src/main/java/forestry/factory/gadgets/MachineBottler.java b/src/main/java/forestry/factory/gadgets/MachineBottler.java index 731d6c288..0e9d01fcd 100755 --- a/src/main/java/forestry/factory/gadgets/MachineBottler.java +++ b/src/main/java/forestry/factory/gadgets/MachineBottler.java @@ -86,7 +86,7 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq } public static class RecipeManager implements ICraftingProvider { - public static ArrayList recipes = new ArrayList(); + public static final ArrayList recipes = new ArrayList(); /** * @@ -99,8 +99,7 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq if (res == null || empty == null) return null; - for (int i = 0; i < recipes.size(); i++) { - Recipe recipe = recipes.get(i); + for (Recipe recipe : recipes) { if (recipe.matches(res, empty)) return recipe; } @@ -142,7 +141,7 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq } @EntityNetData - public StandardTank resourceTank; + public final StandardTank resourceTank; private final TankManager tankManager; private final InventoryAdapter inventory = new InventoryAdapter(3, "Items"); diff --git a/src/main/java/forestry/factory/gadgets/MachineCarpenter.java b/src/main/java/forestry/factory/gadgets/MachineCarpenter.java index b3f7cd37e..3ce691173 100755 --- a/src/main/java/forestry/factory/gadgets/MachineCarpenter.java +++ b/src/main/java/forestry/factory/gadgets/MachineCarpenter.java @@ -138,8 +138,8 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL public static class RecipeManager implements ICarpenterManager { - public static ArrayList recipes = new ArrayList(); - public static HashSet recipeFluids = new HashSet(); + public static final ArrayList recipes = new ArrayList(); + public static final HashSet recipeFluids = new HashSet(); @Override public void addCrating(ItemStack itemStack) { @@ -174,8 +174,7 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL } public static Recipe findMatchingRecipe(FluidStack liquid, ItemStack item, InventoryCrafting inventorycrafting, World world) { - for (int i = 0; i < recipes.size(); i++) { - Recipe recipe = recipes.get(i); + for (Recipe recipe : recipes) { if (recipe.matches(liquid, item, inventorycrafting, world)) return recipe; } @@ -210,7 +209,7 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL /* MEMBER */ @EntityNetData - public FilteredTank resourceTank; + public final FilteredTank resourceTank; private final TankManager tankManager; private final TileInventoryAdapter craftingInventory; private final TileInventoryAdapter accessibleInventory; diff --git a/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java b/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java index f3b7ef02b..cf1b0a6e7 100755 --- a/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java +++ b/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java @@ -76,7 +76,7 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory, I } public static class RecipeManager implements ICentrifugeManager { - public static ArrayList recipes = new ArrayList(); + public static final ArrayList recipes = new ArrayList(); @Override public void addRecipe(int timePerItem, ItemStack resource, HashMap products) { @@ -113,8 +113,7 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory, I } public static Recipe findMatchingRecipe(ItemStack item) { - for (int i = 0; i < recipes.size(); i++) { - Recipe recipe = recipes.get(i); + for (Recipe recipe : recipes) { if (recipe.matches(item)) return recipe; } diff --git a/src/main/java/forestry/factory/gadgets/MachineFabricator.java b/src/main/java/forestry/factory/gadgets/MachineFabricator.java index 9b7756944..f591b17db 100755 --- a/src/main/java/forestry/factory/gadgets/MachineFabricator.java +++ b/src/main/java/forestry/factory/gadgets/MachineFabricator.java @@ -51,10 +51,10 @@ public class MachineFabricator extends TilePowered implements ICrafter, ISpecial /* RECIPE MANAGMENT */ public static class Recipe { - ItemStack plan; + private final ItemStack plan; - FluidStack molten; - ShapedRecipeCustom internal; + private final FluidStack molten; + private final ShapedRecipeCustom internal; public Recipe(ItemStack plan, FluidStack molten, ShapedRecipeCustom internal) { this.plan = plan; @@ -65,10 +65,7 @@ public class MachineFabricator extends TilePowered implements ICrafter, ISpecial public boolean matches(ItemStack plan) { if (this.plan == null) return true; - - if (plan == null && this.plan == null) - return true; - else if (plan == null && this.plan != null) + else if (plan == null) return false; if (this.plan.getItemDamage() == Defaults.WILDCARD) @@ -146,8 +143,8 @@ public class MachineFabricator extends TilePowered implements ICrafter, ISpecial } public static class RecipeManager implements IFabricatorManager { - public static ArrayList recipes = new ArrayList(); - public static ArrayList smeltings = new ArrayList(); + public static final ArrayList recipes = new ArrayList(); + public static final ArrayList smeltings = new ArrayList(); @Override public void addRecipe(ItemStack plan, FluidStack molten, ItemStack result, Object[] pattern) { diff --git a/src/main/java/forestry/factory/gadgets/MachineFermenter.java b/src/main/java/forestry/factory/gadgets/MachineFermenter.java index e75af1158..3b1925a95 100755 --- a/src/main/java/forestry/factory/gadgets/MachineFermenter.java +++ b/src/main/java/forestry/factory/gadgets/MachineFermenter.java @@ -103,7 +103,7 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL return true; // Liquid required but none given - if (liquid != null && liqu == null) + if (liqu == null) return false; // Wrong liquid @@ -120,9 +120,9 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL public static class RecipeManager implements IFermenterManager { - public static ArrayList recipes = new ArrayList(); - public static HashSet recipeFluidInputs = new HashSet(); - public static HashSet recipeFluidOutputs = new HashSet(); + public static final ArrayList recipes = new ArrayList(); + public static final HashSet recipeFluidInputs = new HashSet(); + public static final HashSet recipeFluidOutputs = new HashSet(); @Override public void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output, FluidStack liquid) { @@ -180,9 +180,9 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL } } @EntityNetData - public FilteredTank resourceTank; + public final FilteredTank resourceTank; @EntityNetData - public FilteredTank productTank; + public final FilteredTank productTank; private final TankManager tankManager; diff --git a/src/main/java/forestry/factory/gadgets/MachineMoistener.java b/src/main/java/forestry/factory/gadgets/MachineMoistener.java index c1db1e9b9..c3970bdec 100755 --- a/src/main/java/forestry/factory/gadgets/MachineMoistener.java +++ b/src/main/java/forestry/factory/gadgets/MachineMoistener.java @@ -58,13 +58,11 @@ public class MachineMoistener extends TileBase implements ISpecialInventory, ISi private static final short SLOTS_COUNT_RESERVOIR = 3; private static final short SLOTS_COUNT_STASH = 6; - private static final FluidStack STACK_WATER = LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1); - /* RECIPE MANAGMENT */ public static class Recipe { - public int timePerItem; - public ItemStack resource; - public ItemStack product; + public final int timePerItem; + public final ItemStack resource; + public final ItemStack product; public Recipe(ItemStack resource, ItemStack product, int timePerItem) { this.timePerItem = timePerItem; @@ -75,9 +73,7 @@ public class MachineMoistener extends TileBase implements ISpecialInventory, ISi public boolean matches(ItemStack res) { if (res == null && resource == null) return true; - else if (res == null && resource != null) - return false; - else if (res != null && resource == null) + else if (res == null || resource == null) return false; else return resource.isItemEqual(res); @@ -85,7 +81,7 @@ public class MachineMoistener extends TileBase implements ISpecialInventory, ISi } public static class RecipeManager implements IMoistenerManager { - public static ArrayList recipes = new ArrayList(); + public static final ArrayList recipes = new ArrayList(); @Override public void addRecipe(ItemStack resource, ItemStack product, int timePerItem) { @@ -125,7 +121,7 @@ public class MachineMoistener extends TileBase implements ISpecialInventory, ISi } @EntityNetData - public FilteredTank resourceTank; + public final FilteredTank resourceTank; private final TankManager tankManager; private final InventoryAdapter inventory = new InventoryAdapter(12, "Items"); //private ItemStack[] inventoryStacks = new ItemStack[12]; diff --git a/src/main/java/forestry/factory/gadgets/MachineSqueezer.java b/src/main/java/forestry/factory/gadgets/MachineSqueezer.java index ff01ec289..b51346295 100755 --- a/src/main/java/forestry/factory/gadgets/MachineSqueezer.java +++ b/src/main/java/forestry/factory/gadgets/MachineSqueezer.java @@ -81,9 +81,9 @@ public class MachineSqueezer extends TilePowered implements ISpecialInventory, I } public static class RecipeManager implements ISqueezerManager { - public static ArrayList recipes = new ArrayList(); - public static HashSet recipeFluids = new HashSet(); - public static HashSet recipeInputs = new HashSet(); + public static final ArrayList recipes = new ArrayList(); + public static final HashSet recipeFluids = new HashSet(); + public static final HashSet recipeInputs = new HashSet(); @Override public void addRecipe(int timePerItem, ItemStack[] resources, FluidStack liquid, ItemStack remnants, int chance) { @@ -100,8 +100,7 @@ public class MachineSqueezer extends TilePowered implements ISpecialInventory, I } public static Recipe findMatchingRecipe(ItemStack[] items) { - for (int i = 0; i < recipes.size(); i++) { - Recipe recipe = recipes.get(i); + for (Recipe recipe : recipes) { if (recipe.matches(items)) return recipe; } @@ -132,7 +131,7 @@ public class MachineSqueezer extends TilePowered implements ISpecialInventory, I /* MEMBER */ private final TankManager tankManager; @EntityNetData - public FilteredTank productTank; + public final FilteredTank productTank; private final InventoryAdapter inventory = new InventoryAdapter(12, "Items"); private Recipe currentRecipe; diff --git a/src/main/java/forestry/factory/gadgets/MachineStill.java b/src/main/java/forestry/factory/gadgets/MachineStill.java index aeba8b5f9..bf5ded4ea 100755 --- a/src/main/java/forestry/factory/gadgets/MachineStill.java +++ b/src/main/java/forestry/factory/gadgets/MachineStill.java @@ -71,9 +71,7 @@ public class MachineStill extends TilePowered implements ISpecialInventory, ISid public boolean matches(FluidStack res) { if (res == null && input == null) return true; - else if (res == null && input != null) - return false; - else if (res != null && input == null) + else if (res == null || input == null) return false; else return input.isFluidEqual(res); @@ -81,9 +79,9 @@ public class MachineStill extends TilePowered implements ISpecialInventory, ISid } public static class RecipeManager implements IStillManager { - public static ArrayList recipes = new ArrayList(); - public static HashSet recipeFluidInputs = new HashSet(); - public static HashSet recipeFluidOutputs = new HashSet(); + public static final ArrayList recipes = new ArrayList(); + public static final HashSet recipeFluidInputs = new HashSet(); + public static final HashSet recipeFluidOutputs = new HashSet(); @Override public void addRecipe(int timePerUnit, FluidStack input, FluidStack output) { @@ -120,9 +118,9 @@ public class MachineStill extends TilePowered implements ISpecialInventory, ISid /* MEMBER */ @EntityNetData - public FilteredTank resourceTank; + public final FilteredTank resourceTank; @EntityNetData - public FilteredTank productTank; + public final FilteredTank productTank; private final TankManager tankManager; private final InventoryAdapter inventory = new InventoryAdapter(3, "Items"); diff --git a/src/main/java/forestry/factory/gadgets/TileWorktable.java b/src/main/java/forestry/factory/gadgets/TileWorktable.java index 83f393db4..8249834e3 100755 --- a/src/main/java/forestry/factory/gadgets/TileWorktable.java +++ b/src/main/java/forestry/factory/gadgets/TileWorktable.java @@ -265,10 +265,10 @@ public class TileWorktable extends TileBase implements ICrafter { @Override public void writeToNBT(NBTTagCompound nbttagcompound) { NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < recipes.size(); i++) { - if (recipes.get(i) != null) { + for (Recipe recipe : recipes) { + if (recipe != null) { NBTTagCompound nbttagcompound2 = new NBTTagCompound(); - recipes.get(i).writeToNBT(nbttagcompound2); + recipe.writeToNBT(nbttagcompound2); nbttaglist.appendTag(nbttagcompound2); } } diff --git a/src/main/java/forestry/factory/gui/ContainerBottler.java b/src/main/java/forestry/factory/gui/ContainerBottler.java index 3a891e8a7..7d4d2e27f 100755 --- a/src/main/java/forestry/factory/gui/ContainerBottler.java +++ b/src/main/java/forestry/factory/gui/ContainerBottler.java @@ -10,19 +10,17 @@ ******************************************************************************/ package forestry.factory.gui; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - import forestry.core.gui.ContainerLiquidTanks; import forestry.core.gui.slots.SlotClosed; import forestry.core.gui.slots.SlotLiquidContainer; import forestry.factory.gadgets.MachineBottler; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; public class ContainerBottler extends ContainerLiquidTanks { - protected MachineBottler tile; + protected final MachineBottler tile; public ContainerBottler(InventoryPlayer player, MachineBottler tile) { super(tile, tile); diff --git a/src/main/java/forestry/factory/gui/ContainerCarpenter.java b/src/main/java/forestry/factory/gui/ContainerCarpenter.java index acd15dd2a..a418c847c 100755 --- a/src/main/java/forestry/factory/gui/ContainerCarpenter.java +++ b/src/main/java/forestry/factory/gui/ContainerCarpenter.java @@ -42,8 +42,8 @@ public class ContainerCarpenter extends ContainerLiquidTanks implements IContain private MachineCarpenter machine; private final IInventory craftingInventory; private IInventory internalInventory; - public InventoryCraftingAuto craftMatrix; - public InventoryCraftResult craftResult; + public final InventoryCraftingAuto craftMatrix; + public final InventoryCraftResult craftResult; public ContainerCarpenter(InventoryPlayer inventoryplayer, MachineCarpenter tile) { super(tile.getInternalInventory(), tile); diff --git a/src/main/java/forestry/factory/gui/ContainerCentrifuge.java b/src/main/java/forestry/factory/gui/ContainerCentrifuge.java index 2fde6df22..bdf321b41 100755 --- a/src/main/java/forestry/factory/gui/ContainerCentrifuge.java +++ b/src/main/java/forestry/factory/gui/ContainerCentrifuge.java @@ -20,7 +20,7 @@ import forestry.factory.gadgets.MachineCentrifuge; public class ContainerCentrifuge extends ContainerForestry { - protected MachineCentrifuge tile; + protected final MachineCentrifuge tile; public ContainerCentrifuge(InventoryPlayer player, MachineCentrifuge tile) { super(tile); @@ -53,8 +53,8 @@ public class ContainerCentrifuge extends ContainerForestry { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) - tile.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) + tile.sendGUINetworkData(this, (ICrafting) crafter); } } diff --git a/src/main/java/forestry/factory/gui/ContainerFabricator.java b/src/main/java/forestry/factory/gui/ContainerFabricator.java index 1ed6cef6e..6833d140e 100755 --- a/src/main/java/forestry/factory/gui/ContainerFabricator.java +++ b/src/main/java/forestry/factory/gui/ContainerFabricator.java @@ -10,17 +10,15 @@ ******************************************************************************/ package forestry.factory.gui; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - import forestry.core.gui.ContainerLiquidTanks; import forestry.core.gui.slots.SlotCrafter; import forestry.factory.gadgets.MachineFabricator; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; public class ContainerFabricator extends ContainerLiquidTanks { - private MachineFabricator tile; + private final MachineFabricator tile; public ContainerFabricator(InventoryPlayer player, MachineFabricator tile) { super(tile, tile); diff --git a/src/main/java/forestry/factory/gui/ContainerFermenter.java b/src/main/java/forestry/factory/gui/ContainerFermenter.java index e7aa3acb3..5d43389d3 100755 --- a/src/main/java/forestry/factory/gui/ContainerFermenter.java +++ b/src/main/java/forestry/factory/gui/ContainerFermenter.java @@ -10,26 +10,24 @@ ******************************************************************************/ package forestry.factory.gui; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - import forestry.core.gui.ContainerLiquidTanks; import forestry.core.gui.slots.SlotCustom; import forestry.core.gui.slots.SlotLiquidContainer; import forestry.core.gui.slots.SlotOutput; import forestry.factory.gadgets.MachineFermenter; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; public class ContainerFermenter extends ContainerLiquidTanks { - protected MachineFermenter fermenter; + protected final MachineFermenter fermenter; public ContainerFermenter(InventoryPlayer player, MachineFermenter fermenter) { super(fermenter, fermenter); this.fermenter = fermenter; - this.addSlot(new SlotCustom(fermenter, MachineFermenter.SLOT_RESOURCE, 85, 23, true)); - this.addSlot(new SlotCustom(fermenter, MachineFermenter.SLOT_FUEL, 75, 57, true)); + this.addSlot(new SlotCustom(fermenter, MachineFermenter.SLOT_RESOURCE, 85, 23).setExclusion(true)); + this.addSlot(new SlotCustom(fermenter, MachineFermenter.SLOT_FUEL, 75, 57).setExclusion(true)); this.addSlot(new SlotOutput(fermenter, MachineFermenter.SLOT_CAN_OUTPUT, 150, 58)); this.addSlot(new SlotLiquidContainer(fermenter, MachineFermenter.SLOT_CAN_INPUT, 150, 22, true)); this.addSlot(new SlotLiquidContainer(fermenter, MachineFermenter.SLOT_INPUT, 10, 40)); diff --git a/src/main/java/forestry/factory/gui/ContainerMoistener.java b/src/main/java/forestry/factory/gui/ContainerMoistener.java index d51d771e8..0a12d2390 100755 --- a/src/main/java/forestry/factory/gui/ContainerMoistener.java +++ b/src/main/java/forestry/factory/gui/ContainerMoistener.java @@ -12,7 +12,6 @@ package forestry.factory.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; @@ -24,7 +23,7 @@ import forestry.factory.gadgets.MachineMoistener; public class ContainerMoistener extends ContainerLiquidTanks implements IContainerCrafting { - protected MachineMoistener tile; + protected final MachineMoistener tile; public ContainerMoistener(InventoryPlayer player, MachineMoistener tile) { super(tile, tile); diff --git a/src/main/java/forestry/factory/gui/GuiFabricator.java b/src/main/java/forestry/factory/gui/GuiFabricator.java index e15044361..f2b48da1c 100755 --- a/src/main/java/forestry/factory/gui/GuiFabricator.java +++ b/src/main/java/forestry/factory/gui/GuiFabricator.java @@ -32,7 +32,7 @@ public class GuiFabricator extends GuiForestryTitled { MachineFabricator fabricator = tile; int heatScaled = fabricator.getHeatScaled(52); if (heatScaled > 0) - drawTexturedModalRect(guiLeft + 55, guiTop + 17 + 52 - heatScaled, 192, 0 + 52 - heatScaled, 4, heatScaled); + drawTexturedModalRect(guiLeft + 55, guiTop + 17 + 52 - heatScaled, 192, 52 - heatScaled, 4, heatScaled); int meltingPointScaled = fabricator.getMeltingPointScaled(52); if (meltingPointScaled > 0) diff --git a/src/main/java/forestry/factory/gui/GuiWorktable.java b/src/main/java/forestry/factory/gui/GuiWorktable.java index dc1458003..59dd3ff3c 100755 --- a/src/main/java/forestry/factory/gui/GuiWorktable.java +++ b/src/main/java/forestry/factory/gui/GuiWorktable.java @@ -10,14 +10,6 @@ ******************************************************************************/ package forestry.factory.gui; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -import org.lwjgl.opengl.GL11; - import forestry.core.config.Defaults; import forestry.core.gui.GuiForestryTitled; import forestry.core.gui.WidgetManager; @@ -25,14 +17,18 @@ import forestry.core.gui.widgets.Widget; import forestry.core.proxy.Proxies; import forestry.core.render.SpriteSheet; import forestry.core.render.TextureManager; -import forestry.core.utils.StringUtil; import forestry.factory.gadgets.TileWorktable; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import org.lwjgl.opengl.GL11; public class GuiWorktable extends GuiForestryTitled { private class MemorizedSlot extends Widget { - int slotNumber; + private final int slotNumber; public MemorizedSlot(WidgetManager manager, int xPos, int yPos, int slot) { super(manager, xPos, yPos); @@ -100,14 +96,13 @@ public class GuiWorktable extends GuiForestryTitled { } } private final TileWorktable worktable; - protected ContainerWorktable container; + protected final ContainerWorktable container; public GuiWorktable(EntityPlayer player, TileWorktable tile) { super(Defaults.TEXTURE_PATH_GUI + "/worktable2.png", new ContainerWorktable(player, tile), tile); ySize = 218; worktable = tile; - this.tile = tile; container = (ContainerWorktable) inventorySlots; final int spacing = 18; diff --git a/src/main/java/forestry/factory/gui/InventoryCraftingAuto.java b/src/main/java/forestry/factory/gui/InventoryCraftingAuto.java index c86c8949b..648319b3e 100755 --- a/src/main/java/forestry/factory/gui/InventoryCraftingAuto.java +++ b/src/main/java/forestry/factory/gui/InventoryCraftingAuto.java @@ -16,9 +16,9 @@ import net.minecraft.item.ItemStack; public class InventoryCraftingAuto extends InventoryCrafting { - private ContainerCarpenter eventHandler; - public ItemStack stackList[]; - private int inventoryWidth; + private final ContainerCarpenter eventHandler; + public final ItemStack stackList[]; + private final int inventoryWidth; public InventoryCraftingAuto(ContainerCarpenter container, int i, int j) { super(container, i, j); diff --git a/src/main/java/forestry/factory/gui/SlotCraftMatrix.java b/src/main/java/forestry/factory/gui/SlotCraftMatrix.java index f9d9d98ce..e627b984b 100755 --- a/src/main/java/forestry/factory/gui/SlotCraftMatrix.java +++ b/src/main/java/forestry/factory/gui/SlotCraftMatrix.java @@ -20,8 +20,8 @@ import forestry.core.interfaces.IContainerCrafting; */ public class SlotCraftMatrix extends SlotForestry { - private IContainerCrafting eventHandler; - private int slot; + private final IContainerCrafting eventHandler; + private final int slot; public SlotCraftMatrix(IContainerCrafting container, IInventory iinventory, int i, int j, int k) { super(iinventory, i, j, k); diff --git a/src/main/java/forestry/factory/recipes/CraftGuideBottler.java b/src/main/java/forestry/factory/recipes/CraftGuideBottler.java index 1ebd2b4ad..b430f0623 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideBottler.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideBottler.java @@ -38,7 +38,7 @@ public class CraftGuideBottler implements RecipeProvider { @Override public void generateRecipes(RecipeGenerator generator) { - if (ForestryBlock.factoryTESR == null) + if (ForestryBlock.factoryTESR.block() == null) return; ItemStack machine = ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_BOTTLER_META); diff --git a/src/main/java/forestry/factory/recipes/CraftGuideCarpenter.java b/src/main/java/forestry/factory/recipes/CraftGuideCarpenter.java index 6998c69f1..df737e54c 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideCarpenter.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideCarpenter.java @@ -41,7 +41,7 @@ public class CraftGuideCarpenter implements RecipeProvider { @Override public void generateRecipes(RecipeGenerator generator) { - if (ForestryBlock.factoryTESR == null) + if (ForestryBlock.factoryTESR.block() == null) return; ItemStack machine = ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_CARPENTER_META); diff --git a/src/main/java/forestry/factory/recipes/CraftGuideCentrifuge.java b/src/main/java/forestry/factory/recipes/CraftGuideCentrifuge.java index d7f1078ea..243bdba52 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideCentrifuge.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideCentrifuge.java @@ -42,7 +42,7 @@ public class CraftGuideCentrifuge implements RecipeProvider { @Override public void generateRecipes(RecipeGenerator generator) { - if (ForestryBlock.factoryTESR == null) + if (ForestryBlock.factoryTESR.block() == null) return; ItemStack machine = ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_CENTRIFUGE_META); diff --git a/src/main/java/forestry/factory/recipes/CraftGuideFabricator.java b/src/main/java/forestry/factory/recipes/CraftGuideFabricator.java index 26775f821..f193a0a59 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideFabricator.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideFabricator.java @@ -41,7 +41,7 @@ public class CraftGuideFabricator implements RecipeProvider { @Override public void generateRecipes(RecipeGenerator generator) { - if (ForestryBlock.factoryTESR == null) + if (ForestryBlock.factoryTESR.block() == null) return; ItemStack machine = ForestryBlock.factoryPlain.getItemStack(1, Defaults.DEFINITION_FABRICATOR_META); diff --git a/src/main/java/forestry/factory/recipes/CraftGuideFermenter.java b/src/main/java/forestry/factory/recipes/CraftGuideFermenter.java index 7aad47571..970966bca 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideFermenter.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideFermenter.java @@ -45,7 +45,7 @@ public class CraftGuideFermenter implements RecipeProvider { @Override public void generateRecipes(RecipeGenerator generator) { - if (ForestryBlock.factoryTESR == null) + if (ForestryBlock.factoryTESR.block() == null) return; ItemStack machine = ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_FERMENTER_META); diff --git a/src/main/java/forestry/factory/recipes/CraftGuideSqueezer.java b/src/main/java/forestry/factory/recipes/CraftGuideSqueezer.java index adc057552..e7a1286dc 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideSqueezer.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideSqueezer.java @@ -41,7 +41,7 @@ public class CraftGuideSqueezer implements RecipeProvider { @Override public void generateRecipes(RecipeGenerator generator) { - if (ForestryBlock.factoryTESR == null) + if (ForestryBlock.factoryTESR.block() == null) return; ItemStack machine = ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_SQUEEZER_META); diff --git a/src/main/java/forestry/factory/recipes/CraftGuideStill.java b/src/main/java/forestry/factory/recipes/CraftGuideStill.java index 1587e2847..5384e84ad 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideStill.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideStill.java @@ -37,7 +37,7 @@ public class CraftGuideStill implements RecipeProvider { @Override public void generateRecipes(RecipeGenerator generator) { - if (ForestryBlock.factoryTESR == null) + if (ForestryBlock.factoryTESR.block() == null) return; ItemStack machine = ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_STILL_META); diff --git a/src/main/java/forestry/farming/circuits/CircuitFarmLogic.java b/src/main/java/forestry/farming/circuits/CircuitFarmLogic.java index cd0a5fa89..16c3a6518 100755 --- a/src/main/java/forestry/farming/circuits/CircuitFarmLogic.java +++ b/src/main/java/forestry/farming/circuits/CircuitFarmLogic.java @@ -18,7 +18,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class CircuitFarmLogic extends Circuit { - private Class logicClass; + private final Class logicClass; private boolean isManual = false; public CircuitFarmLogic(String uid, Class logicClass) { diff --git a/src/main/java/forestry/farming/gadgets/TileFarm.java b/src/main/java/forestry/farming/gadgets/TileFarm.java index c25424b1b..15e94981e 100755 --- a/src/main/java/forestry/farming/gadgets/TileFarm.java +++ b/src/main/java/forestry/farming/gadgets/TileFarm.java @@ -248,7 +248,7 @@ public abstract class TileFarm extends TileForestry implements IFarmComponent { } /* ITILESTRUCTURE */ - IStructureLogic structureLogic; + private final IStructureLogic structureLogic; private boolean isMaster; private int masterX, masterZ; private int masterY = -99; diff --git a/src/main/java/forestry/farming/gadgets/TileFarmPlain.java b/src/main/java/forestry/farming/gadgets/TileFarmPlain.java index ac7acb6c1..0638c4766 100755 --- a/src/main/java/forestry/farming/gadgets/TileFarmPlain.java +++ b/src/main/java/forestry/farming/gadgets/TileFarmPlain.java @@ -94,7 +94,7 @@ public class TileFarmPlain extends TileFarm implements IFarmHousing, ISocketable private final InventoryAdapter sockets = new InventoryAdapter(1, "sockets"); - private FilteredTank liquidTank; + private final FilteredTank liquidTank; private final TankManager tankManager; private IFarmLogic harvestProvider; // The farm logic which supplied the pending crops. diff --git a/src/main/java/forestry/farming/gadgets/TileGearbox.java b/src/main/java/forestry/farming/gadgets/TileGearbox.java index eee383345..b7bd656ef 100644 --- a/src/main/java/forestry/farming/gadgets/TileGearbox.java +++ b/src/main/java/forestry/farming/gadgets/TileGearbox.java @@ -21,7 +21,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class TileGearbox extends TileFarm implements IPowerHandler { - public static int WORK_CYCLES = 4; + public static final int WORK_CYCLES = 4; private int activationDelay = 0; private int previousDelays = 0; private int workCounter; diff --git a/src/main/java/forestry/farming/gadgets/TileHatch.java b/src/main/java/forestry/farming/gadgets/TileHatch.java index e52b7eecf..f80f814f0 100755 --- a/src/main/java/forestry/farming/gadgets/TileHatch.java +++ b/src/main/java/forestry/farming/gadgets/TileHatch.java @@ -73,9 +73,9 @@ public class TileHatch extends TileFarm implements ISidedInventory { private void dumpToPipe(ArrayList pipes) { ItemStack[] products = extractItem(true, ForgeDirection.DOWN, 1); - for (int i = 0; i < products.length; i++) - while (products[i].stackSize > 0) - BlockUtil.putFromStackIntoPipe(this, pipes, products[i]); + for (ItemStack product : products) + while (product.stackSize > 0) + BlockUtil.putFromStackIntoPipe(this, pipes, product); } @@ -95,23 +95,22 @@ public class TileHatch extends TileFarm implements ISidedInventory { if (stack.stackSize <= 0) continue; - for (int j = 0; j < inventories.length; j++) { + for (IInventory inventory : inventories) { // Don't dump in arboretums! - if (inventories[j].getSizeInventory() < 4) + if (inventory.getSizeInventory() < 4) continue; // Get complete inventory (for double chests) - IInventory inventory = Utils.getChest(inventories[j]); - if (inventory instanceof ISidedInventory) { - ISidedInventory sidedInventory = (ISidedInventory)inventory; + IInventory completeInventory = Utils.getChest(inventory); + if (completeInventory instanceof ISidedInventory) { + ISidedInventory sidedInventory = (ISidedInventory) completeInventory; int[] slots = sidedInventory.getAccessibleSlotsFromSide(ForgeDirection.UP.ordinal()); for (int sl = 0; sl < slots.length; ++sl) { StackUtils.stowInInventory(stack, sidedInventory, true, sl, 1); } - } - else { - StackUtils.stowInInventory(stack, inventory, true); + } else { + StackUtils.stowInInventory(stack, completeInventory, true); if (stack.stackSize <= 0) { inv.setInventorySlotContents(i, null); break; diff --git a/src/main/java/forestry/farming/gui/ContainerFarm.java b/src/main/java/forestry/farming/gui/ContainerFarm.java index dfc514aa3..b2e55fa4d 100755 --- a/src/main/java/forestry/farming/gui/ContainerFarm.java +++ b/src/main/java/forestry/farming/gui/ContainerFarm.java @@ -30,44 +30,7 @@ import forestry.plugins.PluginFarming; public class ContainerFarm extends ContainerSocketed { - private class SlotResources extends SlotForestry { - - private final IFarmLogic[] logics; - - public SlotResources(IInventory inventory, IFarmLogic[] logics, int slotIndex, int xPos, int yPos) { - super(inventory, slotIndex, xPos, yPos); - this.logics = logics; - } - - @Override - public boolean isItemValid(ItemStack stack) { - for (IFarmLogic logic : logics) { - if (logic != null && logic.isAcceptedResource(stack)) - return true; - } - return false; - } - } - - private class SlotGermlings extends SlotForestry { - - private final IFarmLogic[] logics; - - public SlotGermlings(IInventory inventory, IFarmLogic[] logics, int slotIndex, int xPos, int yPos) { - super(inventory, slotIndex, xPos, yPos); - this.logics = logics; - } - - @Override - public boolean isItemValid(ItemStack stack) { - for (IFarmLogic logic : logics) { - if (logic != null && logic.isAcceptedGermling(stack)) - return true; - } - return false; - } - } - TileFarmPlain tile; + private final TileFarmPlain tile; public ContainerFarm(InventoryPlayer playerinventory, TileFarmPlain tile) { super(playerinventory, tile); @@ -140,8 +103,8 @@ public class ContainerFarm extends ContainerSocketed { if (tankManager != null) tankManager.updateGuiData(this, crafters); - for (int i = 0; i < crafters.size(); i++) { - tile.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + tile.sendGUINetworkData(this, (ICrafting) crafter); } } @@ -156,4 +119,42 @@ public class ContainerFarm extends ContainerSocketed { public StandardTank getTank(int slot) { return tile.getTankManager().get(slot); } + + private class SlotResources extends SlotForestry { + + private final IFarmLogic[] logics; + + public SlotResources(IInventory inventory, IFarmLogic[] logics, int slotIndex, int xPos, int yPos) { + super(inventory, slotIndex, xPos, yPos); + this.logics = logics; + } + + @Override + public boolean isItemValid(ItemStack stack) { + for (IFarmLogic logic : logics) { + if (logic != null && logic.isAcceptedResource(stack)) + return true; + } + return false; + } + } + + private class SlotGermlings extends SlotForestry { + + private final IFarmLogic[] logics; + + public SlotGermlings(IInventory inventory, IFarmLogic[] logics, int slotIndex, int xPos, int yPos) { + super(inventory, slotIndex, xPos, yPos); + this.logics = logics; + } + + @Override + public boolean isItemValid(ItemStack stack) { + for (IFarmLogic logic : logics) { + if (logic != null && logic.isAcceptedGermling(stack)) + return true; + } + return false; + } + } } diff --git a/src/main/java/forestry/farming/gui/GuiFarm.java b/src/main/java/forestry/farming/gui/GuiFarm.java index 4de688b67..6220f0cdc 100755 --- a/src/main/java/forestry/farming/gui/GuiFarm.java +++ b/src/main/java/forestry/farming/gui/GuiFarm.java @@ -135,7 +135,6 @@ public class GuiFarm extends GuiForestry { this.xSize = 216; this.ySize = 220; - this.tile = tile; this.farm = tile; } diff --git a/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java b/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java index f40168c88..83b810b17 100755 --- a/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java +++ b/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java @@ -25,9 +25,6 @@ import forestry.plugins.PluginArboriculture; public class FarmableVanillaSapling extends FarmableGenericSapling { - int saplingId; - int saplingMeta; - public FarmableVanillaSapling() { super(Blocks.sapling, -1, new ItemStack(Items.apple), new ItemStack(FarmableCocoa.COCOA_SEED, 1, FarmableCocoa.COCOA_META)); } diff --git a/src/main/java/forestry/food/BeverageEffect.java b/src/main/java/forestry/food/BeverageEffect.java index 004531ba9..06b5724c6 100755 --- a/src/main/java/forestry/food/BeverageEffect.java +++ b/src/main/java/forestry/food/BeverageEffect.java @@ -20,7 +20,7 @@ public abstract class BeverageEffect implements IBeverageEffect { public static final IBeverageEffect weakAntidote = new BeverageEffectAntidote(20, 0.5f); public static final IBeverageEffect strongAntidote = new BeverageEffectAntidote(21, 1.0f); - private int id; + private final int id; protected String description; public BeverageEffect(int id) { diff --git a/src/main/java/forestry/food/BeverageEffectDrunk.java b/src/main/java/forestry/food/BeverageEffectDrunk.java index 709da4312..c7f75d2ef 100755 --- a/src/main/java/forestry/food/BeverageEffectDrunk.java +++ b/src/main/java/forestry/food/BeverageEffectDrunk.java @@ -17,14 +17,14 @@ import net.minecraft.world.World; public class BeverageEffectDrunk extends BeverageEffect { - private PotionEffect drunkEffect; - private float chance = 0.2f; + private final PotionEffect drunkEffect; + private final float chance; public BeverageEffectDrunk(int id, float chance) { super(id); this.chance = chance; this.description = "beverage.effect.alcoholic"; - drunkEffect = new PotionEffect(Potion.confusion.id, 25 * 20, 0); + this.drunkEffect = new PotionEffect(Potion.confusion.id, 25 * 20, 0); } @Override diff --git a/src/main/java/forestry/food/gui/ContainerInfuser.java b/src/main/java/forestry/food/gui/ContainerInfuser.java index 11bd3927c..4935d518d 100755 --- a/src/main/java/forestry/food/gui/ContainerInfuser.java +++ b/src/main/java/forestry/food/gui/ContainerInfuser.java @@ -24,7 +24,7 @@ import forestry.food.items.ItemInfuser.InfuserInventory; public class ContainerInfuser extends ContainerForestry { - InfuserInventory inventory; + private final InfuserInventory inventory; public ContainerInfuser(InventoryPlayer inventoryplayer, InfuserInventory inventory) { super(inventory); diff --git a/src/main/java/forestry/food/items/ItemInfuser.java b/src/main/java/forestry/food/items/ItemInfuser.java index c83921a57..a4518c939 100755 --- a/src/main/java/forestry/food/items/ItemInfuser.java +++ b/src/main/java/forestry/food/items/ItemInfuser.java @@ -235,7 +235,7 @@ public class ItemInfuser extends ItemForestry { private final short inputSlot = 0; private final short outputSlot = 1; private final short ingredientSlot1 = 2; - EntityPlayer player; + private final EntityPlayer player; public InfuserInventory(EntityPlayer player) { this.player = player; diff --git a/src/main/java/forestry/lepidopterology/MatingRecipe.java b/src/main/java/forestry/lepidopterology/MatingRecipe.java index c14c59f19..51572ce42 100755 --- a/src/main/java/forestry/lepidopterology/MatingRecipe.java +++ b/src/main/java/forestry/lepidopterology/MatingRecipe.java @@ -21,7 +21,7 @@ import forestry.plugins.PluginLepidopterology; public class MatingRecipe implements IRecipe { - ItemStack unknown; + private final ItemStack unknown; ItemStack cached; public MatingRecipe() { diff --git a/src/main/java/forestry/lepidopterology/entities/AIButterflyBase.java b/src/main/java/forestry/lepidopterology/entities/AIButterflyBase.java index 72ce3ccee..2bb3e43ee 100755 --- a/src/main/java/forestry/lepidopterology/entities/AIButterflyBase.java +++ b/src/main/java/forestry/lepidopterology/entities/AIButterflyBase.java @@ -18,7 +18,7 @@ import net.minecraft.util.Vec3; public abstract class AIButterflyBase extends EntityAIBase { - protected EntityButterfly entity; + protected final EntityButterfly entity; public AIButterflyBase(EntityButterfly entity) { this.entity = entity; diff --git a/src/main/java/forestry/lepidopterology/genetics/ButterflyHelper.java b/src/main/java/forestry/lepidopterology/genetics/ButterflyHelper.java index c389d880d..88eee4880 100755 --- a/src/main/java/forestry/lepidopterology/genetics/ButterflyHelper.java +++ b/src/main/java/forestry/lepidopterology/genetics/ButterflyHelper.java @@ -177,7 +177,7 @@ public class ButterflyHelper extends SpeciesRoot implements IButterflyRoot { } /* TEMPLATES */ - public static ArrayList butterflyTemplates = new ArrayList(); + public static final ArrayList butterflyTemplates = new ArrayList(); @Override public ArrayList getIndividualTemplates() { diff --git a/src/main/java/forestry/lepidopterology/gui/ContainerFlutterlyzer.java b/src/main/java/forestry/lepidopterology/gui/ContainerFlutterlyzer.java index d6d755837..2c2e3d7cd 100755 --- a/src/main/java/forestry/lepidopterology/gui/ContainerFlutterlyzer.java +++ b/src/main/java/forestry/lepidopterology/gui/ContainerFlutterlyzer.java @@ -22,7 +22,7 @@ public class ContainerFlutterlyzer extends ContainerAlyzer { FlutterlyzerInventory inventory; public ContainerFlutterlyzer(InventoryPlayer inventoryplayer, FlutterlyzerInventory inventory) { - super(inventoryplayer, inventory, new Object[] { ForestryItem.honeydew, ForestryItem.honeyDrop }, new Object[] { ItemButterflyGE.class }); + super(inventoryplayer, inventory, new Object[] { ForestryItem.honeydew, ForestryItem.honeyDrop }, ItemButterflyGE.class); } } diff --git a/src/main/java/forestry/lepidopterology/gui/GuiFlutterlyzer.java b/src/main/java/forestry/lepidopterology/gui/GuiFlutterlyzer.java index 36e35bca9..a14049745 100755 --- a/src/main/java/forestry/lepidopterology/gui/GuiFlutterlyzer.java +++ b/src/main/java/forestry/lepidopterology/gui/GuiFlutterlyzer.java @@ -131,7 +131,7 @@ public class GuiFlutterlyzer extends GuiAlyzer { .getDescription(), butterfly, EnumButterflyChromosome.FLOWER_PROVIDER); drawRow(StringUtil.localize("gui.effect"), butterfly.getGenome().getEffect().getName(), - ((IAlleleEffect) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.EFFECT.ordinal())).getName(), butterfly, + butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.EFFECT.ordinal()).getName(), butterfly, EnumButterflyChromosome.EFFECT); newLine(); diff --git a/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java b/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java index 038670ab6..520258050 100755 --- a/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java +++ b/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java @@ -42,7 +42,7 @@ import java.util.List; public class ItemButterflyGE extends ItemGE { - EnumFlutterType type; + private final EnumFlutterType type; public ItemButterflyGE(EnumFlutterType type) { super(); diff --git a/src/main/java/forestry/lepidopterology/render/ButterflyItemRenderer.java b/src/main/java/forestry/lepidopterology/render/ButterflyItemRenderer.java index c82da46b4..531e21195 100755 --- a/src/main/java/forestry/lepidopterology/render/ButterflyItemRenderer.java +++ b/src/main/java/forestry/lepidopterology/render/ButterflyItemRenderer.java @@ -28,7 +28,7 @@ import forestry.plugins.PluginLepidopterology; public class ButterflyItemRenderer implements IItemRenderer { - ModelButterfly model; + private final ModelButterfly model; EntityButterfly entity; public ButterflyItemRenderer() { @@ -51,7 +51,7 @@ public class ButterflyItemRenderer implements IItemRenderer { } public static float getIrregularWingYaw(long flapping, float flap) { - long irregular = (long)(flapping / 1024); + long irregular = flapping / 1024; float wingYaw; if(irregular % 11 == 0) { diff --git a/src/main/java/forestry/lepidopterology/render/ModelButterfly.java b/src/main/java/forestry/lepidopterology/render/ModelButterfly.java index aa6827d75..48dffa992 100755 --- a/src/main/java/forestry/lepidopterology/render/ModelButterfly.java +++ b/src/main/java/forestry/lepidopterology/render/ModelButterfly.java @@ -18,12 +18,12 @@ import net.minecraft.util.MathHelper; import org.lwjgl.opengl.GL11; public class ModelButterfly extends ModelBase { - - ModelRenderer wingRight; - ModelRenderer eyeRight; - ModelRenderer eyeLeft; - ModelRenderer wingLeft; - ModelRenderer body; + + private final ModelRenderer wingRight; + private final ModelRenderer eyeRight; + private final ModelRenderer eyeLeft; + private final ModelRenderer wingLeft; + private final ModelRenderer body; private float scale; diff --git a/src/main/java/forestry/lepidopterology/render/RenderButterfly.java b/src/main/java/forestry/lepidopterology/render/RenderButterfly.java index bd22b7949..b2083ac86 100755 --- a/src/main/java/forestry/lepidopterology/render/RenderButterfly.java +++ b/src/main/java/forestry/lepidopterology/render/RenderButterfly.java @@ -19,7 +19,7 @@ import net.minecraft.entity.EntityLivingBase; public class RenderButterfly extends RenderLiving { - ModelButterfly butterflyModel; + private final ModelButterfly butterflyModel; public RenderButterfly() { super(new ModelButterfly(), 0.25f); diff --git a/src/main/java/forestry/mail/Letter.java b/src/main/java/forestry/mail/Letter.java index 1c561c317..237b93273 100755 --- a/src/main/java/forestry/mail/Letter.java +++ b/src/main/java/forestry/mail/Letter.java @@ -27,8 +27,8 @@ import org.apache.commons.lang3.StringUtils; public class Letter implements ILetter, INBTTagable { // CONSTANTS - public static short SLOT_ATTACHMENT_1 = 0; - public static short SLOT_POSTAGE_1 = 18; + public static final short SLOT_ATTACHMENT_1 = 0; + public static final short SLOT_POSTAGE_1 = 18; private boolean isProcessed = false; @@ -36,7 +36,7 @@ public class Letter implements ILetter, INBTTagable { private IMailAddress[] recipient; private String text; - private InventoryAdapter inventory = new InventoryAdapter(22, "INV"); + private final InventoryAdapter inventory = new InventoryAdapter(22, "INV"); public Letter(IMailAddress sender, IMailAddress recipient) { this.sender = sender; @@ -125,10 +125,6 @@ public class Letter implements ILetter, INBTTagable { inventory.setInventorySlotContents(i, null); } - public void setInventory(InventoryAdapter inventory) { - this.inventory = inventory; - } - @Override public void setProcessed(boolean flag) { this.isProcessed = flag; diff --git a/src/main/java/forestry/mail/PostRegistry.java b/src/main/java/forestry/mail/PostRegistry.java index 64f2812a2..507f78daf 100755 --- a/src/main/java/forestry/mail/PostRegistry.java +++ b/src/main/java/forestry/mail/PostRegistry.java @@ -35,8 +35,8 @@ import forestry.plugins.PluginMail; public class PostRegistry implements IPostRegistry { public static PostOffice cachedPostOffice; - public static HashMap cachedPOBoxes = new HashMap(); - public static HashMap cachedTradeStations = new HashMap(); + public static final HashMap cachedPOBoxes = new HashMap(); + public static final HashMap cachedTradeStations = new HashMap(); /** * @param world the Minecraft world the PO box will be in diff --git a/src/main/java/forestry/mail/gui/ContainerCatalogue.java b/src/main/java/forestry/mail/gui/ContainerCatalogue.java index 271da225f..4d6728c2c 100755 --- a/src/main/java/forestry/mail/gui/ContainerCatalogue.java +++ b/src/main/java/forestry/mail/gui/ContainerCatalogue.java @@ -201,8 +201,8 @@ public class ContainerCatalogue extends ContainerForestry implements IGuiSelecta super.detectAndSendChanges(); if(needsSynch) { - for (int i = 0; i < crafters.size(); i++) { - ICrafting crafter = (ICrafting)crafters.get(i); + for (Object crafter1 : crafters) { + ICrafting crafter = (ICrafting) crafter1; crafter.sendProgressBarUpdate(this, 0, currentItPos); crafter.sendProgressBarUpdate(this, 1, maxItPos); crafter.sendProgressBarUpdate(this, 2, currentFilter); diff --git a/src/main/java/forestry/mail/gui/ContainerLetter.java b/src/main/java/forestry/mail/gui/ContainerLetter.java index 0d372854c..679ce4f37 100755 --- a/src/main/java/forestry/mail/gui/ContainerLetter.java +++ b/src/main/java/forestry/mail/gui/ContainerLetter.java @@ -70,7 +70,7 @@ public class ContainerLetter extends ContainerItemInventory { if (!letterInventory.getLetter().isProcessed()) for (int i = 0; i < 2; i++) for (int j = 0; j < 9; j++) - addSlot(new SlotCustom(inventory, Letter.SLOT_ATTACHMENT_1 + j + i * 9, 17 + j * 18, 98 + i * 18, true, new Object[] { ItemLetter.class })); + addSlot(new SlotCustom(inventory, Letter.SLOT_ATTACHMENT_1 + j + i * 9, 17 + j * 18, 98 + i * 18, ItemLetter.class).setExclusion(true)); else for (int i = 0; i < 2; i++) for (int j = 0; j < 9; j++) diff --git a/src/main/java/forestry/mail/gui/ContainerMailbox.java b/src/main/java/forestry/mail/gui/ContainerMailbox.java index 4569fccb8..b9d30631d 100755 --- a/src/main/java/forestry/mail/gui/ContainerMailbox.java +++ b/src/main/java/forestry/mail/gui/ContainerMailbox.java @@ -10,28 +10,27 @@ ******************************************************************************/ package forestry.mail.gui; +import forestry.api.mail.IMailAddress; import forestry.api.mail.PostManager; +import forestry.core.gui.ContainerForestry; +import forestry.core.gui.slots.SlotClosed; +import forestry.core.proxy.Proxies; +import forestry.mail.POBox; +import forestry.mail.gadgets.MachineMailbox; +import forestry.plugins.PluginMail; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import forestry.core.gui.ContainerForestry; -import forestry.core.gui.slots.SlotClosed; -import forestry.core.proxy.Proxies; -import forestry.mail.POBox; -import forestry.mail.gadgets.MachineMailbox; -import forestry.api.mail.IMailAddress; -import forestry.plugins.PluginMail; - public class ContainerMailbox extends ContainerForestry { public static final short SLOT_LETTERS = 0; public static final short SLOT_LETTERS_COUNT = 7 * 12; - MachineMailbox mailbox; - POBox mailinventory; + private final MachineMailbox mailbox; + private final POBox mailInventory; public ContainerMailbox(InventoryPlayer player, MachineMailbox tile) { super(tile); @@ -41,7 +40,9 @@ public class ContainerMailbox extends ContainerForestry { IInventory inv = mailbox.getOrCreateMailInventory(player.player.worldObj, player.player.getGameProfile()); if (inv instanceof POBox) - mailinventory = (POBox) inv; + this.mailInventory = (POBox) inv; + else + this.mailInventory = null; for (int i = 0; i < 7; i++) for (int j = 0; j < 12; j++) @@ -62,9 +63,9 @@ public class ContainerMailbox extends ContainerForestry { ItemStack stack = super.slotClick(slotIndex, button, par3, player); if (slotIndex >= SLOT_LETTERS && slotIndex < SLOT_LETTERS + SLOT_LETTERS_COUNT) { - if (Proxies.common.isSimulating(player.worldObj) && mailinventory != null) { + if (Proxies.common.isSimulating(player.worldObj) && mailInventory != null) { IMailAddress address = PostManager.postRegistry.getMailAddress(player.getGameProfile()); - PluginMail.proxy.setPOBoxInfo(mailbox.getWorldObj(), address, mailinventory.getPOBoxInfo()); + PluginMail.proxy.setPOBoxInfo(mailbox.getWorldObj(), address, mailInventory.getPOBoxInfo()); } } diff --git a/src/main/java/forestry/mail/gui/ContainerPhilatelist.java b/src/main/java/forestry/mail/gui/ContainerPhilatelist.java index 6ba09938b..ed4b671f3 100755 --- a/src/main/java/forestry/mail/gui/ContainerPhilatelist.java +++ b/src/main/java/forestry/mail/gui/ContainerPhilatelist.java @@ -25,7 +25,7 @@ public class ContainerPhilatelist extends ContainerForestry { super(tile); // Filter - addSlot(new SlotCustom(tile, MachinePhilatelist.SLOT_FILTER, 80, 19, new Object[] { ItemStamps.class })); + addSlot(new SlotCustom(tile, MachinePhilatelist.SLOT_FILTER, 80, 19, ItemStamps.class)); // Collected Stamps for (int i = 0; i < 3; i++) diff --git a/src/main/java/forestry/mail/gui/ContainerTrader.java b/src/main/java/forestry/mail/gui/ContainerTrader.java index a3eff9604..18d34328a 100755 --- a/src/main/java/forestry/mail/gui/ContainerTrader.java +++ b/src/main/java/forestry/mail/gui/ContainerTrader.java @@ -44,12 +44,12 @@ public class ContainerTrader extends ContainerForestry { // Stamps for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) - addSlot(new SlotCustom(inventory, TradeStation.SLOT_STAMPS_1 + j + i * 2, 15 + j * 18, 37 + i * 18, new Object[] { ItemStamps.class })); + addSlot(new SlotCustom(inventory, TradeStation.SLOT_STAMPS_1 + j + i * 2, 15 + j * 18, 37 + i * 18, ItemStamps.class)); // Letters for (int i = 0; i < 3; i++) for (int j = 0; j < 2; j++) - addSlot(new SlotCustom(inventory, TradeStation.SLOT_LETTERS_1 + j + i * 2, 15 + j * 18, 73 + i * 18, new Object[] { Items.paper })); + addSlot(new SlotCustom(inventory, TradeStation.SLOT_LETTERS_1 + j + i * 2, 15 + j * 18, 73 + i * 18, Items.paper)); // Buffers final int bufCols = 5; diff --git a/src/main/java/forestry/mail/gui/GuiCatalogue.java b/src/main/java/forestry/mail/gui/GuiCatalogue.java index 3fc16135e..4c380ebb1 100755 --- a/src/main/java/forestry/mail/gui/GuiCatalogue.java +++ b/src/main/java/forestry/mail/gui/GuiCatalogue.java @@ -121,7 +121,7 @@ public class GuiCatalogue extends GuiForestry { protected void actionPerformed(GuiButton button) { switch(button.id) { case 0: - mc.displayGuiScreen((GuiScreen)null); + mc.displayGuiScreen(null); break; case 2: container.advanceIteration(); @@ -138,7 +138,7 @@ public class GuiCatalogue extends GuiForestry { SessionVars.setStringVar("mail.letter.recipient", info.address.getName()); SessionVars.setStringVar("mail.letter.addressee", EnumAddressee.TRADER.toString()); } - mc.displayGuiScreen((GuiScreen)null); + mc.displayGuiScreen(null); break; } } diff --git a/src/main/java/forestry/mail/gui/GuiLetter.java b/src/main/java/forestry/mail/gui/GuiLetter.java index 7bd389742..25fd670d9 100755 --- a/src/main/java/forestry/mail/gui/GuiLetter.java +++ b/src/main/java/forestry/mail/gui/GuiLetter.java @@ -76,7 +76,7 @@ public class GuiLetter extends GuiForestry { boolean addressFocus; boolean textFocus; - protected ArrayList tradeInfoWidgets; + protected final ArrayList tradeInfoWidgets; private final ContainerLetter container; diff --git a/src/main/java/forestry/mail/gui/GuiTradeName.java b/src/main/java/forestry/mail/gui/GuiTradeName.java index fbc8565fa..d660bc1ca 100755 --- a/src/main/java/forestry/mail/gui/GuiTradeName.java +++ b/src/main/java/forestry/mail/gui/GuiTradeName.java @@ -75,7 +75,7 @@ public class GuiTradeName extends GuiForestry { protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { // Close gui screen if we linked up. if (container.machine.isLinked()) { - this.mc.displayGuiScreen((GuiScreen) null); + this.mc.displayGuiScreen(null); this.mc.setIngameFocus(); } diff --git a/src/main/java/forestry/mail/triggers/TriggerBuffer.java b/src/main/java/forestry/mail/triggers/TriggerBuffer.java index ddbb52103..7955e393c 100755 --- a/src/main/java/forestry/mail/triggers/TriggerBuffer.java +++ b/src/main/java/forestry/mail/triggers/TriggerBuffer.java @@ -19,7 +19,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class TriggerBuffer extends Trigger { - float threshold; + private final float threshold; public TriggerBuffer(String tag, float threshold) { super(tag, "mailBuffer"); diff --git a/src/main/java/forestry/mail/triggers/TriggerLowInput.java b/src/main/java/forestry/mail/triggers/TriggerLowInput.java index f509bb5c9..a9ebb718d 100755 --- a/src/main/java/forestry/mail/triggers/TriggerLowInput.java +++ b/src/main/java/forestry/mail/triggers/TriggerLowInput.java @@ -19,7 +19,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class TriggerLowInput extends Trigger { - float threshold; + private final float threshold; public TriggerLowInput(String tag, float threshold) { super(tag, "lowInput"); diff --git a/src/main/java/forestry/mail/triggers/TriggerLowPaper.java b/src/main/java/forestry/mail/triggers/TriggerLowPaper.java index a9abd2f88..4d3cc877b 100755 --- a/src/main/java/forestry/mail/triggers/TriggerLowPaper.java +++ b/src/main/java/forestry/mail/triggers/TriggerLowPaper.java @@ -19,7 +19,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class TriggerLowPaper extends Trigger { - int threshold; + private final int threshold; public TriggerLowPaper(String tag, int threshold) { super(tag, "lowPaper"); diff --git a/src/main/java/forestry/mail/triggers/TriggerLowStamps.java b/src/main/java/forestry/mail/triggers/TriggerLowStamps.java index a7536223e..ca68f5b2e 100755 --- a/src/main/java/forestry/mail/triggers/TriggerLowStamps.java +++ b/src/main/java/forestry/mail/triggers/TriggerLowStamps.java @@ -19,7 +19,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class TriggerLowStamps extends Trigger { - int threshold; + private final int threshold; public TriggerLowStamps(String tag, int threshold) { super(tag, "lowStamps"); diff --git a/src/main/java/forestry/pipes/PipeLogicPropolis.java b/src/main/java/forestry/pipes/PipeLogicPropolis.java index 7f5e39501..a051d89fd 100755 --- a/src/main/java/forestry/pipes/PipeLogicPropolis.java +++ b/src/main/java/forestry/pipes/PipeLogicPropolis.java @@ -32,10 +32,10 @@ import forestry.core.proxy.Proxies; public class PipeLogicPropolis { @SuppressWarnings("rawtypes") - private Pipe pipe; + private final Pipe pipe; - private EnumFilterType[] typeFilter = new EnumFilterType[6]; - private IAllele[][][] genomeFilter = new IAllele[6][3][2]; + private final EnumFilterType[] typeFilter = new EnumFilterType[6]; + private final IAllele[][][] genomeFilter = new IAllele[6][3][2]; @SuppressWarnings("rawtypes") public PipeLogicPropolis(Pipe pipe) { diff --git a/src/main/java/forestry/pipes/gui/ContainerPropolisPipe.java b/src/main/java/forestry/pipes/gui/ContainerPropolisPipe.java index 7a7a94467..165d9c609 100755 --- a/src/main/java/forestry/pipes/gui/ContainerPropolisPipe.java +++ b/src/main/java/forestry/pipes/gui/ContainerPropolisPipe.java @@ -26,7 +26,7 @@ public class ContainerPropolisPipe extends ContainerForestry { public ContainerPropolisPipe(IInventory playerInventory, PipeItemsPropolis pipe) { super(new InventoryAdapter(0, "Empty")); this.playerIInventory = playerInventory; - this.pipeLogic = (PipeLogicPropolis) pipe.pipeLogic; + this.pipeLogic = pipe.pipeLogic; for (int l = 0; l < 3; l++) for (int k1 = 0; k1 < 9; k1++) diff --git a/src/main/java/forestry/pipes/gui/GuiPropolisPipe.java b/src/main/java/forestry/pipes/gui/GuiPropolisPipe.java index d257db228..f133b482e 100755 --- a/src/main/java/forestry/pipes/gui/GuiPropolisPipe.java +++ b/src/main/java/forestry/pipes/gui/GuiPropolisPipe.java @@ -47,8 +47,8 @@ public class GuiPropolisPipe extends GuiForestry { class TypeFilterSlot extends Widget { - ForgeDirection orientation; - PipeLogicPropolis logic; + private final ForgeDirection orientation; + private final PipeLogicPropolis logic; public TypeFilterSlot(int x, int y, ForgeDirection orientation, PipeLogicPropolis logic) { super(widgetManager, x, y); @@ -98,11 +98,11 @@ public class GuiPropolisPipe extends GuiForestry { class SpeciesFilterSlot extends Widget { - IApiaristTracker tracker; - ForgeDirection orientation; - PipeLogicPropolis logic; - int pattern; - int allele; + private final IApiaristTracker tracker; + private final ForgeDirection orientation; + private final PipeLogicPropolis logic; + private final int pattern; + private final int allele; public SpeciesFilterSlot(IApiaristTracker tracker, int x, int y, ForgeDirection orientation, int pattern, int allele, PipeLogicPropolis logic) { super(widgetManager, x, y); @@ -204,7 +204,7 @@ public class GuiPropolisPipe extends GuiForestry { } } - PipeLogicPropolis pipeLogic; + private final PipeLogicPropolis pipeLogic; public GuiPropolisPipe(EntityPlayer player, PipeItemsPropolis pipe) { super(Defaults.TEXTURE_PATH_GUI + "/analyzer.png", new ContainerPropolisPipe(player.inventory, pipe)); diff --git a/src/main/java/forestry/plugins/PluginArboriculture.java b/src/main/java/forestry/plugins/PluginArboriculture.java index 60fb7fef4..2df069478 100644 --- a/src/main/java/forestry/plugins/PluginArboriculture.java +++ b/src/main/java/forestry/plugins/PluginArboriculture.java @@ -153,7 +153,7 @@ public class PluginArboriculture extends ForestryPlugin { public static int modelIdPods; public static ITreeRoot treeInterface; public static MachineDefinition definitionChest; - public static List validFences = new ArrayList(); + public static final List validFences = new ArrayList(); private static final EnumSet logs = EnumSet.of( ForestryBlock.log1, ForestryBlock.log2, @@ -474,12 +474,11 @@ public class PluginArboriculture extends ForestryPlugin { Proxies.common.addRecipe(ForestryBlock.fences2.getItemStack(4, i), "###", "# #", '#', ForestryBlock.planks2.getItemStack(1, i)); // Treealyzer - RecipeManagers.carpenterManager.addRecipe(100, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 2000), null, ForestryItem.treealyzer.getItemStack(), new Object[]{ - "X#X", "X#X", "RDR", - '#', Blocks.glass_pane, - 'X', "ingotCopper", - 'R', Items.redstone, - 'D', Items.diamond}); + RecipeManagers.carpenterManager.addRecipe(100, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 2000), null, ForestryItem.treealyzer.getItemStack(), "X#X", "X#X", "RDR", + '#', Blocks.glass_pane, + 'X', "ingotCopper", + 'R', Items.redstone, + 'D', Items.diamond); // SQUEEZER RECIPES RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.CHERRY.ordinal())}, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 5 * GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed")), ForestryItem.mulch.getItemStack(), 5); diff --git a/src/main/java/forestry/plugins/PluginCore.java b/src/main/java/forestry/plugins/PluginCore.java index 4f2b27ea5..411514819 100755 --- a/src/main/java/forestry/plugins/PluginCore.java +++ b/src/main/java/forestry/plugins/PluginCore.java @@ -78,7 +78,7 @@ public class PluginCore extends ForestryPlugin { public static MachineDefinition definitionEscritoire; // ICrashCallable for highlighting certain mods during crashes. public static ForestryModEnvWarningCallable crashCallable; - public static RootCommand rootCommand = new RootCommand(); + public static final RootCommand rootCommand = new RootCommand(); @Override public void preInit() { diff --git a/src/main/java/forestry/plugins/PluginFactory.java b/src/main/java/forestry/plugins/PluginFactory.java index 784fb537c..05eec8e43 100755 --- a/src/main/java/forestry/plugins/PluginFactory.java +++ b/src/main/java/forestry/plugins/PluginFactory.java @@ -374,15 +374,15 @@ public class PluginFactory extends ForestryPlugin { // / CHIPSETS RecipeManagers.carpenterManager.addRecipe(20, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 0), - new Object[]{"R R", "R#R", "R R", '#', "ingotTin", 'R', Items.redstone}); + "R R", "R#R", "R R", '#', "ingotTin", 'R', Items.redstone); RecipeManagers.carpenterManager.addRecipe(40, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 1), - new Object[]{"R#R", "R#R", "R#R", '#', "ingotBronze", 'R', Items.redstone}); + "R#R", "R#R", "R#R", '#', "ingotBronze", 'R', Items.redstone); RecipeManagers.carpenterManager.addRecipe(80, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 2), - new Object[]{"R#R", "R#R", "R#R", '#', Items.iron_ingot, 'R', Items.redstone}); + "R#R", "R#R", "R#R", '#', Items.iron_ingot, 'R', Items.redstone); RecipeManagers.carpenterManager.addRecipe(80, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 3), - new Object[]{"R#R", "R#R", "R#R", '#', Items.gold_ingot, 'R', Items.redstone}); + "R#R", "R#R", "R#R", '#', Items.gold_ingot, 'R', Items.redstone); RecipeManagers.carpenterManager.addRecipe(40, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.solderingIron.getItemStack(), - new Object[]{" # ", "# #", " B", '#', Items.iron_ingot, 'B', "ingotBronze"}); + " # ", "# #", " B", '#', Items.iron_ingot, 'B', "ingotBronze"); // ForestryCore.oreHandler.registerCarpenterRecipe(solderingIron); // RAIN SUBSTRATES @@ -408,17 +408,17 @@ public class PluginFactory extends ForestryPlugin { } // Ender pearl - RecipeManagers.carpenterManager.addRecipe(100, null, new ItemStack(Items.ender_pearl, 1), new Object[]{" # ", "###", " # ", '#', - ForestryItem.craftingMaterial.getItemStack(1, 1)}); + RecipeManagers.carpenterManager.addRecipe(100, null, new ItemStack(Items.ender_pearl, 1), " # ", "###", " # ", '#', + ForestryItem.craftingMaterial.getItemStack(1, 1)); // Woven Silk RecipeManagers.carpenterManager.addRecipe(10, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 500), null, ForestryItem.craftingMaterial.getItemStack(1, 3), - new Object[]{"###", "###", "###", '#', ForestryItem.craftingMaterial.getItemStack(1, 2)}); + "###", "###", "###", '#', ForestryItem.craftingMaterial.getItemStack(1, 2)); // Boxes RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.carton.getItemStack(2), - new Object[]{" # ", "# #", " # ", '#', "pulpWood"}); + " # ", "# #", " # ", '#', "pulpWood"); RecipeManagers.carpenterManager.addRecipe(20, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.crate.getItemStack(24), - new Object[]{" # ", "# #", " # ", '#', "logWood"}); + " # ", "# #", " # ", '#', "logWood"); // Assembly Kits RecipeManagers.carpenterManager.addRecipe(20, null, ForestryItem.carton.getItemStack(), ForestryItem.kitPickaxe.getItemStack(), new Object[]{ @@ -433,8 +433,8 @@ public class PluginFactory extends ForestryPlugin { // Reclamation RecipeManagers.carpenterManager.addRecipe(null, ForestryItem.ingotBronze.getItemStack(2, ForestryItem.ingotBronze.item().getMaxDamage()), - new Object[]{"#", '#', ForestryItem.brokenBronzePickaxe}); - RecipeManagers.carpenterManager.addRecipe(null, ForestryItem.ingotBronze.getItemStack(), new Object[]{"#", '#', ForestryItem.brokenBronzeShovel}); + "#", '#', ForestryItem.brokenBronzePickaxe); + RecipeManagers.carpenterManager.addRecipe(null, ForestryItem.ingotBronze.getItemStack(), "#", '#', ForestryItem.brokenBronzeShovel); // Crating and uncrating condensed if (PluginManager.Module.STORAGE.isEnabled()) { diff --git a/src/main/java/forestry/plugins/PluginFarmCraftory.java b/src/main/java/forestry/plugins/PluginFarmCraftory.java index a98aab6d5..5a785612d 100755 --- a/src/main/java/forestry/plugins/PluginFarmCraftory.java +++ b/src/main/java/forestry/plugins/PluginFarmCraftory.java @@ -36,16 +36,16 @@ public class PluginFarmCraftory extends ForestryPlugin { public static Method methodGrowthSingle; public static Method methodGrowthMulti; - public static HashMap vegetableSeeds = new HashMap(); + public static final HashMap vegetableSeeds = new HashMap(); public static final String[] seedIdentifiers = new String[]{"turnipSeedBag", "cabbageSeedBag", "onionSeedBag", "spinachSeedBag", "leekSeedBag", "cucumberSeedBag", "tomatoSeedBag", "eggplantSeedBag", "greenPepperSeedBag", "yamSeedBag", "strawberrySeedBag", "pineappleSeedBag"}; - public static HashMap vegetableItems = new HashMap(); + public static final HashMap vegetableItems = new HashMap(); public static final String[] vegetableIdentifiers = new String[]{"turnipItem", "cabbageItem", "onionItem", "spinachItem", "leekItem", "cucumberItem", "tomatoItem", "eggplantItem", "greenPepperItem", "yamItem", "strawberryItem", "pineappleItem"}; - public static HashMap cerealSeeds = new HashMap(); + public static final HashMap cerealSeeds = new HashMap(); public static final String[] cseedIdentifiers = new String[]{"cornSeedBag"}; - public static HashMap cerealItems = new HashMap(); + public static final HashMap cerealItems = new HashMap(); public static final String[] cerealIdentifiers = new String[]{"cornItem"}; @Override diff --git a/src/main/java/forestry/plugins/PluginLepidopterology.java b/src/main/java/forestry/plugins/PluginLepidopterology.java index 0efb4c37e..1630ac097 100755 --- a/src/main/java/forestry/plugins/PluginLepidopterology.java +++ b/src/main/java/forestry/plugins/PluginLepidopterology.java @@ -149,8 +149,8 @@ public class PluginLepidopterology extends ForestryPlugin { CraftingManager.getInstance().getRecipeList().add(new MatingRecipe()); RecipeManagers.carpenterManager.addRecipe(100, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 2000), null, ForestryItem.flutterlyzer.getItemStack(), - new Object[]{"X#X", "X#X", "RDR", Character.valueOf('#'), Blocks.glass_pane, Character.valueOf('X'), "ingotBronze", Character.valueOf('R'), - Items.redstone, Character.valueOf('D'), Items.diamond}); + "X#X", "X#X", "RDR", Character.valueOf('#'), Blocks.glass_pane, Character.valueOf('X'), "ingotBronze", Character.valueOf('R'), + Items.redstone, Character.valueOf('D'), Items.diamond); } private void createAlleles() { diff --git a/src/main/java/forestry/plugins/PluginManager.java b/src/main/java/forestry/plugins/PluginManager.java index fe0036323..cc5628a8f 100755 --- a/src/main/java/forestry/plugins/PluginManager.java +++ b/src/main/java/forestry/plugins/PluginManager.java @@ -46,12 +46,12 @@ public class PluginManager { public static final String MODULE_CONFIG_FILE_NAME = "modules.cfg"; public static final String CATEGORY_MODULES = "modules"; - public static ArrayList guiHandlers = Lists.newArrayList(); - public static ArrayList packetHandlers = Lists.newArrayList(); - public static ArrayList pickupHandlers = Lists.newArrayList(); - public static ArrayList saveEventHandlers = Lists.newArrayList(); - public static ArrayList resupplyHandlers = Lists.newArrayList(); - public static ArrayList dictionaryHandlers = Lists.newArrayList(); + public static final ArrayList guiHandlers = Lists.newArrayList(); + public static final ArrayList packetHandlers = Lists.newArrayList(); + public static final ArrayList pickupHandlers = Lists.newArrayList(); + public static final ArrayList saveEventHandlers = Lists.newArrayList(); + public static final ArrayList resupplyHandlers = Lists.newArrayList(); + public static final ArrayList dictionaryHandlers = Lists.newArrayList(); private static final Set loadedModules = EnumSet.noneOf(Module.class); private static final Set unloadedModules = EnumSet.allOf(Module.class); @@ -284,8 +284,7 @@ public class PluginManager { private static boolean isEnabled(Configuration config, Module m) { Plugin info = m.instance().getClass().getAnnotation(Plugin.class); - boolean defaultValue = true; - Property prop = config.get(CATEGORY_MODULES, m.toString().toLowerCase(Locale.ENGLISH).replace('_', '.'), defaultValue); + Property prop = config.get(CATEGORY_MODULES, m.toString().toLowerCase(Locale.ENGLISH).replace('_', '.'), true); prop.comment = StatCollector.translateToLocal(info.unlocalizedDescription()); return prop.getBoolean(true); } diff --git a/src/main/java/forestry/plugins/PluginNatura.java b/src/main/java/forestry/plugins/PluginNatura.java index 95d12751c..8611c3700 100755 --- a/src/main/java/forestry/plugins/PluginNatura.java +++ b/src/main/java/forestry/plugins/PluginNatura.java @@ -84,8 +84,8 @@ public class PluginNatura extends ForestryPlugin { seedList.add(seedCotton); int amount = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed"); - for (int i = 0; i < seedList.size(); ++i) - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{seedList.get(i)}, + for (ItemStack aSeedList : seedList) + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{aSeedList}, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, amount)); ItemStack berryBlight = GameRegistry.findItemStack(NATURA, "berryBlight", 1); @@ -117,8 +117,8 @@ public class PluginNatura extends ForestryPlugin { amount = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") / 25; amount = (amount > 1) ? amount : 1; // Produce at least 1 mb of juice. - for (int i = 0; i < berries.size(); ++i) - RecipeManagers.squeezerManager.addRecipe(3, new ItemStack[]{berries.get(i)}, + for (ItemStack berry : berries) + RecipeManagers.squeezerManager.addRecipe(3, new ItemStack[]{berry}, LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, amount)); } diff --git a/src/main/java/forestry/plugins/PluginStorage.java b/src/main/java/forestry/plugins/PluginStorage.java index dc609de97..c8bfb475d 100755 --- a/src/main/java/forestry/plugins/PluginStorage.java +++ b/src/main/java/forestry/plugins/PluginStorage.java @@ -85,7 +85,7 @@ public class PluginStorage extends ForestryPlugin implements IOreDictionaryHandl private final ArrayList hunterItems = new ArrayList(); private final ArrayList adventurerItems = new ArrayList(); private final ArrayList builderItems = new ArrayList(); - static String CONFIG_CATEGORY = "backpacks"; + private final static String CONFIG_CATEGORY = "backpacks"; Configuration config; @Override @@ -482,46 +482,46 @@ public class PluginStorage extends ForestryPlugin implements IOreDictionaryHandl // Miner's Backpack Proxies.common.addRecipe(ForestryItem.minerBackpack.getItemStack(), - new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', - Items.iron_ingot, 'Y', Blocks.chest}); + "X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', + Items.iron_ingot, 'Y', Blocks.chest); // Digger's Backpack Proxies.common.addRecipe(ForestryItem.diggerBackpack.getItemStack(), - new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', - Blocks.stone, 'Y', Blocks.chest}); + "X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', + Blocks.stone, 'Y', Blocks.chest); // Forester's Backpack - Proxies.common.addRecipe(ForestryItem.foresterBackpack.getItemStack(), new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, - 'X', Items.string, 'V', "logWood", 'Y', Blocks.chest}); + Proxies.common.addRecipe(ForestryItem.foresterBackpack.getItemStack(), "X#X", "VYV", "X#X", '#', Blocks.wool, + 'X', Items.string, 'V', "logWood", 'Y', Blocks.chest); // Hunter's Backpack Proxies.common.addRecipe(ForestryItem.hunterBackpack.getItemStack(), - new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', - Items.feather, 'Y', Blocks.chest}); + "X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', + Items.feather, 'Y', Blocks.chest); // Adventurer's Backpack - Proxies.common.addRecipe(ForestryItem.adventurerBackpack.getItemStack(), new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, - 'X', Items.string, 'V', Items.bone, 'Y', Blocks.chest}); + Proxies.common.addRecipe(ForestryItem.adventurerBackpack.getItemStack(), "X#X", "VYV", "X#X", '#', Blocks.wool, + 'X', Items.string, 'V', Items.bone, 'Y', Blocks.chest); // Builder's Backpack - Proxies.common.addRecipe(ForestryItem.builderBackpack.getItemStack(), new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, - 'X', Items.string, 'V', Items.clay_ball, 'Y', Blocks.chest}); + Proxies.common.addRecipe(ForestryItem.builderBackpack.getItemStack(), "X#X", "VYV", "X#X", '#', Blocks.wool, + 'X', Items.string, 'V', Items.clay_ball, 'Y', Blocks.chest); // / CARPENTER // / BACKPACKS T2 RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.minerBackpackT2.getItemStack(), - new Object[]{"WXW", "WTW", "WWW", 'X', Items.diamond, 'W', - ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.minerBackpack}); + "WXW", "WTW", "WWW", 'X', Items.diamond, 'W', + ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.minerBackpack); RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.diggerBackpackT2.getItemStack(), - new Object[]{"WXW", "WTW", "WWW", 'X', Items.diamond, 'W', - ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.diggerBackpack}); + "WXW", "WTW", "WWW", 'X', Items.diamond, 'W', + ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.diggerBackpack); RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.foresterBackpackT2.getItemStack(), - new Object[]{"WXW", "WTW", "WWW", 'X', Items.diamond, 'W', - ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.foresterBackpack}); + "WXW", "WTW", "WWW", 'X', Items.diamond, 'W', + ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.foresterBackpack); RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.hunterBackpackT2.getItemStack(), - new Object[]{"WXW", "WTW", "WWW", 'X', Items.diamond, 'W', - ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.hunterBackpack}); + "WXW", "WTW", "WWW", 'X', Items.diamond, 'W', + ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.hunterBackpack); RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.adventurerBackpackT2.getItemStack(), - new Object[]{"WXW", "WTW", "WWW", 'X', Items.diamond, 'W', - ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.adventurerBackpack}); + "WXW", "WTW", "WWW", 'X', Items.diamond, 'W', + ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.adventurerBackpack); RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.builderBackpackT2.getItemStack(), - new Object[]{"WXW", "WTW", "WWW", 'X', Items.diamond, 'W', - ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.builderBackpack}); + "WXW", "WTW", "WWW", 'X', Items.diamond, 'W', + ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.builderBackpack); } diff --git a/src/main/java/forestry/storage/BackpackDefinition.java b/src/main/java/forestry/storage/BackpackDefinition.java index 7df429125..a17d205e1 100755 --- a/src/main/java/forestry/storage/BackpackDefinition.java +++ b/src/main/java/forestry/storage/BackpackDefinition.java @@ -24,12 +24,12 @@ import net.minecraft.util.StatCollector; public class BackpackDefinition implements IBackpackDefinition { - final String name; + private final String name; - final int primaryColor; // - c03384 - final int secondaryColor; + private final int primaryColor; // - c03384 + private final int secondaryColor; - ArrayList validItems = new ArrayList(); + private final ArrayList validItems = new ArrayList(); public BackpackDefinition(String name, int primaryColor) { this(name, primaryColor, 0xffffff); diff --git a/src/main/java/forestry/storage/PickupHandlerStorage.java b/src/main/java/forestry/storage/PickupHandlerStorage.java index 57dfb1e92..766f9ae4d 100755 --- a/src/main/java/forestry/storage/PickupHandlerStorage.java +++ b/src/main/java/forestry/storage/PickupHandlerStorage.java @@ -42,7 +42,7 @@ public class PickupHandlerStorage implements IPickupHandler { if (pack == null || pack.stackSize <= 0) continue; - if (itemstack == null || itemstack.stackSize <= 0) + if (itemstack.stackSize <= 0) break; if (!(pack.getItem() instanceof ItemBackpack)) @@ -53,7 +53,7 @@ public class PickupHandlerStorage implements IPickupHandler { backpack.tryStowing(player, pack, itemstack); } - if (itemstack == null || itemstack.stackSize <= 0) + if (itemstack.stackSize <= 0) return false; else return true; diff --git a/src/main/java/forestry/storage/gui/ContainerNaturalistBackpack.java b/src/main/java/forestry/storage/gui/ContainerNaturalistBackpack.java index cbeaf614d..d0322062d 100755 --- a/src/main/java/forestry/storage/gui/ContainerNaturalistBackpack.java +++ b/src/main/java/forestry/storage/gui/ContainerNaturalistBackpack.java @@ -36,7 +36,7 @@ public class ContainerNaturalistBackpack extends ContainerItemInventory implemen // Inventory for (int x = 0; x < 5; x++) { for (int y = 0; y < 5; y++) { - addSlot(new SlotCustom(inventory, y + page * pageSize + x * 5, 100 + y * 18, 21 + x * 18, new Object[] { speciesRoot })); + addSlot(new SlotCustom(inventory, y + page * pageSize + x * 5, 100 + y * 18, 21 + x * 18, speciesRoot)); } }