diff --git a/api/forestry b/api/forestry index c89dc65d0..3af28ebac 160000 --- a/api/forestry +++ b/api/forestry @@ -1 +1 @@ -Subproject commit c89dc65d0094dd490e8435ec46237134645b2e74 +Subproject commit 3af28ebac3af2e1751569052223ec81d3c331be1 diff --git a/src/main/java/forestry/apiculture/commands/CommandBeeGive.java b/src/main/java/forestry/apiculture/commands/CommandBeeGive.java index 44be24660..1900b0326 100644 --- a/src/main/java/forestry/apiculture/commands/CommandBeeGive.java +++ b/src/main/java/forestry/apiculture/commands/CommandBeeGive.java @@ -150,7 +150,7 @@ public class CommandBeeGive extends SubCommand { return null; } - String[] getSpecies() { + private static String[] getSpecies() { List species = new ArrayList(); for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) { @@ -162,7 +162,7 @@ public class CommandBeeGive extends SubCommand { return species.toArray(new String[species.size()]); } - EnumBeeType getBeeType(String beeTypeName) { + private static EnumBeeType getBeeType(String beeTypeName) { for (EnumBeeType beeType : EnumBeeType.values()) { if (beeType.getName().equalsIgnoreCase(beeTypeName)) { return beeType; diff --git a/src/main/java/forestry/apiculture/entities/EntityBee.java b/src/main/java/forestry/apiculture/entities/EntityBee.java index 852264f74..791078fd9 100755 --- a/src/main/java/forestry/apiculture/entities/EntityBee.java +++ b/src/main/java/forestry/apiculture/entities/EntityBee.java @@ -29,9 +29,9 @@ public class EntityBee extends EntityCreature implements IAnimals { private static final String DEFAULT_TEXTURE = Defaults.TEXTURE_PATH_ENTITIES + "/bees/honeyBee.png"; - IBee contained; - IAlleleBeeSpecies species; - EnumBeeType type = EnumBeeType.DRONE; + private IBee contained; + private IAlleleBeeSpecies species; + private EnumBeeType type = EnumBeeType.DRONE; private String beeTexture = DEFAULT_TEXTURE; private long lastUpdate; diff --git a/src/main/java/forestry/apiculture/gadgets/BlockAlveary.java b/src/main/java/forestry/apiculture/gadgets/BlockAlveary.java index 4c870a708..62d1b2014 100755 --- a/src/main/java/forestry/apiculture/gadgets/BlockAlveary.java +++ b/src/main/java/forestry/apiculture/gadgets/BlockAlveary.java @@ -232,7 +232,7 @@ public class BlockAlveary extends BlockStructure { return getIcon(side, 0); } - return icons[((TileAlveary) tile).getIcon(side, world.getBlockMetadata(x, y, z))]; + return icons[((TileAlveary) tile).getIcon(side)]; } @SideOnly(Side.CLIENT) diff --git a/src/main/java/forestry/apiculture/gadgets/BlockBeehives.java b/src/main/java/forestry/apiculture/gadgets/BlockBeehives.java index 093ed7c76..9630b1ead 100755 --- a/src/main/java/forestry/apiculture/gadgets/BlockBeehives.java +++ b/src/main/java/forestry/apiculture/gadgets/BlockBeehives.java @@ -132,7 +132,7 @@ public class BlockBeehives extends BlockContainer { return meta; } - private List getDropsForHive(int meta) { + private static List getDropsForHive(int meta) { String hiveName = getHiveNameForMeta(meta); if (hiveName == null) { return Collections.emptyList(); @@ -140,7 +140,7 @@ public class BlockBeehives extends BlockContainer { return PluginApiculture.hiveRegistry.getDrops(hiveName); } - private String getHiveNameForMeta(int meta) { + private static String getHiveNameForMeta(int meta) { switch (meta) { case 1: return HiveRegistry.forest; diff --git a/src/main/java/forestry/apiculture/gadgets/BlockCandle.java b/src/main/java/forestry/apiculture/gadgets/BlockCandle.java index 4d86fcd03..61231456d 100755 --- a/src/main/java/forestry/apiculture/gadgets/BlockCandle.java +++ b/src/main/java/forestry/apiculture/gadgets/BlockCandle.java @@ -213,7 +213,6 @@ public class BlockCandle extends BlockTorch { private static boolean tryDye(ItemStack held, boolean isLit, TileCandle tileCandle) { // Check for dye-able ness. - boolean matched = false; for (Map.Entry colour : colours.entrySet()) { String colourName = colour.getKey(); for (ItemStack stack : OreDictionary.getOres(colourName)) { @@ -233,7 +232,7 @@ public class BlockCandle extends BlockTorch { /* DROP HANDLING */ // Hack: When harvesting we need to get the drops in onBlockHarvested, // because Mojang destroys the block and tile before calling getDrops. - protected ThreadLocal drop = new ThreadLocal(); + private final ThreadLocal drop = new ThreadLocal(); @Override public void onBlockHarvested(World world, int x, int y, int z, int metadata, EntityPlayer player) { @@ -301,7 +300,7 @@ public class BlockCandle extends BlockTorch { } } - protected static int getColourValueFromItemStack(ItemStack itemStack) { + private static int getColourValueFromItemStack(ItemStack itemStack) { int value = 0xffffff; // default to white. if (itemStack.hasTagCompound()) { NBTTagCompound tag = itemStack.getTagCompound(); diff --git a/src/main/java/forestry/apiculture/gadgets/TileApiary.java b/src/main/java/forestry/apiculture/gadgets/TileApiary.java index 4b1c9e7a9..4e8649911 100755 --- a/src/main/java/forestry/apiculture/gadgets/TileApiary.java +++ b/src/main/java/forestry/apiculture/gadgets/TileApiary.java @@ -38,7 +38,6 @@ import forestry.api.apiculture.IBeekeepingMode; import forestry.api.apiculture.IHiveFrame; import forestry.api.core.ForestryAPI; import forestry.apiculture.trigger.ApicultureTriggers; -import forestry.core.gadgets.TileBase; import forestry.core.inventory.wrappers.InventoryMapper; import forestry.core.network.GuiId; import forestry.core.utils.GuiUtil; @@ -65,7 +64,7 @@ public class TileApiary extends TileBeeHousing { } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.ApiaryGUI.ordinal(), worldObj, xCoord, yCoord, zCoord); } diff --git a/src/main/java/forestry/apiculture/gadgets/TileBeeHousing.java b/src/main/java/forestry/apiculture/gadgets/TileBeeHousing.java index a31ac285b..510796e5c 100644 --- a/src/main/java/forestry/apiculture/gadgets/TileBeeHousing.java +++ b/src/main/java/forestry/apiculture/gadgets/TileBeeHousing.java @@ -37,7 +37,7 @@ public abstract class TileBeeHousing extends TileBase implements IBeeHousing, IC // CLIENT private int breedingProgressPercent = 0; - public TileBeeHousing() { + protected TileBeeHousing() { setHints(Config.hints.get("apiary")); this.beeLogic = BeeManager.beeRoot.createBeekeepingLogic(this); } @@ -102,10 +102,10 @@ public abstract class TileBeeHousing extends TileBase implements IBeeHousing, IC float upSpread = (worldObj.rand.nextFloat() * 6F) / 16F; fxY += upSpread; - Proxies.common.addEntitySwarmFX(worldObj, (fxX - distanceFromCenter), fxY, (fxZ + leftRightSpreadFromCenter), 0F, 0F, 0F); - Proxies.common.addEntitySwarmFX(worldObj, (fxX + distanceFromCenter), fxY, (fxZ + leftRightSpreadFromCenter), 0F, 0F, 0F); - Proxies.common.addEntitySwarmFX(worldObj, (fxX + leftRightSpreadFromCenter), fxY, (fxZ - distanceFromCenter), 0F, 0F, 0F); - Proxies.common.addEntitySwarmFX(worldObj, (fxX + leftRightSpreadFromCenter), fxY, (fxZ + distanceFromCenter), 0F, 0F, 0F); + Proxies.common.addEntitySwarmFX(worldObj, (fxX - distanceFromCenter), fxY, (fxZ + leftRightSpreadFromCenter)); + Proxies.common.addEntitySwarmFX(worldObj, (fxX + distanceFromCenter), fxY, (fxZ + leftRightSpreadFromCenter)); + Proxies.common.addEntitySwarmFX(worldObj, (fxX + leftRightSpreadFromCenter), fxY, (fxZ - distanceFromCenter)); + Proxies.common.addEntitySwarmFX(worldObj, (fxX + leftRightSpreadFromCenter), fxY, (fxZ + distanceFromCenter)); } } } diff --git a/src/main/java/forestry/apiculture/gadgets/TileBeehouse.java b/src/main/java/forestry/apiculture/gadgets/TileBeehouse.java index c28cd3ff9..0c1c9d004 100755 --- a/src/main/java/forestry/apiculture/gadgets/TileBeehouse.java +++ b/src/main/java/forestry/apiculture/gadgets/TileBeehouse.java @@ -21,7 +21,6 @@ import forestry.api.apiculture.IBeeHousingInventory; import forestry.api.apiculture.IBeeListener; import forestry.api.apiculture.IBeeModifier; import forestry.api.core.ForestryAPI; -import forestry.core.gadgets.TileBase; import forestry.core.network.GuiId; public class TileBeehouse extends TileBeeHousing { @@ -46,7 +45,7 @@ public class TileBeehouse extends TileBeeHousing { } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.BeehouseGUI.ordinal(), worldObj, xCoord, yCoord, zCoord); } diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectAggressive.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectAggressive.java index 77d3da493..3245777fe 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 final DamageSource damageSourceBeeAggressive = new DamageSourceForestry("bee.aggressive"); + private static final DamageSource damageSourceBeeAggressive = new DamageSourceForestry("bee.aggressive"); public AlleleEffectAggressive() { super("aggressive", true, 40, false, false); diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectFertile.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectFertile.java index 7c3148281..a3754c3a6 100644 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectFertile.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectFertile.java @@ -23,7 +23,7 @@ import forestry.core.vect.IVect; public class AlleleEffectFertile extends AlleleEffectThrottled { - public static final int MAX_BLOCK_FIND_TRIES = 5; + private static final int MAX_BLOCK_FIND_TRIES = 5; public AlleleEffectFertile() { super("fertile", false, 6, true, false); diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectFungification.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectFungification.java index 9e72b518b..45229f94f 100644 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectFungification.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectFungification.java @@ -20,8 +20,8 @@ import forestry.core.vect.IVect; public class AlleleEffectFungification extends AlleleEffectThrottled { - public static final int MAX_BLOCK_FIND_TRIES = 10; - public static final int ENTITY_THROTTLE = 6; + private static final int MAX_BLOCK_FIND_TRIES = 10; + private static final int ENTITY_THROTTLE = 6; public AlleleEffectFungification() { super("mycophilic", true, 10, false, false); diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectMisanthrope.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectMisanthrope.java index 1854bb067..6dd6c8f99 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 final DamageSource damageSourceBeeEnd = new DamageSourceForestry("bee.end"); + private static final DamageSource damageSourceBeeEnd = new DamageSourceForestry("bee.end"); public AlleleEffectMisanthrope() { super("misanthrope", true, 20, false, false); diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectNone.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectNone.java index c520e2b2c..12cf11ffa 100755 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectNone.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectNone.java @@ -18,9 +18,7 @@ import forestry.api.apiculture.IBeeHousing; import forestry.api.apiculture.IBeeModifier; import forestry.api.genetics.IEffectData; import forestry.apiculture.BeeHousingModifier; -import forestry.apiculture.gadgets.TileBeehouse; import forestry.core.genetics.alleles.AlleleCategorized; -import forestry.core.vect.IVect; import forestry.core.vect.MutableVect; import forestry.core.vect.Vect; import forestry.plugins.PluginApiculture; diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectRadioactive.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectRadioactive.java index 9900b79b2..171b8cfbd 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.vect.Vect; public class AlleleEffectRadioactive extends AlleleEffectThrottled { - public static final DamageSource damageSourceBeeRadioactive = new DamageSourceForestry("bee.radioactive"); + private static final DamageSource damageSourceBeeRadioactive = new DamageSourceForestry("bee.radioactive"); public AlleleEffectRadioactive() { super("radioactive", true, 40, false, true); diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectSnowing.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectSnowing.java index 9f53515a8..0fc19ebe5 100755 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectSnowing.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectSnowing.java @@ -23,7 +23,6 @@ import forestry.api.core.EnumTemperature; import forestry.api.genetics.IEffectData; import forestry.core.config.Defaults; import forestry.core.proxy.Proxies; -import forestry.core.vect.IVect; import forestry.core.vect.Vect; public class AlleleEffectSnowing extends AlleleEffectThrottled { @@ -87,7 +86,7 @@ public class AlleleEffectSnowing extends AlleleEffectThrottled { World world = housing.getWorld(); Vect spawn = Vect.getRandomPositionInArea(world.rand, area).add(coordinates).add(offset); - Proxies.common.addEntitySnowFX(world, spawn.x, spawn.y, spawn.z, 0F, 0F, 0F); + Proxies.common.addEntitySnowFX(world, spawn.x, spawn.y, spawn.z); return storedData; } else { return super.doFX(genome, storedData, housing); diff --git a/src/main/java/forestry/apiculture/genetics/AlleleEffectThrottled.java b/src/main/java/forestry/apiculture/genetics/AlleleEffectThrottled.java index 60439d0ac..4c322a540 100755 --- a/src/main/java/forestry/apiculture/genetics/AlleleEffectThrottled.java +++ b/src/main/java/forestry/apiculture/genetics/AlleleEffectThrottled.java @@ -21,17 +21,13 @@ public abstract class AlleleEffectThrottled extends AlleleEffectNone { private final int throttle; private boolean requiresWorkingQueen = false; - public AlleleEffectThrottled(String name, boolean isDominant, int throttle, boolean requiresWorking, boolean isCombinable) { + protected AlleleEffectThrottled(String name, boolean isDominant, int throttle, boolean requiresWorking, boolean isCombinable) { super(name, isDominant); this.throttle = throttle; this.isCombinable = isCombinable; this.requiresWorkingQueen = requiresWorking; } - public int getThrottle() { - return throttle; - } - @Override public boolean isCombinable() { return isCombinable; @@ -60,11 +56,11 @@ public abstract class AlleleEffectThrottled extends AlleleEffectNone { return true; } - int throt = storedData.getInteger(0); - throt++; - storedData.setInteger(0, throt); + int time = storedData.getInteger(0); + time++; + storedData.setInteger(0, time); - if (throt < getThrottle()) { + if (time < throttle) { return true; } diff --git a/src/main/java/forestry/apiculture/genetics/Bee.java b/src/main/java/forestry/apiculture/genetics/Bee.java index df657491c..09a07ff8c 100644 --- a/src/main/java/forestry/apiculture/genetics/Bee.java +++ b/src/main/java/forestry/apiculture/genetics/Bee.java @@ -73,11 +73,11 @@ import forestry.core.vect.Vect; public class Bee extends IndividualLiving implements IBee { - protected int generation; - protected boolean isNatural = true; + private int generation; + private boolean isNatural = true; - public IBeeGenome genome; - public IBeeGenome mate; + private IBeeGenome genome; + private IBeeGenome mate; private static final LoadingCache getBeeCache = CacheBuilder.newBuilder() .maximumSize(128) @@ -109,7 +109,7 @@ public class Bee extends IndividualLiving implements IBee { this(genome, true, 0); } - public Bee(IBeeGenome genome, boolean isNatural, int generation) { + private Bee(IBeeGenome genome, boolean isNatural, int generation) { super(genome.getLifespan()); this.genome = genome; this.isNatural = isNatural; @@ -319,7 +319,7 @@ public class Bee extends IndividualLiving implements IBee { return !genome.getPrimary().isNocturnal() || genome.getNocturnal(); } - public boolean isSuitableBiome(BiomeGenBase biome) { + private boolean isSuitableBiome(BiomeGenBase biome) { if (biome == null) { return false; } diff --git a/src/main/java/forestry/apiculture/genetics/BeeDefinition.java b/src/main/java/forestry/apiculture/genetics/BeeDefinition.java index 503a16cc1..01cf8fbe8 100644 --- a/src/main/java/forestry/apiculture/genetics/BeeDefinition.java +++ b/src/main/java/forestry/apiculture/genetics/BeeDefinition.java @@ -951,7 +951,7 @@ public enum BeeDefinition implements IBeeDefinition { } }; - public static final EnumSet overworldHiveBees = EnumSet.of(FOREST, MARSHY, MEADOWS, MODEST, TROPICAL, WINTRY); + private static final EnumSet overworldHiveBees = EnumSet.of(FOREST, MARSHY, MEADOWS, MODEST, TROPICAL, WINTRY); private final BeeBranchDefinition branch; private final IAlleleBeeSpeciesCustom species; diff --git a/src/main/java/forestry/apiculture/genetics/BeeHelper.java b/src/main/java/forestry/apiculture/genetics/BeeHelper.java index df2ecbdc2..72c97e9b7 100755 --- a/src/main/java/forestry/apiculture/genetics/BeeHelper.java +++ b/src/main/java/forestry/apiculture/genetics/BeeHelper.java @@ -49,7 +49,7 @@ import forestry.plugins.PluginApiculture; public class BeeHelper extends SpeciesRoot implements IBeeRoot { - public static int beeSpeciesCount = -1; + private static int beeSpeciesCount = -1; public static final String UID = "rootBees"; @Override @@ -204,7 +204,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot { } /* TEMPLATES */ - public static final ArrayList beeTemplates = new ArrayList(); + private static final ArrayList beeTemplates = new ArrayList(); @Override public ArrayList getIndividualTemplates() { diff --git a/src/main/java/forestry/apiculture/genetics/BeeVariation.java b/src/main/java/forestry/apiculture/genetics/BeeVariation.java index 3e6353944..5c2ac79be 100644 --- a/src/main/java/forestry/apiculture/genetics/BeeVariation.java +++ b/src/main/java/forestry/apiculture/genetics/BeeVariation.java @@ -15,7 +15,7 @@ public abstract class BeeVariation implements IBeeDefinition { private final IAllele[] template; private final IBeeGenome genome; - public BeeVariation(IBeeDefinition bee) { + protected BeeVariation(IBeeDefinition bee) { template = bee.getTemplate(); initializeTemplate(template); genome = BeeManager.beeRoot.templateAsGenome(template); diff --git a/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java b/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java index 7a1d43539..470da3c67 100755 --- a/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java +++ b/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java @@ -83,7 +83,7 @@ public class GuiBeealyzer extends GuiAlyzer { drawAnalyticsPage2(bee, beeType); break; case 3: - drawAnalyticsPage3(bee, beeType); + drawAnalyticsPage3(bee); break; case 4: drawAnalyticsPageMutations(bee); @@ -243,7 +243,7 @@ public class GuiBeealyzer extends GuiAlyzer { endPage(); } - private void drawAnalyticsPage3(IBee bee, EnumBeeType type) { + private void drawAnalyticsPage3(IBee bee) { startPage(COLUMN_0, COLUMN_1, COLUMN_2); diff --git a/src/main/java/forestry/apiculture/gui/GuiImprinter.java b/src/main/java/forestry/apiculture/gui/GuiImprinter.java index 6262d7cc9..3cceee88a 100755 --- a/src/main/java/forestry/apiculture/gui/GuiImprinter.java +++ b/src/main/java/forestry/apiculture/gui/GuiImprinter.java @@ -80,7 +80,7 @@ public class GuiImprinter extends GuiForestry(bee.getSuitableBiomes()); this.searchAngleIteration = 0; diff --git a/src/main/java/forestry/apiculture/items/ItemHoneycomb.java b/src/main/java/forestry/apiculture/items/ItemHoneycomb.java index e98728f35..20fe5d546 100755 --- a/src/main/java/forestry/apiculture/items/ItemHoneycomb.java +++ b/src/main/java/forestry/apiculture/items/ItemHoneycomb.java @@ -44,7 +44,7 @@ public class ItemHoneycomb extends ItemForestryMultiPass { } } - public final CombInfo[] combs = new CombInfo[]{ + private final CombInfo[] combs = new CombInfo[]{ new CombInfo("honey", 0xe8d56a, 0xffa12b), // 0 new CombInfo("cocoa", 0x674016, 0xffb62b).setIsSecret(), // 1 new CombInfo("simmering", 0x981919, 0xffb62b), // 2 @@ -106,12 +106,8 @@ public class ItemHoneycomb extends ItemForestryMultiPass { } } - public int getCombTypeCount() { - return combs.length; - } - - public int getRandomCombType(Random random, boolean includeSecret) { - List validCombs = new ArrayList(getCombTypeCount()); + private int getRandomCombType(Random random, boolean includeSecret) { + List validCombs = new ArrayList(combs.length); for (int i = 0; i < combs.length; i++) { if (!combs[i].isSecret || includeSecret) { validCombs.add(i); diff --git a/src/main/java/forestry/apiculture/multiblock/AlvearyController.java b/src/main/java/forestry/apiculture/multiblock/AlvearyController.java index 8bf48584f..72110b672 100644 --- a/src/main/java/forestry/apiculture/multiblock/AlvearyController.java +++ b/src/main/java/forestry/apiculture/multiblock/AlvearyController.java @@ -305,10 +305,10 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple fxY += upSpread; // display fx on all 4 sides - Proxies.common.addEntitySwarmFX(worldObj, (fxX - distanceFromCenter), fxY, (fxZ + leftRightSpreadFromCenter), 0F, 0F, 0F); - Proxies.common.addEntitySwarmFX(worldObj, (fxX + distanceFromCenter), fxY, (fxZ + leftRightSpreadFromCenter), 0F, 0F, 0F); - Proxies.common.addEntitySwarmFX(worldObj, (fxX + leftRightSpreadFromCenter), fxY, (fxZ - distanceFromCenter), 0F, 0F, 0F); - Proxies.common.addEntitySwarmFX(worldObj, (fxX + leftRightSpreadFromCenter), fxY, (fxZ + distanceFromCenter), 0F, 0F, 0F); + Proxies.common.addEntitySwarmFX(worldObj, (fxX - distanceFromCenter), fxY, (fxZ + leftRightSpreadFromCenter)); + Proxies.common.addEntitySwarmFX(worldObj, (fxX + distanceFromCenter), fxY, (fxZ + leftRightSpreadFromCenter)); + Proxies.common.addEntitySwarmFX(worldObj, (fxX + leftRightSpreadFromCenter), fxY, (fxZ - distanceFromCenter)); + Proxies.common.addEntitySwarmFX(worldObj, (fxX + leftRightSpreadFromCenter), fxY, (fxZ + distanceFromCenter)); } } } diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlveary.java b/src/main/java/forestry/apiculture/multiblock/TileAlveary.java index 14ca61c5a..d808b00d4 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlveary.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlveary.java @@ -29,7 +29,7 @@ public abstract class TileAlveary extends RectangularMultiblockTileEntityBase { public static final int SIEVE_META = 7; /* TEXTURES */ - public int getIcon(int side, int metadata) { + public int getIcon(int side) { return BlockAlveary.PLAIN; } diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlvearyClimatiser.java b/src/main/java/forestry/apiculture/multiblock/TileAlvearyClimatiser.java index ec33cfeb6..ca090b4c4 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlvearyClimatiser.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlvearyClimatiser.java @@ -46,7 +46,7 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner // CLIENT private boolean active; - public TileAlvearyClimatiser(IClimitiserDefinition definition) { + protected TileAlvearyClimatiser(IClimitiserDefinition definition) { this.definition = definition; this.energyManager = new EnergyManager(1000, 50, 2000); @@ -71,7 +71,7 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner /* TEXTURES */ @Override - public int getIcon(int side, int metadata) { + public int getIcon(int side) { if (active) { return definition.getIconOn(); } else { diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlvearyHygroregulator.java b/src/main/java/forestry/apiculture/multiblock/TileAlvearyHygroregulator.java index d5b0c9807..d24de4b18 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlvearyHygroregulator.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlvearyHygroregulator.java @@ -146,7 +146,7 @@ public class TileAlvearyHygroregulator extends TileAlvearyWithGui implements IIn /* TEXTURES */ @Override - public int getIcon(int side, int metadata) { + public int getIcon(int side) { return BlockAlveary.ALVEARY_HYGRO; } diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlvearySieve.java b/src/main/java/forestry/apiculture/multiblock/TileAlvearySieve.java index 21caa6576..51264e014 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlvearySieve.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlvearySieve.java @@ -51,7 +51,7 @@ public class TileAlvearySieve extends TileAlvearyWithGui implements ICrafter, IA /* TEXTURES & INTERNAL */ @Override - public int getIcon(int side, int metadata) { + public int getIcon(int side) { if (side == 0 || side == 1) { return BlockAlveary.BOTTOM; } diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlvearyStabiliser.java b/src/main/java/forestry/apiculture/multiblock/TileAlvearyStabiliser.java index 8790d2462..f76aa6d69 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlvearyStabiliser.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlvearyStabiliser.java @@ -22,7 +22,7 @@ public class TileAlvearyStabiliser extends TileAlveary implements IAlvearyCompon /* TEXTURES */ @Override - public int getIcon(int side, int metadata) { + public int getIcon(int side) { if (side == 0 || side == 1) { return BlockAlveary.BOTTOM; } diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlvearySwarmer.java b/src/main/java/forestry/apiculture/multiblock/TileAlvearySwarmer.java index 0907f6124..a95647036 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlvearySwarmer.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlvearySwarmer.java @@ -137,7 +137,7 @@ public class TileAlvearySwarmer extends TileAlvearyWithGui implements ISidedInve int chunkX = (xCoord + worldObj.rand.nextInt(40 * 2) - 40) / 16; int chunkZ = (zCoord + worldObj.rand.nextInt(40 * 2) - 40) / 16; - if (HiveDecorator.instance().genHive(worldObj, worldObj.rand, chunkX, chunkZ, hive)) { + if (HiveDecorator.genHive(worldObj, worldObj.rand, chunkX, chunkZ, hive)) { pendingSpawns.pop(); } } @@ -158,7 +158,7 @@ public class TileAlvearySwarmer extends TileAlvearyWithGui implements ISidedInve /* TEXTURES */ @Override - public int getIcon(int side, int metadata) { + public int getIcon(int side) { if (side == 0 || side == 1) { return BlockAlveary.BOTTOM; } diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlvearyWithGui.java b/src/main/java/forestry/apiculture/multiblock/TileAlvearyWithGui.java index 29b014345..9826c4e12 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlvearyWithGui.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlvearyWithGui.java @@ -33,7 +33,7 @@ public abstract class TileAlvearyWithGui extends TileAlveary implements IStreama private final String unlocalizedTitle; private final GuiId guiId; - public TileAlvearyWithGui(int meta, GuiId guiId) { + protected TileAlvearyWithGui(int meta, GuiId guiId) { this.accessHandler = new AccessHandler(this); this.unlocalizedTitle = "alveary." + meta + ".name"; this.guiId = guiId; diff --git a/src/main/java/forestry/apiculture/proxy/ClientProxyApiculture.java b/src/main/java/forestry/apiculture/proxy/ClientProxyApiculture.java index 6d733233f..299a80c70 100755 --- a/src/main/java/forestry/apiculture/proxy/ClientProxyApiculture.java +++ b/src/main/java/forestry/apiculture/proxy/ClientProxyApiculture.java @@ -28,8 +28,6 @@ import forestry.core.interfaces.IBlockRenderer; import forestry.core.proxy.ClientProxyRender; import forestry.core.render.RenderAnalyzer; import forestry.core.render.TextureManager; -import forestry.core.vect.IVect; -import forestry.core.vect.Vect; import forestry.plugins.PluginApiculture; public class ClientProxyApiculture extends ProxyApiculture { @@ -51,7 +49,7 @@ public class ClientProxyApiculture extends ProxyApiculture { return; } - EntityFX fx = new EntityBeeFX(world, coordinates.posX + 0.5D, coordinates.posY + 0.5D, coordinates.posZ + 0.5D, 0.0f, 0.0f, 0.0f, color); + EntityFX fx = new EntityBeeFX(world, coordinates.posX + 0.5D, coordinates.posY + 0.5D, coordinates.posZ + 0.5D, color); fx.setParticleIcon(TextureManager.getInstance().getDefault(icon)); ParticleRenderer.getInstance().addEffect(fx); } @@ -65,14 +63,14 @@ public class ClientProxyApiculture extends ProxyApiculture { EntityFX fx; if (world.rand.nextBoolean()) { - fx = new EntityBeeFX(world, xCoord, yCoord, zCoord, 0.0f, 0.0f, 0.0f, color); + fx = new EntityBeeFX(world, xCoord, yCoord, zCoord, color); } else { double spawnX = xCoord + world.rand.nextInt(4) - 2; double spawnY = yCoord + world.rand.nextInt(4) - 2; double spawnZ = zCoord + world.rand.nextInt(4) - 2; - fx = new EntityBeeFX(world, spawnX, spawnY, spawnZ, 0.0f, 0.0f, 0.0f, color); + fx = new EntityBeeFX(world, spawnX, spawnY, spawnZ, color); } fx.setParticleIcon(TextureManager.getInstance().getDefault(icon)); diff --git a/src/main/java/forestry/apiculture/proxy/ProxyApiculture.java b/src/main/java/forestry/apiculture/proxy/ProxyApiculture.java index bc74ee66c..3c39492c5 100755 --- a/src/main/java/forestry/apiculture/proxy/ProxyApiculture.java +++ b/src/main/java/forestry/apiculture/proxy/ProxyApiculture.java @@ -14,7 +14,6 @@ import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import forestry.core.interfaces.IBlockRenderer; -import forestry.core.vect.IVect; public class ProxyApiculture { public void addBeeHiveFX(String texture, World world, ChunkCoordinates coordinates, int color) { diff --git a/src/main/java/forestry/apiculture/render/BeeItemRenderer.java b/src/main/java/forestry/apiculture/render/BeeItemRenderer.java index 5fbd739ec..febad37e7 100755 --- a/src/main/java/forestry/apiculture/render/BeeItemRenderer.java +++ b/src/main/java/forestry/apiculture/render/BeeItemRenderer.java @@ -27,8 +27,7 @@ import forestry.core.proxy.Proxies; public class BeeItemRenderer implements IItemRenderer { - ModelBee model; - EntityBee entity; + private EntityBee entity; private static float getWingYaw(IBee bee) { float wingYaw = 1f; @@ -45,7 +44,7 @@ public class BeeItemRenderer implements IItemRenderer { return wingYaw; } - public static float getIrregularWingYaw(long flapping, float flap) { + private static float getIrregularWingYaw(long flapping, float flap) { long irregular = flapping / 1000; float wingYaw; @@ -62,7 +61,7 @@ public class BeeItemRenderer implements IItemRenderer { return wingYaw; } - public static float getRegularWingYaw(float flap) { + private static float getRegularWingYaw(float flap) { return flap < 0.5 ? 0.75f + flap : 1.75f - flap; } diff --git a/src/main/java/forestry/apiculture/render/EntityBeeFX.java b/src/main/java/forestry/apiculture/render/EntityBeeFX.java index 90d4c5e99..b65f26724 100755 --- a/src/main/java/forestry/apiculture/render/EntityBeeFX.java +++ b/src/main/java/forestry/apiculture/render/EntityBeeFX.java @@ -15,7 +15,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.world.World; public class EntityBeeFX extends EntityFX { - public EntityBeeFX(World world, double x, double y, double z, float motionScaleX, float motionScaleY, float motionScaleZ, int color) { + public EntityBeeFX(World world, double x, double y, double z, int color) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); particleRed = (color >> 16 & 255) / 255.0F; diff --git a/src/main/java/forestry/apiculture/render/ModelBee.java b/src/main/java/forestry/apiculture/render/ModelBee.java index 19906591e..5f8a0800d 100755 --- a/src/main/java/forestry/apiculture/render/ModelBee.java +++ b/src/main/java/forestry/apiculture/render/ModelBee.java @@ -35,7 +35,7 @@ public class ModelBee extends ModelBase { private final ModelRenderer crownQueen; private final ModelRenderer crownPrincess; - EnumBeeType type = EnumBeeType.DRONE; + private EnumBeeType type = EnumBeeType.DRONE; public ModelBee() { textureWidth = 64; @@ -154,7 +154,7 @@ public class ModelBee extends ModelBase { GL11.glPopMatrix(); } - private void setRotation(ModelRenderer model, float x, float y, float z) { + private static void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; diff --git a/src/main/java/forestry/apiculture/render/RenderBee.java b/src/main/java/forestry/apiculture/render/RenderBee.java index dadd19a8a..03d7c57af 100755 --- a/src/main/java/forestry/apiculture/render/RenderBee.java +++ b/src/main/java/forestry/apiculture/render/RenderBee.java @@ -25,7 +25,7 @@ public class RenderBee extends RenderLiving { beeModel = (ModelBee) mainModel; } - public void renderBee(EntityBee entity, double posX, double posY, double posZ, float par8, float par9) { + private void renderBee(EntityBee entity, double posX, double posY, double posZ, float par8, float par9) { beeModel.setType(entity.getType()); this.doRender(entity, posX, posY, posZ, par8, par9); } diff --git a/src/main/java/forestry/apiculture/render/TextureHabitatLocator.java b/src/main/java/forestry/apiculture/render/TextureHabitatLocator.java index b5c22fe81..f12fdc79a 100644 --- a/src/main/java/forestry/apiculture/render/TextureHabitatLocator.java +++ b/src/main/java/forestry/apiculture/render/TextureHabitatLocator.java @@ -27,8 +27,8 @@ public class TextureHabitatLocator extends TextureAtlasSprite { private ChunkCoordinates targetBiome; private boolean targetBiomeFound; - public double currentAngle; - public double angleDelta; + private double currentAngle; + private double angleDelta; public TextureHabitatLocator(String iconName) { super(iconName); @@ -51,7 +51,7 @@ public class TextureHabitatLocator extends TextureAtlasSprite { } } - public void updateCompass(World world, double playerX, double playerZ, double playerYaw) { + private void updateCompass(World world, double playerX, double playerZ, double playerYaw) { double targetAngle; diff --git a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java index ef8f14379..11bf88a4b 100755 --- a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java +++ b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java @@ -55,12 +55,12 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { private static final Random random = new Random(); - protected int averageGroundLevel = -1; - protected boolean isInDesert = false; - protected IBlockType planks; - protected IBlockType logs; - protected IBlockType stairs; - protected IBlockType fence; + private int averageGroundLevel = -1; + private boolean isInDesert = false; + private IBlockType planks; + private IBlockType logs; + private IBlockType stairs; + private IBlockType fence; public ComponentVillageBeeHouse() { createBuildingBlocks(random); @@ -90,7 +90,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { logs = new BlockType(Blocks.log, random.nextInt(4)); planks = new BlockType(Blocks.planks, roofMeta); - stairs = new BlockTypeVanillaStairs(Blocks.oak_stairs, roofMeta); + stairs = new BlockTypeVanillaStairs(roofMeta); fence = new BlockType(Blocks.fence, 0); } } @@ -132,7 +132,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { plantFlowerGarden(world, structBoundingBox, 2, 1, 5, 7, 1, 9); // Apiaries - buildApiaries(world, structBoundingBox, 3, 1, 4, 6, 1, 8); + buildApiaries(world, structBoundingBox); // Floor fillWithBlocks(world, structBoundingBox, 1, 0, 1, 7, 0, 4, Blocks.planks, Blocks.planks, false); @@ -228,7 +228,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { } } - protected void buildGarden(World world, StructureBoundingBox box) { + private void buildGarden(World world, StructureBoundingBox box) { Block ground = Blocks.dirt; if (isInDesert) { @@ -242,7 +242,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { } } - protected void plantFlowerGarden(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { + private void plantFlowerGarden(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { if (isInDesert) { placeBlockAtCurrentPosition(world, Blocks.cactus, 0, 4, 1, 7, box); @@ -269,7 +269,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { } } - protected void buildApiaries(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { + private void buildApiaries(World world, StructureBoundingBox box) { populateApiary(world, box, 3, 1, 8); populateApiary(world, box, 6, 1, 8); } @@ -362,7 +362,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { species.getHumidity(), genome.getToleranceHumid()); } - protected void fillBoxWith(World world, StructureBoundingBox box, int par3, int par4, int par5, int par6, int par7, int par8, IBlockType block, boolean replace) { + private void fillBoxWith(World world, StructureBoundingBox box, int par3, int par4, int par5, int par6, int par7, int par8, IBlockType block, boolean replace) { for (int var14 = par4; var14 <= par7; ++var14) { for (int var15 = par3; var15 <= par6; ++var15) { @@ -375,7 +375,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { } } - protected void placeBlockAtCurrentPosition(World world, IBlockType block, int par4, int par5, int par6, StructureBoundingBox par7StructureBoundingBox) { + private void placeBlockAtCurrentPosition(World world, IBlockType block, int par4, int par5, int par6, StructureBoundingBox par7StructureBoundingBox) { int x = getXWithOffset(par4, par6); int y = getYWithOffset(par5); int z = getZWithOffset(par4, par6); diff --git a/src/main/java/forestry/apiculture/worldgen/HiveDecorator.java b/src/main/java/forestry/apiculture/worldgen/HiveDecorator.java index 92eaba018..4655fbf16 100755 --- a/src/main/java/forestry/apiculture/worldgen/HiveDecorator.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveDecorator.java @@ -29,26 +29,12 @@ import forestry.core.config.Config; import forestry.core.config.Defaults; import forestry.plugins.PluginApiculture; -/** - * @author CovertJaguar - */ -public class HiveDecorator { +public abstract class HiveDecorator { @SuppressWarnings("rawtypes") - public static final EventType EVENT_TYPE = EnumHelper.addEnum(EventType.class, "FORESTRY_HIVES", new Class[0], new Object[0]); - private static HiveDecorator instance; + private static final EventType EVENT_TYPE = EnumHelper.addEnum(EventType.class, "FORESTRY_HIVES", new Class[0], new Object[0]); - public static HiveDecorator instance() { - if (instance == null) { - instance = new HiveDecorator(); - } - return instance; - } - - private HiveDecorator() { - } - - public void decorateHives(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { + public static void decorateHives(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { if (!TerrainGen.populate(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated, EVENT_TYPE)) { return; } @@ -56,7 +42,7 @@ public class HiveDecorator { decorateHives(world, rand, chunkX, chunkZ); } - public void decorateHives(World world, Random rand, int chunkX, int chunkZ) { + public static void decorateHives(World world, Random rand, int chunkX, int chunkZ) { List hives = PluginApiculture.hiveRegistry.getHives(); if (Config.generateBeehivesDebug) { @@ -72,7 +58,7 @@ public class HiveDecorator { } } - public boolean genHive(World world, Random rand, int chunkX, int chunkZ, Hive hive) { + public static boolean genHive(World world, Random rand, int chunkX, int chunkZ, Hive hive) { if (hive.genChance() * Config.getBeehivesAmount() < rand.nextFloat() * 100.0f) { return false; } @@ -99,7 +85,7 @@ public class HiveDecorator { return false; } - private void decorateHivesDebug(World world, int chunkX, int chunkZ, List hives) { + private static void decorateHivesDebug(World world, int chunkX, int chunkZ, List hives) { int worldX = chunkX * 16; int worldZ = chunkZ * 16; BiomeGenBase biome = world.getBiomeGenForCoords(worldX, worldZ); @@ -119,7 +105,7 @@ public class HiveDecorator { } } - private boolean tryGenHive(World world, int x, int z, Hive hive) { + private static boolean tryGenHive(World world, int x, int z, Hive hive) { int y = hive.getYForHive(world, x, z); @@ -144,7 +130,7 @@ public class HiveDecorator { return setHive(world, x, y, z, hive); } - protected boolean setHive(World world, int x, int y, int z, Hive hive) { + private static boolean setHive(World world, int x, int y, int z, Hive hive) { Block hiveBlock = hive.getHiveBlock(); boolean placed = world.setBlock(x, y, z, hiveBlock, hive.getHiveMeta(), Defaults.FLAG_BLOCK_SYNCH); if (!placed) { diff --git a/src/main/java/forestry/arboriculture/FruitProviderNone.java b/src/main/java/forestry/arboriculture/FruitProviderNone.java index da5aafd61..fa95d7af2 100755 --- a/src/main/java/forestry/arboriculture/FruitProviderNone.java +++ b/src/main/java/forestry/arboriculture/FruitProviderNone.java @@ -52,7 +52,7 @@ public class FruitProviderNone implements IFruitProvider { protected int ripeningPeriod = 10; - OverlayType overlay = null; + private OverlayType overlay = null; public FruitProviderNone(String key, IFruitFamily family) { this.key = key; diff --git a/src/main/java/forestry/arboriculture/FruitProviderRandom.java b/src/main/java/forestry/arboriculture/FruitProviderRandom.java index 998f616a1..edc3e49fb 100755 --- a/src/main/java/forestry/arboriculture/FruitProviderRandom.java +++ b/src/main/java/forestry/arboriculture/FruitProviderRandom.java @@ -28,8 +28,8 @@ import forestry.api.genetics.IFruitFamily; */ public class FruitProviderRandom extends FruitProviderNone { - HashMap products = new HashMap(); - int colour = 0xffffff; + private final Map products = new HashMap(); + private int colour = 0xffffff; public FruitProviderRandom(String key, IFruitFamily family, ItemStack product, float modifier) { super(key, family); diff --git a/src/main/java/forestry/arboriculture/FruitProviderRipening.java b/src/main/java/forestry/arboriculture/FruitProviderRipening.java index b8ac992fb..68cc24110 100755 --- a/src/main/java/forestry/arboriculture/FruitProviderRipening.java +++ b/src/main/java/forestry/arboriculture/FruitProviderRipening.java @@ -25,12 +25,13 @@ import forestry.api.genetics.IFruitFamily; public class FruitProviderRipening extends FruitProviderNone { - HashMap products = new HashMap(); + private final Map products = new HashMap(); - int colourRipe = 0xffffff; - int colourCallow = 0xffffff; + private int colourCallow = 0xffffff; - int diffR, diffG, diffB = 0; + private int diffR; + private int diffG; + private int diffB; public FruitProviderRipening(String key, IFruitFamily family, ItemStack product, float modifier) { super(key, family); @@ -38,7 +39,6 @@ public class FruitProviderRipening extends FruitProviderNone { } public FruitProviderRipening setColours(int ripe, int callow) { - colourRipe = ripe; colourCallow = callow; diffR = (ripe >> 16 & 255) - (callow >> 16 & 255); diff --git a/src/main/java/forestry/arboriculture/commands/TreeGenHelper.java b/src/main/java/forestry/arboriculture/commands/TreeGenHelper.java index 9565a7f2b..0d3390739 100644 --- a/src/main/java/forestry/arboriculture/commands/TreeGenHelper.java +++ b/src/main/java/forestry/arboriculture/commands/TreeGenHelper.java @@ -37,7 +37,7 @@ public final class TreeGenHelper { public static void generateTree(WorldGenerator gen, EntityPlayer player, int x, int y, int z) { if (gen instanceof WorldGenBase) { - ((WorldGenBase) gen).generate(player.worldObj, player.worldObj.rand, x, y, z, true); + ((WorldGenBase) gen).generate(player.worldObj, x, y, z, true); } else { gen.generate(player.worldObj, player.worldObj.rand, x, y, z); } diff --git a/src/main/java/forestry/arboriculture/gadgets/BlockArbFence.java b/src/main/java/forestry/arboriculture/gadgets/BlockArbFence.java index 9b293fe48..4e60681af 100755 --- a/src/main/java/forestry/arboriculture/gadgets/BlockArbFence.java +++ b/src/main/java/forestry/arboriculture/gadgets/BlockArbFence.java @@ -108,7 +108,7 @@ public class BlockArbFence extends BlockFence implements IWoodTyped, ITileEntity return type.getPlankIcon(); } - public static boolean isFence(IBlockAccess world, int x, int y, int z) { + private static boolean isFence(IBlockAccess world, int x, int y, int z) { Block block = world.getBlock(x, y, z); return PluginArboriculture.validFences.contains(block); } diff --git a/src/main/java/forestry/arboriculture/gadgets/BlockArbStairs.java b/src/main/java/forestry/arboriculture/gadgets/BlockArbStairs.java index aaa992095..2c928f5d0 100755 --- a/src/main/java/forestry/arboriculture/gadgets/BlockArbStairs.java +++ b/src/main/java/forestry/arboriculture/gadgets/BlockArbStairs.java @@ -39,8 +39,8 @@ public class BlockArbStairs extends BlockStairs implements IWoodTyped, ITileEnti private final boolean fireproof; - public BlockArbStairs(Block par2Block, int par3, boolean fireproof) { - super(par2Block, par3); + public BlockArbStairs(Block par2Block, boolean fireproof) { + super(par2Block, 0); this.fireproof = fireproof; diff --git a/src/main/java/forestry/arboriculture/gadgets/BlockFruitPod.java b/src/main/java/forestry/arboriculture/gadgets/BlockFruitPod.java index fe454365c..d87c92b1b 100755 --- a/src/main/java/forestry/arboriculture/gadgets/BlockFruitPod.java +++ b/src/main/java/forestry/arboriculture/gadgets/BlockFruitPod.java @@ -125,7 +125,7 @@ public class BlockFruitPod extends BlockCocoa { public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { TileFruitPod pod = getPodTile(world, x, y, z); if (pod != null) { - IIcon podIcon = pod.getIcon(world.getBlockMetadata(x, y, z), side); + IIcon podIcon = pod.getIcon(); if (podIcon != null) { return podIcon; } diff --git a/src/main/java/forestry/arboriculture/gadgets/BlockTreeContainer.java b/src/main/java/forestry/arboriculture/gadgets/BlockTreeContainer.java index 98ca76936..543f67106 100755 --- a/src/main/java/forestry/arboriculture/gadgets/BlockTreeContainer.java +++ b/src/main/java/forestry/arboriculture/gadgets/BlockTreeContainer.java @@ -19,7 +19,7 @@ import net.minecraft.world.World; public abstract class BlockTreeContainer extends BlockContainer { - public BlockTreeContainer(Material material) { + protected BlockTreeContainer(Material material) { super(material); setTickRandomly(true); } diff --git a/src/main/java/forestry/arboriculture/gadgets/ForestryBlockLeaves.java b/src/main/java/forestry/arboriculture/gadgets/ForestryBlockLeaves.java index ee47ff5f7..38f2f0b4f 100644 --- a/src/main/java/forestry/arboriculture/gadgets/ForestryBlockLeaves.java +++ b/src/main/java/forestry/arboriculture/gadgets/ForestryBlockLeaves.java @@ -108,7 +108,7 @@ public class ForestryBlockLeaves extends BlockNewLeaf implements ITileEntityProv /* DROP HANDLING */ // Hack: When harvesting leaves we need to get the drops in onBlockHarvested, // because Mojang destroys the block and tile before calling getDrops. - protected ThreadLocal> drops = new ThreadLocal>(); + private final ThreadLocal> drops = new ThreadLocal>(); @Override public void onBlockHarvested(World world, int x, int y, int z, int metadata, EntityPlayer player) { diff --git a/src/main/java/forestry/arboriculture/gadgets/TileFruitPod.java b/src/main/java/forestry/arboriculture/gadgets/TileFruitPod.java index 4d7742b6d..d145cca06 100755 --- a/src/main/java/forestry/arboriculture/gadgets/TileFruitPod.java +++ b/src/main/java/forestry/arboriculture/gadgets/TileFruitPod.java @@ -112,7 +112,7 @@ public class TileFruitPod extends TileEntity implements IFruitBearer, IStreamabl } @SideOnly(Side.CLIENT) - public IIcon getIcon(int metadata, int side) { + public IIcon getIcon() { if (maturity < indices.length) { return TextureManager.getInstance().getIcon((short) indices[maturity]); } else { diff --git a/src/main/java/forestry/arboriculture/gadgets/TileLeaves.java b/src/main/java/forestry/arboriculture/gadgets/TileLeaves.java index f24974b05..9f05d787c 100755 --- a/src/main/java/forestry/arboriculture/gadgets/TileLeaves.java +++ b/src/main/java/forestry/arboriculture/gadgets/TileLeaves.java @@ -207,7 +207,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru return damage > tree.getResilience(); } - public boolean isPollinated() { + private boolean isPollinated() { ITree tree = getTree(); return tree != null && !isDestroyed(tree, damage) && tree.getMate() != null; } @@ -315,7 +315,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru } /* NETWORK */ - public void sendNetworkUpdate() { + private void sendNetworkUpdate() { Proxies.net.sendNetworkPacket(new PacketTileStream(this), worldObj); } diff --git a/src/main/java/forestry/arboriculture/gadgets/TileSapling.java b/src/main/java/forestry/arboriculture/gadgets/TileSapling.java index 46d13d95d..24e23c991 100755 --- a/src/main/java/forestry/arboriculture/gadgets/TileSapling.java +++ b/src/main/java/forestry/arboriculture/gadgets/TileSapling.java @@ -94,7 +94,7 @@ public class TileSapling extends TileTreeContainer { WorldGenerator generator = tree.getTreeGenerator(worldObj, xCoord, yCoord, zCoord, bonemealed); final boolean generated; if (generator instanceof WorldGenBase) { - generated = ((WorldGenBase) generator).generate(worldObj, worldObj.rand, xCoord, yCoord, zCoord, bonemealed); + generated = ((WorldGenBase) generator).generate(worldObj, xCoord, yCoord, zCoord, bonemealed); } else { generated = generator.generate(worldObj, worldObj.rand, xCoord, yCoord, zCoord); } diff --git a/src/main/java/forestry/arboriculture/gadgets/TileTreeContainer.java b/src/main/java/forestry/arboriculture/gadgets/TileTreeContainer.java index 0a438ef97..9fbe78d67 100755 --- a/src/main/java/forestry/arboriculture/gadgets/TileTreeContainer.java +++ b/src/main/java/forestry/arboriculture/gadgets/TileTreeContainer.java @@ -86,7 +86,7 @@ public abstract class TileTreeContainer extends TileEntity implements IStreamabl setTree(tree); } - public static ITree getTree(String speciesUID) { + private static ITree getTree(String speciesUID) { IAllele[] treeTemplate = TreeManager.treeRoot.getTemplate(speciesUID); if (treeTemplate == null) { return null; diff --git a/src/main/java/forestry/arboriculture/genetics/GrowthProvider.java b/src/main/java/forestry/arboriculture/genetics/GrowthProvider.java index 7c49687db..c3ec3c21d 100755 --- a/src/main/java/forestry/arboriculture/genetics/GrowthProvider.java +++ b/src/main/java/forestry/arboriculture/genetics/GrowthProvider.java @@ -27,7 +27,7 @@ public class GrowthProvider implements IGrowthProvider { @Override public boolean canGrow(ITreeGenome genome, World world, int xPos, int yPos, int zPos, int expectedGirth, int expectedHeight) { - if (!hasRoom(genome, world, xPos, yPos, zPos, expectedGirth, expectedHeight)) { + if (!hasRoom(world, xPos, yPos, zPos, expectedGirth, expectedHeight)) { return false; } @@ -90,17 +90,7 @@ public class GrowthProvider implements IGrowthProvider { } } - /* - * protected EnumGrowthConditions getConditionFromGround(World world, int xPos, int yPos, int zPos) { Block block = Block.blocksList[world.getBlock(xPos, - * yPos - 1, zPos)]; if(block == null) return EnumGrowthConditions.HOSTILE; - * - * for(EnumPlantType type : this.validPlantTypes) { this.plantType = type; if(block.canSustainPlant(world, xPos, yPos - 1, zPos, ForgeDirection.UP, this)) - * return EnumGrowthConditions.EXCELLENT; } - * - * return EnumGrowthConditions.HOSTILE; } - */ - - protected static boolean hasRoom(ITreeGenome genome, World world, int xPos, int yPos, int zPos, int expectedGirth, int expectedHeight) { + private static boolean hasRoom(World world, int xPos, int yPos, int zPos, int expectedGirth, int expectedHeight) { int offset = (expectedGirth - 1) / 2; // if(offset <= 0) @@ -111,7 +101,7 @@ public class GrowthProvider implements IGrowthProvider { return checkArea(world, start, area); } - protected static boolean checkArea(World world, Vect start, Vect area) { + private static boolean checkArea(World world, Vect start, Vect area) { for (int x = start.x; x < start.x + area.x; x++) { for (int y = start.y; y < start.y + area.y; y++) { for (int z = start.z; z < start.z + area.z; z++) { @@ -124,7 +114,7 @@ public class GrowthProvider implements IGrowthProvider { return true; } - protected static boolean hasSufficientSaplings(ITreeGenome genome, World world, int xPos, int yPos, int zPos, int expectedGirth) { + private static boolean hasSufficientSaplings(ITreeGenome genome, World world, int xPos, int yPos, int zPos, int expectedGirth) { if (expectedGirth == 1) { return true; diff --git a/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java b/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java index f7496964c..34a53d5c9 100644 --- a/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java @@ -1009,7 +1009,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator { @Override public void setLeaves(World world, GameProfile owner, int x, int y, int z, boolean decorative) { - boolean placed = ForestryBlock.leaves.setBlock(world, x, y, z, 0, Defaults.FLAG_BLOCK_SYNCH); + boolean placed = ForestryBlock.leaves.setBlock(world, x, y, z, 0); if (!placed) { return; } diff --git a/src/main/java/forestry/arboriculture/genetics/TreeFactory.java b/src/main/java/forestry/arboriculture/genetics/TreeFactory.java index b0ce62af2..40bad3d6b 100644 --- a/src/main/java/forestry/arboriculture/genetics/TreeFactory.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeFactory.java @@ -25,7 +25,7 @@ import forestry.arboriculture.render.LeafIconProvider; public class TreeFactory implements ITreeFactory { @Override public IAlleleTreeSpeciesCustom createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, ILeafIconProvider leafIconProvider, IGermlingIconProvider germlingIconProvider, ITreeGenerator generator) { - IAlleleTreeSpeciesCustom treeSpecies = new AlleleTreeSpecies(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, leafIconProvider, germlingIconProvider, generator); + IAlleleTreeSpeciesCustom treeSpecies = new AlleleTreeSpecies(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, leafIconProvider, germlingIconProvider, generator); AlleleManager.alleleRegistry.registerAllele(treeSpecies); return treeSpecies; } diff --git a/src/main/java/forestry/arboriculture/genetics/TreeHelper.java b/src/main/java/forestry/arboriculture/genetics/TreeHelper.java index 36355116f..7252228e0 100755 --- a/src/main/java/forestry/arboriculture/genetics/TreeHelper.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeHelper.java @@ -59,8 +59,8 @@ import forestry.plugins.PluginArboriculture; public class TreeHelper extends SpeciesRoot implements ITreeRoot { public static final String UID = "rootTrees"; - public static int treeSpeciesCount = -1; - public static ITreekeepingMode activeTreekeepingMode; + private static int treeSpeciesCount = -1; + private static ITreekeepingMode activeTreekeepingMode; public static final ArrayList treeTemplates = new ArrayList(); private final ArrayList treekeepingModes = new ArrayList(); @@ -218,7 +218,7 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot { if (direction < 0) { return false; } - boolean placed = ForestryBlock.pods.setBlock(world, x, y, z, direction, Defaults.FLAG_BLOCK_SYNCH); + boolean placed = ForestryBlock.pods.setBlock(world, x, y, z, direction); if (!placed) { return false; } diff --git a/src/main/java/forestry/arboriculture/network/PacketRipeningUpdate.java b/src/main/java/forestry/arboriculture/network/PacketRipeningUpdate.java index 9e8e18aa1..a612a7c41 100644 --- a/src/main/java/forestry/arboriculture/network/PacketRipeningUpdate.java +++ b/src/main/java/forestry/arboriculture/network/PacketRipeningUpdate.java @@ -30,7 +30,7 @@ public class PacketRipeningUpdate extends PacketCoordinates { new PacketRipeningUpdate(data); } - public PacketRipeningUpdate(DataInputStreamForestry data) throws IOException { + private PacketRipeningUpdate(DataInputStreamForestry data) throws IOException { super(data); } diff --git a/src/main/java/forestry/arboriculture/proxy/ProxyArboriculture.java b/src/main/java/forestry/arboriculture/proxy/ProxyArboriculture.java index 66c9f486f..e6df896af 100755 --- a/src/main/java/forestry/arboriculture/proxy/ProxyArboriculture.java +++ b/src/main/java/forestry/arboriculture/proxy/ProxyArboriculture.java @@ -10,8 +10,6 @@ ******************************************************************************/ package forestry.arboriculture.proxy; -import net.minecraft.world.World; - public class ProxyArboriculture { public void initializeRendering() { @@ -29,7 +27,4 @@ public class ProxyArboriculture { return 6396257; } - public int getBiomeFoliageColour(World world, int x, int z) { - return getFoliageColorBasic(); - } } diff --git a/src/main/java/forestry/arboriculture/render/LeavesRenderingHandler.java b/src/main/java/forestry/arboriculture/render/LeavesRenderingHandler.java index c63cde1ad..b84f35819 100755 --- a/src/main/java/forestry/arboriculture/render/LeavesRenderingHandler.java +++ b/src/main/java/forestry/arboriculture/render/LeavesRenderingHandler.java @@ -73,7 +73,7 @@ public class LeavesRenderingHandler extends OverlayRenderingHandler implements I return PluginArboriculture.modelIdLeaves; } - private boolean renderFruitOverlay(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon texture, int multiplier) { + private static boolean renderFruitOverlay(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon texture, int multiplier) { float mR = (multiplier >> 16 & 255) / 255.0F; float mG = (multiplier >> 8 & 255) / 255.0F; @@ -88,7 +88,7 @@ public class LeavesRenderingHandler extends OverlayRenderingHandler implements I return renderFruitOverlayWithColorMultiplier(world, block, x, y, z, mR, mG, mB, renderer, texture); } - private boolean renderFruitOverlayWithColorMultiplier(IBlockAccess world, Block block, int x, int y, int z, float r, float g, float b, + private static boolean renderFruitOverlayWithColorMultiplier(IBlockAccess world, Block block, int x, int y, int z, float r, float g, float b, RenderBlocks renderer, IIcon texture) { int mixedBrightness = block.getMixedBrightnessForBlock(world, x, y, z); diff --git a/src/main/java/forestry/arboriculture/render/SaplingRenderHandler.java b/src/main/java/forestry/arboriculture/render/SaplingRenderHandler.java index 820145cde..688d76b52 100755 --- a/src/main/java/forestry/arboriculture/render/SaplingRenderHandler.java +++ b/src/main/java/forestry/arboriculture/render/SaplingRenderHandler.java @@ -27,7 +27,7 @@ import forestry.plugins.PluginArboriculture; public class SaplingRenderHandler implements ISimpleBlockRenderingHandler { - public static int renderLayer = 0; + private static int renderLayer = 0; @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { @@ -65,7 +65,7 @@ public class SaplingRenderHandler implements ISimpleBlockRenderingHandler { return PluginArboriculture.modelIdSaplings; } - protected boolean renderCrossedSquares(IAlleleTreeSpecies species, IBlockAccess world, Block block, int x, int y, int z) { + private static boolean renderCrossedSquares(IAlleleTreeSpecies species, IBlockAccess world, Block block, int x, int y, int z) { Tessellator tess = Tessellator.instance; @@ -83,11 +83,11 @@ public class SaplingRenderHandler implements ISimpleBlockRenderingHandler { } tess.setColorOpaque_F(r, g, b); - drawCrossedSquares(world, species, block, x, y, z, x, y, z, 1.0f); + drawCrossedSquares(species, x, y, z, 1.0f); return true; } - protected void drawCrossedSquares(IBlockAccess world, IAlleleTreeSpecies species, Block block, int x, int y, int z, double par3, double par5, double par7, float mod) { + private static void drawCrossedSquares(IAlleleTreeSpecies species, double par3, double par5, double par7, float mod) { Tessellator tess = Tessellator.instance; IIcon icon = species.getGermlingIcon(EnumGermlingType.SAPLING, renderLayer); diff --git a/src/main/java/forestry/arboriculture/worldgen/BlockTypeVanillaStairs.java b/src/main/java/forestry/arboriculture/worldgen/BlockTypeVanillaStairs.java index 397008f69..f7b49613e 100644 --- a/src/main/java/forestry/arboriculture/worldgen/BlockTypeVanillaStairs.java +++ b/src/main/java/forestry/arboriculture/worldgen/BlockTypeVanillaStairs.java @@ -1,14 +1,24 @@ +/******************************************************************************* + * 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.worldgen; -import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraftforge.common.util.ForgeDirection; import forestry.core.worldgen.BlockType; public class BlockTypeVanillaStairs extends BlockType { - public BlockTypeVanillaStairs(Block block, int meta) { - super(block, meta); + public BlockTypeVanillaStairs(int meta) { + super(Blocks.oak_stairs, meta); } @Override diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java index 27bf4c547..88f3fd9c4 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java @@ -10,8 +10,6 @@ ******************************************************************************/ package forestry.arboriculture.worldgen; -import java.util.Random; - import net.minecraft.init.Blocks; import net.minecraft.world.World; @@ -30,26 +28,26 @@ public abstract class WorldGenArboriculture extends WorldGenBase { private static final ITreeBlockType vineSouth = new TreeBlockType(Blocks.vine, 4); private static final ITreeBlockType vineWest = new TreeBlockType(Blocks.vine, 8); private static final ITreeBlockType vineEast = new TreeBlockType(Blocks.vine, 2); + private static final int minPodHeight = 3; private static final BlockType air = new BlockTypeVoid(); protected final ITreeGenData tree; - protected int startX; - protected int startY; - protected int startZ; + private int startX; + private int startY; + private int startZ; protected TreeBlockTypeLeaf leaf; protected ITreeBlockType wood; - protected boolean spawnPods = false; - protected int minPodHeight = 3; + private boolean spawnPods = false; - public WorldGenArboriculture(ITreeGenData tree) { + protected WorldGenArboriculture(ITreeGenData tree) { this.tree = tree; } @Override - public boolean generate(World world, Random random, int x, int y, int z, boolean forced) { + public boolean generate(World world, int x, int y, int z, boolean forced) { this.spawnPods = tree.allowsFruitBlocks(); this.leaf = getLeaf(getOwner(world, x, y, z)); this.wood = getWood(); @@ -77,13 +75,13 @@ public abstract class WorldGenArboriculture extends WorldGenBase { this.startZ = startZ; } - public abstract void generate(World world); + protected abstract void generate(World world); public abstract boolean canGrow(World world, int x, int y, int z); - public abstract TreeBlockTypeLeaf getLeaf(GameProfile owner); + protected abstract TreeBlockTypeLeaf getLeaf(GameProfile owner); - public abstract ITreeBlockType getWood(); + protected abstract ITreeBlockType getWood(); protected void generateTreeTrunk(World world, int height, int girth) { generateTreeTrunk(world, height, girth, 0); diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenCrescentia.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenCrescentia.java index 26fc2ba04..fb7a4d28d 100644 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenCrescentia.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenCrescentia.java @@ -40,7 +40,7 @@ public class WorldGenCrescentia extends WorldGenTree { } @Override - public void generateTreeTrunk(World world, int height, int girth) { + protected void generateTreeTrunk(World world, int height, int girth) { int offset = (girth - 1) / 2; diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenGiganteum.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenGiganteum.java index 66a8cf42f..66481aea1 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenGiganteum.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenGiganteum.java @@ -10,8 +10,6 @@ ******************************************************************************/ package forestry.arboriculture.worldgen; -import net.minecraft.world.World; - import forestry.api.world.ITreeGenData; public class WorldGenGiganteum extends WorldGenSequoia { @@ -20,10 +18,4 @@ public class WorldGenGiganteum extends WorldGenSequoia { super(tree, 35, 15); } - @Override - public void generate(World world) { - super.generate(world); - //generateSupportStems(height, girth, 0.8f, 0.6f); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenTree.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenTree.java index 30a9429d3..1a67df6e8 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenTree.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenTree.java @@ -28,7 +28,7 @@ public abstract class WorldGenTree extends WorldGenArboriculture { protected int girth; protected int height; - public WorldGenTree(ITreeGenData tree, int baseHeight, int heightVariation) { + protected WorldGenTree(ITreeGenData tree, int baseHeight, int heightVariation) { super(tree); this.baseHeight = baseHeight; this.heightVariation = heightVariation; @@ -83,7 +83,7 @@ public abstract class WorldGenTree extends WorldGenArboriculture { return determined < min ? min : determined > max ? max : determined; } - protected int determineHeight(World world, int required, int variation) { + private int determineHeight(World world, int required, int variation) { ITreeModifier treeModifier = TreeManager.treeRoot.getTreekeepingMode(world); int baseHeight = required + world.rand.nextInt(variation); int height = Math.round(baseHeight * tree.getHeightModifier() * treeModifier.getHeightModifier(tree.getGenome(), 1f)); diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenTreeVanilla.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenTreeVanilla.java index 02f4da79d..f2ce98548 100644 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenTreeVanilla.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenTreeVanilla.java @@ -12,8 +12,8 @@ package forestry.arboriculture.worldgen; import forestry.api.world.ITreeGenData; -public class WorldGenTreeVanilla extends WorldGenTree { - public WorldGenTreeVanilla(ITreeGenData tree) { +public abstract class WorldGenTreeVanilla extends WorldGenTree { + protected WorldGenTreeVanilla(ITreeGenData tree) { super(tree, 5, 2); } } diff --git a/src/main/java/forestry/core/CreativeTabForestry.java b/src/main/java/forestry/core/CreativeTabForestry.java index f4fa97e85..58d396a4f 100755 --- a/src/main/java/forestry/core/CreativeTabForestry.java +++ b/src/main/java/forestry/core/CreativeTabForestry.java @@ -40,7 +40,7 @@ public class CreativeTabForestry extends CreativeTabs { private final int icon; - public CreativeTabForestry(int icon, String label) { + private CreativeTabForestry(int icon, String label) { super(label); this.icon = icon; } diff --git a/src/main/java/forestry/core/ForestryClient.java b/src/main/java/forestry/core/ForestryClient.java index edad54245..e8152d29b 100755 --- a/src/main/java/forestry/core/ForestryClient.java +++ b/src/main/java/forestry/core/ForestryClient.java @@ -20,7 +20,6 @@ public class ForestryClient extends ForestryCore { public static int byBlockModelId; public static int candleRenderId; - public static int blockModelIdEngine; @Override public void init(Object basemod) { @@ -29,7 +28,6 @@ public class ForestryClient extends ForestryCore { byBlockModelId = Proxies.render.getNextAvailableRenderId(); candleRenderId = Proxies.render.getNextAvailableRenderId(); - blockModelIdEngine = Proxies.render.getNextAvailableRenderId(); BlockRenderingHandler renderHandler = new BlockRenderingHandler(); RenderingRegistry.registerBlockHandler(byBlockModelId, renderHandler); diff --git a/src/main/java/forestry/core/ForestryCore.java b/src/main/java/forestry/core/ForestryCore.java index b3546bed2..26f09ced2 100755 --- a/src/main/java/forestry/core/ForestryCore.java +++ b/src/main/java/forestry/core/ForestryCore.java @@ -127,7 +127,4 @@ public class ForestryCore { PluginManager.processIMCMessages(messages); } - public String getPriorities() { - return "after:mod_IC2;after:mod_BuildCraftCore;after:mod_BuildCraftEnergy;after:mod_BuildCraftFactory;after:mod_BuildCraftSilicon;after:mod_BuildCraftTransport;after:mod_RedPowerWorld"; - } } diff --git a/src/main/java/forestry/core/GuiHandlerBase.java b/src/main/java/forestry/core/GuiHandlerBase.java index fceec1170..616e4d479 100755 --- a/src/main/java/forestry/core/GuiHandlerBase.java +++ b/src/main/java/forestry/core/GuiHandlerBase.java @@ -28,7 +28,7 @@ import forestry.core.utils.Utils; public abstract class GuiHandlerBase implements IGuiHandler { - public static T getTile(World world, int x, int y, int z, EntityPlayer player, Class tileClass) { + protected static T getTile(World world, int x, int y, int z, EntityPlayer player, Class tileClass) { T tileForestry = Utils.getTile(world, x, y, z, tileClass); if (tileForestry instanceof IStreamableGui && !world.isRemote) { @@ -39,27 +39,27 @@ public abstract class GuiHandlerBase implements IGuiHandler { return tileForestry; } - public GuiNaturalistInventory getNaturalistChestGui(String rootUID, EntityPlayer player, World world, int x, int y, int z, int page) { + protected GuiNaturalistInventory getNaturalistChestGui(String rootUID, EntityPlayer player, World world, int x, int y, int z, int page) { TileNaturalistChest tile = getTile(world, x, y, z, player, TileNaturalistChest.class); ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(rootUID); - return new GuiNaturalistInventory(speciesRoot, player, new ContainerNaturalistInventory(player.inventory, tile, page, 25), tile, page, 5); + return new GuiNaturalistInventory(speciesRoot, player, new ContainerNaturalistInventory(player.inventory, tile, page), tile, page, 5); } - public ContainerNaturalistInventory getNaturalistChestContainer(String rootUID, EntityPlayer player, World world, int x, int y, int z, int page) { + protected ContainerNaturalistInventory getNaturalistChestContainer(String rootUID, EntityPlayer player, World world, int x, int y, int z, int page) { ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(rootUID); speciesRoot.getBreedingTracker(world, player.getGameProfile()).synchToPlayer(player); - return new ContainerNaturalistInventory(player.inventory, getTile(world, x, y, z, player, TileNaturalistChest.class), page, 25); + return new ContainerNaturalistInventory(player.inventory, getTile(world, x, y, z, player, TileNaturalistChest.class), page); } public static int encodeGuiData(int guiId, int data) { return data << 8 | guiId; } - public static int decodeGuiID(int guiId) { + protected static int decodeGuiID(int guiId) { return guiId & 0xFF; } - public static int decodeGuiData(int guiId) { + protected static int decodeGuiData(int guiId) { return guiId >> 8; } } diff --git a/src/main/java/forestry/core/circuits/Circuit.java b/src/main/java/forestry/core/circuits/Circuit.java index 1433eeb6f..44ce176c1 100755 --- a/src/main/java/forestry/core/circuits/Circuit.java +++ b/src/main/java/forestry/core/circuits/Circuit.java @@ -22,7 +22,7 @@ public abstract class Circuit implements ICircuit { private final boolean requiresDiscovery; private int limit = 1; - public Circuit(String uid, boolean requiresDiscovery) { + protected Circuit(String uid, boolean requiresDiscovery) { this.uid = uid; this.requiresDiscovery = requiresDiscovery; diff --git a/src/main/java/forestry/core/circuits/CircuitRegistry.java b/src/main/java/forestry/core/circuits/CircuitRegistry.java index bcbaef072..75858360a 100755 --- a/src/main/java/forestry/core/circuits/CircuitRegistry.java +++ b/src/main/java/forestry/core/circuits/CircuitRegistry.java @@ -27,7 +27,7 @@ import forestry.core.config.ForestryItem; public class CircuitRegistry implements ICircuitRegistry { public static final ICircuitLayout DUMMY_LAYOUT = new CircuitLayout("dummy"); - public static final Map DUMMY_MAP = new LinkedHashMap(); + private static final Map DUMMY_MAP = new LinkedHashMap(); private final Map layoutMap = new LinkedHashMap(); private final Map circuitMap = new LinkedHashMap(); diff --git a/src/main/java/forestry/core/circuits/ContainerSolderingIron.java b/src/main/java/forestry/core/circuits/ContainerSolderingIron.java index c150efde5..4a415da2d 100755 --- a/src/main/java/forestry/core/circuits/ContainerSolderingIron.java +++ b/src/main/java/forestry/core/circuits/ContainerSolderingIron.java @@ -72,7 +72,7 @@ public class ContainerSolderingIron extends ContainerItemInventory 0) { + pluginList.append(", "); } - pluginList += makeListEntry(pluginModule.instance()); + pluginList.append(makeListEntry(pluginModule.instance())); } - CommandHelpers.sendChatMessage(sender, pluginList); + CommandHelpers.sendChatMessage(sender, pluginList.toString()); } - private String makeListEntry(ForestryPlugin plugin) { + private static String makeListEntry(ForestryPlugin plugin) { String entry = plugin.isAvailable() ? EnumChatFormatting.GREEN.toString() : EnumChatFormatting.RED.toString(); Plugin info = plugin.getClass().getAnnotation(Plugin.class); @@ -83,7 +83,7 @@ public class CommandPlugins extends SubCommand { } } - private void listPluginInfoForSender(ICommandSender sender, String plugin) { + private static void listPluginInfoForSender(ICommandSender sender, String plugin) { ForestryPlugin found = null; for (PluginManager.Module pluginModule : PluginManager.getLoadedModules()) { Plugin info = pluginModule.instance().getClass().getAnnotation(Plugin.class); diff --git a/src/main/java/forestry/core/commands/CommandSaveStats.java b/src/main/java/forestry/core/commands/CommandSaveStats.java index dfbcef60b..6a633b53a 100644 --- a/src/main/java/forestry/core/commands/CommandSaveStats.java +++ b/src/main/java/forestry/core/commands/CommandSaveStats.java @@ -156,13 +156,13 @@ public final class CommandSaveStats extends SubCommand { CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.stats.save.saved", player.getDisplayName()); } - private String generateSpeciesListHeader() { + private static String generateSpeciesListHeader() { String authority = StatCollector.translateToLocal("for.gui.alyzer.authority"); String species = StatCollector.translateToLocal("for.gui.species"); return speciesListEntry(discoveredSymbol, blacklistedSymbol, notCountedSymbol, "UID", species, authority); } - private String generateSpeciesListEntry(IAlleleSpecies species, IBreedingTracker tracker) { + private static String generateSpeciesListEntry(IAlleleSpecies species, IBreedingTracker tracker) { String discovered = ""; if (tracker.isDiscovered(species)) { discovered = discoveredSymbol; @@ -181,7 +181,7 @@ public final class CommandSaveStats extends SubCommand { return speciesListEntry(discovered, blacklisted, notCounted, species.getUID(), species.getName(), species.getAuthority()); } - private String speciesListEntry(String discovered, String blacklisted, String notCounted, String UID, String speciesName, String authority) { + private static String speciesListEntry(String discovered, String blacklisted, String notCounted, String UID, String speciesName, String authority) { return String.format("[ %-2s ] [ %-2s ] [ %-2s ]\t%-40s %-20s %-20s", discovered, blacklisted, notCounted, UID, speciesName, authority); } } diff --git a/src/main/java/forestry/core/commands/SubCommand.java b/src/main/java/forestry/core/commands/SubCommand.java index 75b7e662d..580be686a 100644 --- a/src/main/java/forestry/core/commands/SubCommand.java +++ b/src/main/java/forestry/core/commands/SubCommand.java @@ -10,6 +10,7 @@ ******************************************************************************/ package forestry.core.commands; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -136,7 +137,7 @@ public abstract class SubCommand implements IForestryCommand { } @Override - public int compareTo(Object command) { + public int compareTo(@Nonnull Object command) { return this.compareTo((ICommand) command); } diff --git a/src/main/java/forestry/core/config/Config.java b/src/main/java/forestry/core/config/Config.java index 08ee283b1..413cb35f2 100755 --- a/src/main/java/forestry/core/config/Config.java +++ b/src/main/java/forestry/core/config/Config.java @@ -79,8 +79,6 @@ public class Config { public static boolean enableBackpackResupply = true; // Customization - public static boolean tooltipLiquidAmount = true; - private static boolean craftingBronzeEnabled = true; public static boolean craftingStampsEnabled = true; @@ -88,8 +86,8 @@ public class Config { public static int farmSize = 2; public static boolean squareFarms = false; - public static boolean enableExUtilEnderLily = true; - public static boolean enableMagicalCropsSupport = true; + private static boolean enableExUtilEnderLily = true; + private static boolean enableMagicalCropsSupport = true; // Mail public static boolean mailAlertEnabled = true; @@ -258,8 +256,6 @@ public class Config { enableHints = configCommon.getBooleanLocalized("tweaks.gui.tabs", "hints", enableHints); enableEnergyStat = configCommon.getBooleanLocalized("tweaks.gui.tabs", "energy", enableEnergyStat); - tooltipLiquidAmount = configCommon.getBooleanLocalized("tweaks.gui.tooltip", "liquidamount", tooltipLiquidAmount); - enablePermissions = configCommon.getBooleanLocalized("tweaks", "permissions", enablePermissions); farmSize = configCommon.getIntLocalized("tweaks.farms", "size", farmSize, 1, 3); @@ -388,9 +384,6 @@ public class Config { property = configOld.get("tweaks.energystat.disabled", CATEGORY_COMMON, true); property.comment = "set to true to disable energy statistics on energy consumers."; Config.enableEnergyStat = !Boolean.parseBoolean(property.value); - property = configOld.get("tweaks.tooltip.liquidamount.disabled", CATEGORY_COMMON, false); - property.comment = "set to true to disable displaying liquid amounts in tank tooltips."; - Config.tooltipLiquidAmount = !Boolean.parseBoolean(property.value); property = configOld.get("tweaks.permissions.disabled", CATEGORY_COMMON, false); property.comment = "set to true to disable access restrictions on forestry machines."; diff --git a/src/main/java/forestry/core/config/Defaults.java b/src/main/java/forestry/core/config/Defaults.java index 27dfe7f49..f85c1ad8b 100755 --- a/src/main/java/forestry/core/config/Defaults.java +++ b/src/main/java/forestry/core/config/Defaults.java @@ -31,17 +31,6 @@ public class Defaults { public static final int FLUID_PER_HONEY_DROP = 100; public static final int[] FACINGS = {0, 1, 2, 3, 4, 5}; - public static final int FACING_UP = 1; - public static final int FACING_DOWN = 0; - public static final int FACING_NORTH = 2; - public static final int FACING_SOUTH = 3; - public static final int FACING_WEST = 4; - public static final int FACING_EAST = 5; - public static final int[] FACING_SIDES = {FACING_NORTH, FACING_SOUTH, FACING_WEST, FACING_EAST}; - public static final int[] FACING_NORTHSOUTH = {FACING_NORTH, FACING_SOUTH}; - public static final int[] FACING_WESTEAST = {FACING_WEST, FACING_EAST}; - public static final int[] FACINGS_NONE = new int[0]; - public static final int[] SLOTS_NONE = new int[0]; // Textures diff --git a/src/main/java/forestry/core/config/ForestryBlock.java b/src/main/java/forestry/core/config/ForestryBlock.java index d5b7bcd8a..e27c49a45 100755 --- a/src/main/java/forestry/core/config/ForestryBlock.java +++ b/src/main/java/forestry/core/config/ForestryBlock.java @@ -127,7 +127,7 @@ public enum ForestryBlock { return new ItemStack(block, qty, meta); } - public boolean setBlock(World world, int x, int y, int z, int meta, int flag) { - return world.setBlock(x, y, z, block, meta, flag); + public boolean setBlock(World world, int x, int y, int z, int meta) { + return world.setBlock(x, y, z, block, meta, Defaults.FLAG_BLOCK_SYNCH); } } diff --git a/src/main/java/forestry/core/config/Version.java b/src/main/java/forestry/core/config/Version.java index d4c288ac6..6722b9bf4 100755 --- a/src/main/java/forestry/core/config/Version.java +++ b/src/main/java/forestry/core/config/Version.java @@ -97,7 +97,7 @@ public class Version { BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); - String line = null; + String line; String mcVersion = Proxies.common.getMinecraftVersion(); while ((line = reader.readLine()) != null) { if (line.startsWith(mcVersion) && line.contains(Defaults.MOD)) { @@ -142,7 +142,7 @@ public class Version { try { String location = REMOTE_CHANGELOG_ROOT + version; - HttpURLConnection conn = null; + HttpURLConnection conn; do { URL url = new URL(location); conn = (HttpURLConnection) url.openConnection(); @@ -154,7 +154,7 @@ public class Version { BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); - String line = null; + String line; ArrayList changelog = new ArrayList(); while ((line = reader.readLine()) != null) { if (line.startsWith("#")) { diff --git a/src/main/java/forestry/core/fluids/BlockForestryFluid.java b/src/main/java/forestry/core/fluids/BlockForestryFluid.java index 581de9fd6..3293cddb8 100644 --- a/src/main/java/forestry/core/fluids/BlockForestryFluid.java +++ b/src/main/java/forestry/core/fluids/BlockForestryFluid.java @@ -104,7 +104,7 @@ public class BlockForestryFluid extends BlockFluidClassic { } @SideOnly(Side.CLIENT) - public boolean flowTextureExists() { + private boolean flowTextureExists() { try { ResourceLocation resourceLocation = new ResourceLocation(Defaults.ID, "textures/blocks/liquid/" + fluidName + "_flow.png"); IResourceManager resourceManager = Minecraft.getMinecraft().getResourceManager(); @@ -153,8 +153,8 @@ public class BlockForestryFluid extends BlockFluidClassic { return flammability; } - public boolean isFlammable(IBlockAccess world, int x, int y, int z) { - return flammable; + private static boolean isFlammable(IBlockAccess world, int x, int y, int z) { + return world.getBlock(x, y, z).isFlammable(world, x, y, z, ForgeDirection.UNKNOWN); } @Override @@ -214,7 +214,7 @@ public class BlockForestryFluid extends BlockFluidClassic { x = startX + rand.nextInt(3) - 1; z = startZ + rand.nextInt(3) - 1; - if (world.isAirBlock(x, y + 1, z) && this.isFlammable(world, x, y, z)) { + if (world.isAirBlock(x, y + 1, z) && isFlammable(world, x, y, z)) { world.setBlock(x, y + 1, z, Blocks.fire); } } @@ -233,7 +233,7 @@ public class BlockForestryFluid extends BlockFluidClassic { } } - private boolean isNeighborFlammable(World world, int x, int y, int z) { + private static boolean isNeighborFlammable(World world, int x, int y, int z) { return isFlammable(world, x - 1, y, z) || isFlammable(world, x + 1, y, z) || isFlammable(world, x, y, z - 1) || @@ -242,7 +242,7 @@ public class BlockForestryFluid extends BlockFluidClassic { isFlammable(world, x, y + 1, z); } - private boolean isNearFire(World world, int x, int y, int z) { + private static boolean isNearFire(World world, int x, int y, int z) { AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1); return world.func_147470_e(boundingBox); } diff --git a/src/main/java/forestry/core/fluids/FluidHelper.java b/src/main/java/forestry/core/fluids/FluidHelper.java index ae6434541..186c0e8e2 100644 --- a/src/main/java/forestry/core/fluids/FluidHelper.java +++ b/src/main/java/forestry/core/fluids/FluidHelper.java @@ -10,26 +10,19 @@ ******************************************************************************/ package forestry.core.fluids; -import net.minecraft.block.Block; -import net.minecraft.block.BlockLiquid; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData; -import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.IFluidContainerItem; import net.minecraftforge.fluids.IFluidHandler; -import forestry.core.fluids.tanks.StandardTank; import forestry.core.inventory.InvTools; import forestry.core.utils.StackUtils; @@ -38,10 +31,6 @@ import forestry.core.utils.StackUtils; */ public final class FluidHelper { - public static final int BUCKET_FILL_TIME = 8; - public static final int NETWORK_UPDATE_INTERVAL = 128; - public static final int BUCKET_VOLUME = 1000; - private FluidHelper() { } @@ -103,36 +92,6 @@ public final class FluidHelper { return false; } - public static void processContainers(StandardTank tank, IInventory inv, int inputSlot, int outputSlot) { - processContainers(tank, inv, inputSlot, outputSlot, tank.getFluidType(), true, true); - } - - public static void processContainers(StandardTank tank, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill, boolean processFilled, boolean processEmpty) { - TankManager tankManger = new TankManager(); - tankManger.add(tank); - processContainers(tankManger, inv, inputSlot, outputSlot, fluidToFill, processFilled, processEmpty); - } - - public static void processContainers(TankManager tank, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill) { - processContainers(tank, inv, inputSlot, outputSlot, fluidToFill, true, true); - } - - public static void processContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill, boolean processFilled, boolean processEmpty) { - ItemStack input = inv.getStackInSlot(inputSlot); - - if (input == null) { - return; - } - - if (processFilled && drainContainers(fluidHandler, inv, inputSlot, outputSlot)) { - return; - } - - if (processEmpty && fluidToFill != null) { - fillContainers(fluidHandler, inv, inputSlot, outputSlot, fluidToFill); - } - } - public static boolean fillContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill) { return fillContainers(fluidHandler, inv, inputSlot, outputSlot, fluidToFill, true); } @@ -214,28 +173,6 @@ public final class FluidHelper { return true; } - public static boolean isContainer(ItemStack stack) { - if (stack != null && stack.getItem() instanceof IFluidContainerItem) { - return true; - } - return FluidContainerRegistry.isContainer(stack); - } - - public static boolean isFilledContainer(ItemStack stack) { - if (FluidContainerRegistry.isFilledContainer(stack)) { - return true; - } - - Item item = stack.getItem(); - if (item instanceof IFluidContainerItem) { - IFluidContainerItem containerItem = (IFluidContainerItem) item; - FluidStack fluidStack = containerItem.getFluid(stack); - return fluidStack != null && fluidStack.amount > 0; - } - - return false; - } - public static boolean isFillableContainer(ItemStack stack, FluidStack liquid) { ItemStack empty = StackUtils.createSplitStack(stack, 1); Item item = empty.getItem(); @@ -356,57 +293,4 @@ public final class FluidHelper { return containsFluidStack(stack, new FluidStack(fluid, 1)); } - public static FluidStack drainBlock(World world, int x, int y, int z, boolean doDrain) { - return drainBlock(world.getBlock(x, y, z), world, x, y, z, doDrain); - } - - public static FluidStack drainBlock(Block block, World world, int x, int y, int z, boolean doDrain) { - if (block instanceof IFluidBlock) { - IFluidBlock fluidBlock = (IFluidBlock) block; - if (fluidBlock.canDrain(world, x, y, z)) { - return fluidBlock.drain(world, x, y, z, doDrain); - } - } else if (block == Blocks.water || block == Blocks.flowing_water) { - int meta = world.getBlockMetadata(x, y, z); - if (meta != 0) { - return null; - } - if (doDrain) { - world.setBlockToAir(x, y, z); - } - return new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME); - } else if (block == Blocks.lava || block == Blocks.flowing_lava) { - int meta = world.getBlockMetadata(x, y, z); - if (meta != 0) { - return null; - } - if (doDrain) { - world.setBlockToAir(x, y, z); - } - return new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME); - } - return null; - } - - public static boolean isFullFluidBlock(World world, int x, int y, int z) { - return isFullFluidBlock(world.getBlock(x, y, z), world, x, y, z); - } - - public static boolean isFullFluidBlock(Block block, World world, int x, int y, int z) { - if (block instanceof BlockLiquid || block instanceof IFluidBlock) { - return world.getBlockMetadata(x, y, z) == 0; - } - return false; - } - - public static Fluid getFluid(Block block) { - if (block instanceof IFluidBlock) { - return ((IFluidBlock) block).getFluid(); - } else if (block == Blocks.water || block == Blocks.flowing_water) { - return FluidRegistry.WATER; - } else if (block == Blocks.lava || block == Blocks.flowing_lava) { - return FluidRegistry.LAVA; - } - return null; - } } diff --git a/src/main/java/forestry/core/fluids/TankManager.java b/src/main/java/forestry/core/fluids/TankManager.java index 7aa2457ae..2d480d459 100644 --- a/src/main/java/forestry/core/fluids/TankManager.java +++ b/src/main/java/forestry/core/fluids/TankManager.java @@ -12,6 +12,7 @@ package forestry.core.fluids; import com.google.common.collect.ForwardingList; +import javax.annotation.Nonnull; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; @@ -73,12 +74,12 @@ public class TankManager extends ForwardingList implements ITankMa } @Override - public final boolean addAll(Collection collection) { + public final boolean addAll(@Nonnull Collection collection) { return standardAddAll(collection); } @Override - public boolean add(StandardTank tank) { + public boolean add(@Nonnull StandardTank tank) { boolean added = tanks.add(tank); int index = tanks.indexOf(tank); tank.setTankIndex(index); @@ -392,7 +393,7 @@ public class TankManager extends ForwardingList implements ITankMa return false; } - private boolean tankAcceptsFluid(StandardTank tank, FluidStack fluidStack) { + private static boolean tankAcceptsFluid(StandardTank tank, FluidStack fluidStack) { if (fluidStack == null) { return false; } @@ -402,7 +403,7 @@ public class TankManager extends ForwardingList implements ITankMa return tank.fill(fluidStack, false) > 0; } - private boolean tankCanDrain(StandardTank tank) { + private static boolean tankCanDrain(StandardTank tank) { if (!tank.canBeDrainedExternally()) { return false; } @@ -410,7 +411,7 @@ public class TankManager extends ForwardingList implements ITankMa return drained != null && drained.amount > 0; } - private boolean tankCanDrainFluid(StandardTank tank, FluidStack fluidStack) { + private static boolean tankCanDrainFluid(StandardTank tank, FluidStack fluidStack) { if (fluidStack == null) { return false; } diff --git a/src/main/java/forestry/core/fluids/tanks/FilteredTank.java b/src/main/java/forestry/core/fluids/tanks/FilteredTank.java index c74b2242f..9b377660e 100644 --- a/src/main/java/forestry/core/fluids/tanks/FilteredTank.java +++ b/src/main/java/forestry/core/fluids/tanks/FilteredTank.java @@ -65,7 +65,7 @@ public class FilteredTank extends StandardTank { return filters.contains(fluid); } - public boolean liquidMatchesFilter(FluidStack resource) { + private boolean liquidMatchesFilter(FluidStack resource) { if (resource == null || filters == null) { return false; } diff --git a/src/main/java/forestry/core/fluids/tanks/StandardTank.java b/src/main/java/forestry/core/fluids/tanks/StandardTank.java index 3e7b26bd5..a624ff62a 100644 --- a/src/main/java/forestry/core/fluids/tanks/StandardTank.java +++ b/src/main/java/forestry/core/fluids/tanks/StandardTank.java @@ -33,7 +33,7 @@ public class StandardTank extends FluidTank { } public TankMode tankMode = TankMode.DEFAULT; - public static final int DEFAULT_COLOR = 0xFFFFFF; + private static final int DEFAULT_COLOR = 0xFFFFFF; public int colorCache = DEFAULT_COLOR; private int tankIndex; diff --git a/src/main/java/forestry/core/gadgets/BlockBase.java b/src/main/java/forestry/core/gadgets/BlockBase.java index 6d2e90712..350ce9f78 100755 --- a/src/main/java/forestry/core/gadgets/BlockBase.java +++ b/src/main/java/forestry/core/gadgets/BlockBase.java @@ -61,11 +61,11 @@ public class BlockBase extends BlockForestry { public MachineDefinition addDefinition(MachineDefinition definition) { definition.setBlock(this); - while (definitions.size() <= definition.meta) { + while (definitions.size() <= definition.getMeta()) { definitions.add(null); } - definitions.set(definition.meta, definition); + definitions.set(definition.getMeta(), definition); return definition; } @@ -133,16 +133,6 @@ public class BlockBase extends BlockForestry { return createTileEntity(world, meta); // TODO: refactor to just use Block, not BlockContainer } - /* BLOCK DROPS */ - @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { - if (getDefinition(metadata).handlesDrops()) { - return getDefinition(metadata).getDrops(world, x, y, z, metadata, fortune); - } else { - return super.getDrops(world, x, y, z, metadata, fortune); - } - } - /* INTERACTION */ @Override public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) { @@ -151,8 +141,8 @@ public class BlockBase extends BlockForestry { } @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack) { - super.onBlockPlacedBy(world, x, y, z, entityliving, stack); + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack) { + super.onBlockPlacedBy(world, x, y, z, entityLiving, stack); TileForestry tile = (TileForestry) world.getTileEntity(x, y, z); @@ -163,12 +153,12 @@ public class BlockBase extends BlockForestry { tile.zCoord = z; } - tile.rotateAfterPlacement(world, x, y, z, entityliving, stack); + tile.rotateAfterPlacement(entityLiving); } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) { - if (getDefinition(world, x, y, z).onBlockActivated(world, x, y, z, player, side, par7, par8, par9)) { + if (getDefinition(world, x, y, z).onBlockActivated(world, x, y, z, player, side)) { return true; } @@ -195,7 +185,7 @@ public class BlockBase extends BlockForestry { } if (access.allowsViewing(player)) { - tile.openGui(player, tile); + tile.openGui(player); } else { player.addChatMessage(new ChatComponentTranslation("for.chat.accesslocked", PlayerUtil.getOwnerName(access))); } @@ -207,12 +197,6 @@ public class BlockBase extends BlockForestry { return getDefinition(world, x, y, z).rotateBlock(world, x, y, z, axis); } - @Override - public void onBlockAdded(World world, int x, int y, int z) { - super.onBlockAdded(world, x, y, z); - getDefinition(world, x, y, z).onBlockAdded(world, x, y, z); - } - @Override public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) { @@ -227,11 +211,7 @@ public class BlockBase extends BlockForestry { return false; } - if (getDefinition(world, x, y, z).removedByPlayer(world, player, x, y, z)) { - return world.setBlockToAir(x, y, z); - } else { - return false; - } + return world.setBlockToAir(x, y, z); } @Override @@ -252,15 +232,6 @@ public class BlockBase extends BlockForestry { super.breakBlock(world, x, y, z, block, meta); } - @Override - public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) { - int metadata = world.getBlockMetadata(x, y, z); - if (metadata >= definitions.size() || definitions.get(metadata) == null) { - metadata = 0; - } - return definitions.get(metadata).canConnectRedstone(world, x, y, z, side); - } - @Override public int damageDropped(int metadata) { return metadata; @@ -284,7 +255,7 @@ public class BlockBase extends BlockForestry { if (metadata >= definitions.size() || definitions.get(metadata) == null) { return null; } - return definitions.get(metadata).getBlockTextureFromSideAndMetadata(side, metadata); + return definitions.get(metadata).getBlockTextureForSide(side); } @SideOnly(Side.CLIENT) @@ -294,7 +265,7 @@ public class BlockBase extends BlockForestry { if (metadata >= definitions.size() || definitions.get(metadata) == null) { metadata = 0; } - return definitions.get(metadata).getIcon(world, x, y, z, side, metadata); + return definitions.get(metadata).getIcon(world, x, y, z, side); } @Override diff --git a/src/main/java/forestry/core/gadgets/BlockForestry.java b/src/main/java/forestry/core/gadgets/BlockForestry.java index aecff9e20..40f799306 100755 --- a/src/main/java/forestry/core/gadgets/BlockForestry.java +++ b/src/main/java/forestry/core/gadgets/BlockForestry.java @@ -30,7 +30,7 @@ import forestry.core.proxy.Proxies; public abstract class BlockForestry extends BlockContainer { - public BlockForestry(Material material) { + protected BlockForestry(Material material) { super(material); setHardness(1.5f); setCreativeTab(CreativeTabForestry.tabForestry); @@ -51,13 +51,13 @@ public abstract class BlockForestry extends BlockContainer { } @Override - public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack itemstack) { + public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack itemstack) { if (!Proxies.common.isSimulating(world)) { return; } - if (entityliving instanceof EntityPlayer) { + if (entityLiving instanceof EntityPlayer) { TileEntity tile = world.getTileEntity(i, j, k); IOwnable ownable; @@ -70,7 +70,7 @@ public abstract class BlockForestry extends BlockContainer { return; } - EntityPlayer player = (EntityPlayer) entityliving; + EntityPlayer player = (EntityPlayer) entityLiving; GameProfile gameProfile = player.getGameProfile(); ownable.setOwner(gameProfile); } diff --git a/src/main/java/forestry/core/gadgets/BlockResource.java b/src/main/java/forestry/core/gadgets/BlockResource.java index 13f17562a..7ab831e78 100755 --- a/src/main/java/forestry/core/gadgets/BlockResource.java +++ b/src/main/java/forestry/core/gadgets/BlockResource.java @@ -52,12 +52,12 @@ public class BlockResource extends Block { ArrayList drops = new ArrayList(); if (metadata == 0) { - int fortmod = world.rand.nextInt(fortune + 2) - 1; - if (fortmod < 0) { - fortmod = 0; + int fortuneModifier = world.rand.nextInt(fortune + 2) - 1; + if (fortuneModifier < 0) { + fortuneModifier = 0; } - int amount = (2 + world.rand.nextInt(5)) * (fortmod + 1); + int amount = (2 + world.rand.nextInt(5)) * (fortuneModifier + 1); if (amount > 0) { drops.add(ForestryItem.apatite.getItemStack(amount)); } diff --git a/src/main/java/forestry/core/gadgets/BlockSoil.java b/src/main/java/forestry/core/gadgets/BlockSoil.java index f6af51807..f3053bcf4 100755 --- a/src/main/java/forestry/core/gadgets/BlockSoil.java +++ b/src/main/java/forestry/core/gadgets/BlockSoil.java @@ -98,25 +98,25 @@ public class BlockSoil extends Block implements IItemTyped { SoilType type = getTypeFromMeta(meta); if (type == SoilType.HUMUS) { - updateTickHumus(world, i, j, k, random); + updateTickHumus(world, i, j, k); } else if (type == SoilType.BOG_EARTH) { - updateTickBogEarth(world, i, j, k, random); + updateTickBogEarth(world, i, j, k); } } - private void updateTickHumus(World world, int i, int j, int k, Random random) { + private static void updateTickHumus(World world, int i, int j, int k) { if (isEnrooted(world, i, j, k)) { degradeSoil(world, i, j, k); } } - private void updateTickBogEarth(World world, int i, int j, int k, Random random) { + private static void updateTickBogEarth(World world, int i, int j, int k) { if (isMoistened(world, i, j, k)) { matureBog(world, i, j, k); } } - private boolean isEnrooted(World world, int x, int y, int z) { + private static boolean isEnrooted(World world, int x, int y, int z) { for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { @@ -136,7 +136,7 @@ public class BlockSoil extends Block implements IItemTyped { /** * If a tree or sapling is in the vicinity, there is a chance, that the soil will degrade. */ - private void degradeSoil(World world, int x, int y, int z) { + private static void degradeSoil(World world, int x, int y, int z) { if (world.rand.nextInt(140) != 0) { return; @@ -162,7 +162,7 @@ public class BlockSoil extends Block implements IItemTyped { world.markBlockForUpdate(x, y, z); } - public static boolean isMoistened(World world, int x, int y, int z) { + private static boolean isMoistened(World world, int x, int y, int z) { for (int i = -2; i < 3; i++) { for (int j = -2; j < 3; j++) { @@ -176,7 +176,7 @@ public class BlockSoil extends Block implements IItemTyped { return false; } - private void matureBog(World world, int i, int j, int k) { + private static void matureBog(World world, int i, int j, int k) { if (world.rand.nextInt(13) != 0) { return; diff --git a/src/main/java/forestry/core/gadgets/BlockStructure.java b/src/main/java/forestry/core/gadgets/BlockStructure.java index def0b9671..8d75f9700 100755 --- a/src/main/java/forestry/core/gadgets/BlockStructure.java +++ b/src/main/java/forestry/core/gadgets/BlockStructure.java @@ -25,7 +25,7 @@ import forestry.core.utils.Utils; public abstract class BlockStructure extends BlockForestry { - public BlockStructure(Material material) { + protected BlockStructure(Material material) { super(material); setHardness(1.0f); } diff --git a/src/main/java/forestry/core/gadgets/Engine.java b/src/main/java/forestry/core/gadgets/Engine.java index 963858837..7f3144fec 100755 --- a/src/main/java/forestry/core/gadgets/Engine.java +++ b/src/main/java/forestry/core/gadgets/Engine.java @@ -15,10 +15,8 @@ import java.io.IOException; import net.minecraft.entity.EntityLivingBase; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; -import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -38,29 +36,28 @@ import cofh.api.energy.IEnergyConnection; public abstract class Engine extends TileBase implements IEnergyConnection, IActivatable { - public boolean active = false; // Used for smp. + private boolean active = false; // Used for smp. /** * Indicates whether the piston is receding from or approaching the * combustion chamber */ - public int stagePiston = 0; + private int stagePiston = 0; /** * Piston speed as supplied by the server */ - public float pistonSpeedServer = 0; + private float pistonSpeedServer = 0; + protected int currentOutput = 0; - public final int maxEnergy; - public final int maxEnergyExtracted; - public int heat; + protected final int maxEnergy; + protected int heat; protected final int maxHeat; protected boolean forceCooldown = false; public float progress; protected final EnergyManager energyManager; - public Engine(int maxHeat, int maxEnergy, int maxEnergyExtracted) { + protected Engine(int maxHeat, int maxEnergy) { this.maxHeat = maxHeat; this.maxEnergy = maxEnergy; - this.maxEnergyExtracted = maxEnergyExtracted; energyManager = new EnergyManager(2000, 100, 1000000); // allow engines to chain, but not have energy sucked out of them @@ -68,7 +65,7 @@ public abstract class Engine extends TileBase implements IEnergyConnection, IAct } @Override - public void rotateAfterPlacement(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack) { + public void rotateAfterPlacement(EntityLivingBase entityLiving) { rotateEngine(); } @@ -80,15 +77,15 @@ public abstract class Engine extends TileBase implements IEnergyConnection, IAct } } - public abstract int dissipateHeat(); + protected abstract int dissipateHeat(); - public abstract int generateHeat(); + protected abstract int generateHeat(); - public boolean mayBurn() { + protected boolean mayBurn() { return !forceCooldown; } - public abstract void burn(); + protected abstract void burn(); @Override public void updateClientSide() { @@ -105,7 +102,7 @@ public abstract class Engine extends TileBase implements IEnergyConnection, IAct } @Override - public void updateServerSide() { + protected void updateServerSide() { TemperatureState energyState = getTemperatureState(); if (energyState == TemperatureState.MELTING && heat > 0) { forceCooldown = true; @@ -201,7 +198,7 @@ public abstract class Engine extends TileBase implements IEnergyConnection, IAct return (double) heat / (double) maxHeat; } - public abstract boolean isBurning(); + protected abstract boolean isBurning(); public int getBurnTimeRemainingScaled(int i) { return 0; @@ -230,7 +227,7 @@ public abstract class Engine extends TileBase implements IEnergyConnection, IAct return TemperatureState.getState(heat, maxHeat); } - public float getPistonSpeed() { + protected float getPistonSpeed() { switch (getTemperatureState()) { case COOL: return 0.03f; diff --git a/src/main/java/forestry/core/gadgets/MachineDefinition.java b/src/main/java/forestry/core/gadgets/MachineDefinition.java index 906d90b93..26a0b18f9 100755 --- a/src/main/java/forestry/core/gadgets/MachineDefinition.java +++ b/src/main/java/forestry/core/gadgets/MachineDefinition.java @@ -10,7 +10,6 @@ ******************************************************************************/ package forestry.core.gadgets; -import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -36,14 +35,15 @@ import cpw.mods.fml.relauncher.SideOnly; import forestry.core.interfaces.IBlockRenderer; import forestry.core.proxy.Proxies; import forestry.core.render.TextureManager; +import forestry.core.render.TileRendererIndex; public class MachineDefinition { public final Class teClass; - public final String teIdent; - public Block block; - public final int meta; + private final String teIdent; + private Block block; + private final int meta; public final IBlockRenderer renderer; @@ -69,6 +69,14 @@ public class MachineDefinition { } + public Block getBlock() { + return block; + } + + public int getMeta() { + return meta; + } + public void setBlock(Block block) { this.block = block; } @@ -110,32 +118,12 @@ public class MachineDefinition { list.add(new ItemStack(item, 1, meta)); } - /* BLOCK DROPS */ - public boolean handlesDrops() { - return false; - } - - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { - return new ArrayList(); - } - /* INTERACTION */ public boolean isSolidOnSide(IBlockAccess world, int x, int y, int z, int side) { return true; } - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fXplayerClick, float fY, float fZ) { - return false; - } - - public void onBlockAdded(World world, int x, int y, int z) { - } - - public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) { - return true; - } - - public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side) { return false; } @@ -172,7 +160,7 @@ public class MachineDefinition { } @SideOnly(Side.CLIENT) - public IIcon getBlockTextureFromSideAndMetadata(int side, int metadata) { + public IIcon getBlockTextureForSide(int side) { return icons[side]; } @@ -180,11 +168,11 @@ public class MachineDefinition { * 0 - Bottom 1 - Top 2 - Back 3 - Front 4,5 - Sides, 7 - Reversed ?, 8 - Reversed ? */ @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side, int metadata) { + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { TileEntity tile = world.getTileEntity(x, y, z); if (!(tile instanceof TileForestry)) { - return getBlockTextureFromSideAndMetadata(side, metadata); + return getBlockTextureForSide(side); } ForgeDirection dir = ((TileForestry) tile).getOrientation(); @@ -203,6 +191,6 @@ public class MachineDefinition { default: } - return getBlockTextureFromSideAndMetadata(side, metadata); + return getBlockTextureForSide(side); } } diff --git a/src/main/java/forestry/core/gadgets/MachineNBTDefinition.java b/src/main/java/forestry/core/gadgets/MachineNBTDefinition.java deleted file mode 100755 index 1a6cead93..000000000 --- a/src/main/java/forestry/core/gadgets/MachineNBTDefinition.java +++ /dev/null @@ -1,59 +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.gadgets; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import forestry.core.interfaces.IBlockRenderer; -import forestry.core.proxy.Proxies; -import forestry.core.utils.StackUtils; -import forestry.core.utils.Utils; - -public class MachineNBTDefinition extends MachineDefinition { - - public MachineNBTDefinition(int meta, String teIdent, Class teClass, IRecipe... recipes) { - super(meta, teIdent, teClass, recipes); - } - - public MachineNBTDefinition(int meta, String teIdent, Class teClass, IBlockRenderer renderer, IRecipe... recipes) { - super(meta, teIdent, teClass, renderer, recipes); - } - - /* BLOCK DROPS */ - @Override - public boolean handlesDrops() { - return true; - } - - /* INTERACTION */ - @Override - public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) { - int meta = world.getBlockMetadata(x, y, z); - if (Proxies.common.isSimulating(world) && block.canHarvestBlock(player, meta)) { - TileForestry tile = (TileForestry) world.getTileEntity(x, y, z); - Utils.dropInventory(tile, world, x, y, z); - - ItemStack stack = new ItemStack(block, 1, meta); - NBTTagCompound compound = new NBTTagCompound(); - tile.writeToNBT(compound); - stack.setTagCompound(compound); - StackUtils.dropItemStackAsEntity(stack, world, x, y, z); - } - - return world.setBlockToAir(x, y, z); - } - -} diff --git a/src/main/java/forestry/core/gadgets/Mill.java b/src/main/java/forestry/core/gadgets/Mill.java index 505b27f7f..639e5f0cb 100755 --- a/src/main/java/forestry/core/gadgets/Mill.java +++ b/src/main/java/forestry/core/gadgets/Mill.java @@ -17,12 +17,12 @@ import forestry.core.network.DataOutputStreamForestry; public abstract class Mill extends TileBase { + protected float speed; + protected int stage = 0; public int charge = 0; - public float speed; - public int stage = 0; public float progress; - public Mill() { + protected Mill() { speed = 0.01F; } diff --git a/src/main/java/forestry/core/gadgets/TileAnalyzer.java b/src/main/java/forestry/core/gadgets/TileAnalyzer.java index fdbd8043a..f0a2fd382 100755 --- a/src/main/java/forestry/core/gadgets/TileAnalyzer.java +++ b/src/main/java/forestry/core/gadgets/TileAnalyzer.java @@ -55,8 +55,8 @@ import forestry.core.utils.GuiUtil; public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiquidTankContainer, IItemStackDisplay { /* CONSTANTS */ - public static final int TIME_TO_ANALYZE = 125; - public static final int HONEY_REQUIRED = 100; + private static final int TIME_TO_ANALYZE = 125; + private static final int HONEY_REQUIRED = 100; public static final short SLOT_ANALYZE = 0; public static final short SLOT_CAN = 1; @@ -68,7 +68,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui /* MEMBER */ private int analyzeTime; - public final FilteredTank resourceTank; + private final FilteredTank resourceTank; private final TankManager tankManager; @@ -87,7 +87,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui /* GUI */ @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.AnalyzerGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } diff --git a/src/main/java/forestry/core/gadgets/TileBase.java b/src/main/java/forestry/core/gadgets/TileBase.java index 8f83c2a66..daa9391db 100755 --- a/src/main/java/forestry/core/gadgets/TileBase.java +++ b/src/main/java/forestry/core/gadgets/TileBase.java @@ -16,17 +16,16 @@ import forestry.core.interfaces.IHintSource; public abstract class TileBase extends TileForestry implements IHintSource { - /* INTERACTION */ - public abstract void openGui(EntityPlayer player, TileBase tile); + public abstract void openGui(EntityPlayer player); public boolean canDrainWithBucket() { return false; } - /* IHINTSOURCE */ + /* IHintSource */ private String[] hints; - public void setHints(String[] hints) { + protected void setHints(String[] hints) { this.hints = hints; } diff --git a/src/main/java/forestry/core/gadgets/TileEscritoire.java b/src/main/java/forestry/core/gadgets/TileEscritoire.java index 227d23947..3e9ccf1f5 100755 --- a/src/main/java/forestry/core/gadgets/TileEscritoire.java +++ b/src/main/java/forestry/core/gadgets/TileEscritoire.java @@ -52,7 +52,7 @@ public class TileEscritoire extends TileBase implements ISidedInventory, IRender /* GUI */ @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.NaturalistBenchGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } diff --git a/src/main/java/forestry/core/gadgets/TileForestry.java b/src/main/java/forestry/core/gadgets/TileForestry.java index 6e5ef5d1c..fa08fa863 100755 --- a/src/main/java/forestry/core/gadgets/TileForestry.java +++ b/src/main/java/forestry/core/gadgets/TileForestry.java @@ -24,7 +24,6 @@ import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.MathHelper; -import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -88,9 +87,9 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE super.validate(); } - public void rotateAfterPlacement(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack) { + public void rotateAfterPlacement(EntityLivingBase entityLiving) { - int l = MathHelper.floor_double(((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3; + int l = MathHelper.floor_double(((entityLiving.rotationYaw * 4F) / 360F) + 0.5D) & 3; if (l == 0) { setOrientation(ForgeDirection.NORTH); } @@ -163,7 +162,7 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE } /* INetworkedEntity */ - public final void sendNetworkUpdate() { + protected final void sendNetworkUpdate() { PacketTileStream packet = new PacketTileStream(this); Proxies.net.sendNetworkPacket(packet, worldObj); } @@ -207,7 +206,7 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE } // / REDSTONE INFO - public boolean isRedstoneActivated() { + protected boolean isRedstoneActivated() { return worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord); } @@ -266,7 +265,7 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE return inventory; } - public final void setInternalInventory(IInventoryAdapter inv) { + protected final void setInternalInventory(IInventoryAdapter inv) { if (inv == null) { throw new NullPointerException("Inventory cannot be null"); } diff --git a/src/main/java/forestry/core/gadgets/TileNaturalistChest.java b/src/main/java/forestry/core/gadgets/TileNaturalistChest.java index 6c2bae320..e284d6f0b 100755 --- a/src/main/java/forestry/core/gadgets/TileNaturalistChest.java +++ b/src/main/java/forestry/core/gadgets/TileNaturalistChest.java @@ -24,13 +24,13 @@ public abstract class TileNaturalistChest extends TileBase implements IPagedInve private final int guiID; public TileNaturalistChest(ISpeciesRoot speciesRoot, int guiId) { - setInternalInventory(new NaturalistInventoryAdapter(this, 125, "Items", speciesRoot)); + setInternalInventory(new NaturalistInventoryAdapter(this, speciesRoot)); setHints(Config.hints.get("apiarist.chest")); this.guiID = guiId; } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, guiID, player.worldObj, xCoord, yCoord, zCoord); } @@ -42,8 +42,8 @@ public abstract class TileNaturalistChest extends TileBase implements IPagedInve private static class NaturalistInventoryAdapter extends TileInventoryAdapter { private final ISpeciesRoot speciesRoot; - public NaturalistInventoryAdapter(TileNaturalistChest tile, int size, String name, ISpeciesRoot speciesRoot) { - super(tile, size, name); + public NaturalistInventoryAdapter(TileNaturalistChest tile, ISpeciesRoot speciesRoot) { + super(tile, 125, "Items"); this.speciesRoot = speciesRoot; } diff --git a/src/main/java/forestry/core/gadgets/TilePowered.java b/src/main/java/forestry/core/gadgets/TilePowered.java index e6c04050d..9ae0a1d7d 100644 --- a/src/main/java/forestry/core/gadgets/TilePowered.java +++ b/src/main/java/forestry/core/gadgets/TilePowered.java @@ -32,11 +32,11 @@ import buildcraft.api.tiles.IHasWork; @Optional.Interface(iface = "buildcraft.api.tiles.IHasWork", modid = "BuildCraftAPI|tiles") public abstract class TilePowered extends TileBase implements IRenderableMachine, IPowerHandler, IHasWork { - public static final int WORK_CYCLES = 4; + private static final int WORK_CYCLES = 4; - protected final EnergyManager energyManager; + private final EnergyManager energyManager; - public TilePowered(int maxTransfer, int energyPerWork, int capacity) { + protected TilePowered(int maxTransfer, int energyPerWork, int capacity) { this.energyManager = new EnergyManager(maxTransfer, energyPerWork, capacity); this.energyManager.setReceiveOnly(); } @@ -84,7 +84,7 @@ public abstract class TilePowered extends TileBase implements IRenderableMachine } } - public abstract boolean workCycle(); + protected abstract boolean workCycle(); @Override public void writeToNBT(NBTTagCompound nbt) { diff --git a/src/main/java/forestry/core/genetics/BreedingTracker.java b/src/main/java/forestry/core/genetics/BreedingTracker.java index 0d5027ce4..6aa55a003 100755 --- a/src/main/java/forestry/core/genetics/BreedingTracker.java +++ b/src/main/java/forestry/core/genetics/BreedingTracker.java @@ -54,7 +54,7 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin private final GameProfile username; - public BreedingTracker(String s, GameProfile username) { + protected BreedingTracker(String s, GameProfile username) { super(s); this.username = username; } diff --git a/src/main/java/forestry/core/genetics/EffectData.java b/src/main/java/forestry/core/genetics/EffectData.java index 5a4b50df2..bd28f14a9 100755 --- a/src/main/java/forestry/core/genetics/EffectData.java +++ b/src/main/java/forestry/core/genetics/EffectData.java @@ -16,9 +16,9 @@ import forestry.api.genetics.IEffectData; public class EffectData implements IEffectData { - private int[] intData; + private final int[] intData; private float[] floatData; - private boolean[] boolData; + private final boolean[] boolData; public EffectData(int intSize, int boolSize) { this.intData = new int[intSize]; diff --git a/src/main/java/forestry/core/genetics/Genome.java b/src/main/java/forestry/core/genetics/Genome.java index bbfb19c3b..4a2326169 100755 --- a/src/main/java/forestry/core/genetics/Genome.java +++ b/src/main/java/forestry/core/genetics/Genome.java @@ -34,22 +34,22 @@ public abstract class Genome implements IGenome { private IChromosome[] chromosomes; // / CONSTRUCTOR - public Genome(NBTTagCompound nbttagcompound) { + protected Genome(NBTTagCompound nbttagcompound) { this.chromosomes = new Chromosome[getDefaultTemplate().length]; readFromNBT(nbttagcompound); } - private IAllele[] getDefaultTemplate() { - return getSpeciesRoot().getDefaultTemplate(); - } - - public Genome(IChromosome[] chromosomes) { + protected Genome(IChromosome[] chromosomes) { if (chromosomes.length != getDefaultTemplate().length) { throw new IllegalArgumentException(String.format("Tried to create a genome for '%s' from an invalid chromosome template.", getSpeciesRoot().getUID())); } this.chromosomes = chromosomes; } + private IAllele[] getDefaultTemplate() { + return getSpeciesRoot().getDefaultTemplate(); + } + // NBT RETRIEVAL /** @@ -83,7 +83,7 @@ public abstract class Genome implements IGenome { return (IAlleleSpecies) activeAllele; } - public static IChromosome getChromosome(ItemStack itemStack, IChromosomeType chromosomeType, ISpeciesRoot speciesRoot) { + private static IChromosome getChromosome(ItemStack itemStack, IChromosomeType chromosomeType, ISpeciesRoot speciesRoot) { NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); if (nbtTagCompound == null) { return null; @@ -102,7 +102,7 @@ public abstract class Genome implements IGenome { return chromosomes[chromosomeType.ordinal()]; } - public static IChromosome[] getChromosomes(NBTTagCompound genomeNBT, ISpeciesRoot speciesRoot) { + private static IChromosome[] getChromosomes(NBTTagCompound genomeNBT, ISpeciesRoot speciesRoot) { NBTTagList chromosomesNBT = genomeNBT.getTagList("Chromosomes", 10); IChromosome[] chromosomes = new IChromosome[speciesRoot.getDefaultTemplate().length]; @@ -145,7 +145,7 @@ public abstract class Genome implements IGenome { return chromosomes; } - public static IAllele getActiveAllele(ItemStack itemStack, IChromosomeType chromosomeType, ISpeciesRoot speciesRoot) { + protected static IAllele getActiveAllele(ItemStack itemStack, IChromosomeType chromosomeType, ISpeciesRoot speciesRoot) { IChromosome chromosome = getChromosome(itemStack, chromosomeType, speciesRoot); if (chromosome == null) { return null; diff --git a/src/main/java/forestry/core/genetics/IndividualLiving.java b/src/main/java/forestry/core/genetics/IndividualLiving.java index 5f8e75ac2..c32c5cd8d 100755 --- a/src/main/java/forestry/core/genetics/IndividualLiving.java +++ b/src/main/java/forestry/core/genetics/IndividualLiving.java @@ -18,13 +18,13 @@ import forestry.api.genetics.IIndividualLiving; public abstract class IndividualLiving extends Individual implements IIndividualLiving { - protected int health; - protected int maxHealth; + private int health; + private int maxHealth; - public IndividualLiving() { + protected IndividualLiving() { } - public IndividualLiving(int newHealth) { + protected IndividualLiving(int newHealth) { health = maxHealth = newHealth; } @@ -97,7 +97,7 @@ public abstract class IndividualLiving extends Individual implements IIndividual } } - public void decreaseHealth() { + private void decreaseHealth() { if (health > 0) { health--; } diff --git a/src/main/java/forestry/core/genetics/ItemResearchNote.java b/src/main/java/forestry/core/genetics/ItemResearchNote.java index 7b4cfe743..1f6e8e1dc 100755 --- a/src/main/java/forestry/core/genetics/ItemResearchNote.java +++ b/src/main/java/forestry/core/genetics/ItemResearchNote.java @@ -48,7 +48,7 @@ public class ItemResearchNote extends ItemForestry { public static final EnumNoteType[] VALUES = values(); - private IMutation getEncodedMutation(ISpeciesRoot root, NBTTagCompound compound) { + private static IMutation getEncodedMutation(ISpeciesRoot root, NBTTagCompound compound) { IAllele allele0 = AlleleManager.alleleRegistry.getAllele(compound.getString("AL0")); IAllele allele1 = AlleleManager.alleleRegistry.getAllele(compound.getString("AL1")); if (allele0 == null || allele1 == null) { @@ -141,8 +141,8 @@ public class ItemResearchNote extends ItemForestry { return false; } - IAlleleSpecies species0 = (IAlleleSpecies) encoded.getAllele0(); - IAlleleSpecies species1 = (IAlleleSpecies) encoded.getAllele1(); + IAlleleSpecies species0 = encoded.getAllele0(); + IAlleleSpecies species1 = encoded.getAllele1(); IAlleleSpecies speciesResult = (IAlleleSpecies) encoded.getTemplate()[root.getKaryotypeKey().ordinal()]; tracker.registerSpecies(species0); diff --git a/src/main/java/forestry/core/genetics/Mutation.java b/src/main/java/forestry/core/genetics/Mutation.java index f94a8b179..c34fcb399 100755 --- a/src/main/java/forestry/core/genetics/Mutation.java +++ b/src/main/java/forestry/core/genetics/Mutation.java @@ -30,17 +30,18 @@ import forestry.api.genetics.IMutationCustom; public abstract class Mutation implements IMutationCustom { private final int chance; - boolean isSecret = false; - protected final IAlleleSpecies species0; - protected final IAlleleSpecies species1; + private final IAlleleSpecies species0; + private final IAlleleSpecies species1; private final IAllele[] template; private final List mutationConditions = new ArrayList(); private final List specialConditions = new ArrayList(); - public Mutation(IAlleleSpecies species0, IAlleleSpecies species1, IAllele[] template, int chance) { + private boolean isSecret = false; + + protected Mutation(IAlleleSpecies species0, IAlleleSpecies species1, IAllele[] template, int chance) { this.species0 = species0; this.species1 = species1; this.template = template; diff --git a/src/main/java/forestry/core/genetics/SpeciesRoot.java b/src/main/java/forestry/core/genetics/SpeciesRoot.java index 734ff2e90..ef1fa5969 100755 --- a/src/main/java/forestry/core/genetics/SpeciesRoot.java +++ b/src/main/java/forestry/core/genetics/SpeciesRoot.java @@ -45,7 +45,7 @@ public abstract class SpeciesRoot implements ISpeciesRoot { } /* TEMPLATES */ - public final HashMap speciesTemplates = new HashMap(); + protected final HashMap speciesTemplates = new HashMap(); @Override public Map getGenomeTemplates() { diff --git a/src/main/java/forestry/core/genetics/alleles/Allele.java b/src/main/java/forestry/core/genetics/alleles/Allele.java index 243b7efe4..f1a37c73d 100644 --- a/src/main/java/forestry/core/genetics/alleles/Allele.java +++ b/src/main/java/forestry/core/genetics/alleles/Allele.java @@ -24,9 +24,9 @@ import forestry.api.lepidopterology.IAlleleButterflySpecies; public abstract class Allele implements IAllele { - protected final String uid; - protected final boolean isDominant; - protected final String unlocalizedName; + private final String uid; + private final boolean isDominant; + private final String unlocalizedName; protected Allele(String uid, String unlocalizedName, boolean isDominant) { this(uid, unlocalizedName, isDominant, true); diff --git a/src/main/java/forestry/core/genetics/alleles/AlleleSpecies.java b/src/main/java/forestry/core/genetics/alleles/AlleleSpecies.java index 7a7b6ed64..20eebfa82 100644 --- a/src/main/java/forestry/core/genetics/alleles/AlleleSpecies.java +++ b/src/main/java/forestry/core/genetics/alleles/AlleleSpecies.java @@ -46,7 +46,7 @@ public abstract class AlleleSpecies extends Allele implements IAlleleSpeciesCust private EnumTemperature climate = EnumTemperature.NORMAL; private EnumHumidity humidity = EnumHumidity.NORMAL; - public AlleleSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, boolean doRegister) { + protected AlleleSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, boolean doRegister) { super(uid, unlocalizedName, isDominant, false); this.branch = branch; diff --git a/src/main/java/forestry/core/gui/ContainerItemInventory.java b/src/main/java/forestry/core/gui/ContainerItemInventory.java index aa5c72db2..4da8d8732 100755 --- a/src/main/java/forestry/core/gui/ContainerItemInventory.java +++ b/src/main/java/forestry/core/gui/ContainerItemInventory.java @@ -22,7 +22,7 @@ public abstract class ContainerItemInventory extends Co protected final I inventory; - public ContainerItemInventory(I inventory, InventoryPlayer playerInventory, int xInv, int yInv) { + protected ContainerItemInventory(I inventory, InventoryPlayer playerInventory, int xInv, int yInv) { this.inventory = inventory; addPlayerInventory(playerInventory, xInv, yInv); diff --git a/src/main/java/forestry/core/gui/ContainerLiquidTanks.java b/src/main/java/forestry/core/gui/ContainerLiquidTanks.java index 78c1ddef2..2487d2828 100755 --- a/src/main/java/forestry/core/gui/ContainerLiquidTanks.java +++ b/src/main/java/forestry/core/gui/ContainerLiquidTanks.java @@ -31,9 +31,9 @@ import forestry.core.network.PacketId; import forestry.core.network.PacketSlotClick; import forestry.core.proxy.Proxies; -public class ContainerLiquidTanks extends ContainerTile { +public abstract class ContainerLiquidTanks extends ContainerTile { - public ContainerLiquidTanks(T tile, InventoryPlayer playerInventory, int xInv, int yInv) { + protected ContainerLiquidTanks(T tile, InventoryPlayer playerInventory, int xInv, int yInv) { super(tile, playerInventory, xInv, yInv); } diff --git a/src/main/java/forestry/core/gui/ContainerNaturalistInventory.java b/src/main/java/forestry/core/gui/ContainerNaturalistInventory.java index 738d09095..69b42038c 100755 --- a/src/main/java/forestry/core/gui/ContainerNaturalistInventory.java +++ b/src/main/java/forestry/core/gui/ContainerNaturalistInventory.java @@ -19,13 +19,13 @@ import forestry.core.network.PacketGuiSelect; public class ContainerNaturalistInventory extends ContainerTile implements IGuiSelectable { - public ContainerNaturalistInventory(InventoryPlayer player, TileNaturalistChest tile, int page, int pageSize) { + public ContainerNaturalistInventory(InventoryPlayer player, TileNaturalistChest tile, int page) { super(tile, player, 18, 120); // Inventory for (int x = 0; x < 5; x++) { for (int y = 0; y < 5; y++) { - addSlotToContainer(new SlotFiltered(tile, y + page * pageSize + x * 5, 100 + y * 18, 21 + x * 18)); + addSlotToContainer(new SlotFiltered(tile, y + page * 25 + x * 5, 100 + y * 18, 21 + x * 18)); } } } diff --git a/src/main/java/forestry/core/gui/ContainerSocketed.java b/src/main/java/forestry/core/gui/ContainerSocketed.java index e59ff7985..04b4972d0 100755 --- a/src/main/java/forestry/core/gui/ContainerSocketed.java +++ b/src/main/java/forestry/core/gui/ContainerSocketed.java @@ -23,9 +23,9 @@ import forestry.core.network.PacketSocketUpdate; import forestry.core.proxy.Proxies; import forestry.core.utils.StackUtils; -public class ContainerSocketed extends ContainerTile { +public abstract class ContainerSocketed extends ContainerTile { - public ContainerSocketed(T tile, InventoryPlayer playerInventory, int xInv, int yInv) { + protected ContainerSocketed(T tile, InventoryPlayer playerInventory, int xInv, int yInv) { super(tile, playerInventory, xInv, yInv); } @@ -49,7 +49,7 @@ public class ContainerSocketed extends ContainerForestry { +public abstract class ContainerTile extends ContainerForestry { protected final T tile; - protected final IAccessHandler accessHandler; + private final IAccessHandler accessHandler; - public ContainerTile(T tile) { + protected ContainerTile(T tile) { this.tile = tile; if (tile instanceof IRestrictedAccessTile) { @@ -45,7 +45,7 @@ public class ContainerTile extends Contai } } - public ContainerTile(T tileForestry, InventoryPlayer playerInventory, int xInv, int yInv) { + protected ContainerTile(T tileForestry, InventoryPlayer playerInventory, int xInv, int yInv) { this(tileForestry); addPlayerInventory(playerInventory, xInv, yInv); diff --git a/src/main/java/forestry/core/gui/GuiAlyzer.java b/src/main/java/forestry/core/gui/GuiAlyzer.java index d14eee27d..fce7cf81f 100755 --- a/src/main/java/forestry/core/gui/GuiAlyzer.java +++ b/src/main/java/forestry/core/gui/GuiAlyzer.java @@ -48,14 +48,14 @@ public abstract class GuiAlyzer extends GuiForestry protected static final int COLUMN_1 = 90; protected static final int COLUMN_2 = 155; - protected final ISpeciesRoot speciesRoot; - protected final IBreedingTracker breedingTracker; + private final ISpeciesRoot speciesRoot; + private final IBreedingTracker breedingTracker; - protected final String guiName; + private final String guiName; - protected HashMap iconStacks = new HashMap(); + protected final Map iconStacks = new HashMap(); - public GuiAlyzer(String speciesRoot, EntityPlayer player, ContainerAlyzer container, IInventory inventory, String guiName) { + protected GuiAlyzer(String speciesRoot, EntityPlayer player, ContainerAlyzer container, IInventory inventory, String guiName) { super(Defaults.TEXTURE_PATH_GUI + "/beealyzer2.png", container, inventory); this.xSize = 246; @@ -125,10 +125,6 @@ public abstract class GuiAlyzer extends GuiForestry newLine(); } - protected final void drawSpeciesRow(String text0, IIndividual individual, IChromosomeType chromosome) { - drawSpeciesRow(text0, individual, chromosome, null, null); - } - protected static String checkCustomName(String key) { if (StringUtil.canTranslate(key)) { return StringUtil.localize(key); @@ -278,7 +274,7 @@ public abstract class GuiAlyzer extends GuiForestry continue; } - drawUnknownMutation(mutation.getKey(), mutation.getValue(), COLUMN_0 + x); + drawUnknownMutation(mutation.getKey(), COLUMN_0 + x); } x += columnWidth; @@ -303,7 +299,7 @@ public abstract class GuiAlyzer extends GuiForestry widgetManager.add(new ItemStackWidget(x + 33, getLineY(), resultBee)); } - protected void drawUnknownMutation(IMutation combination, IAllele species, int x) { + private void drawUnknownMutation(IMutation combination, int x) { drawQuestionMark(guiLeft + x, guiTop + getLineY()); @@ -312,12 +308,12 @@ public abstract class GuiAlyzer extends GuiForestry drawQuestionMark(guiLeft + x + 32, guiTop + getLineY()); } - protected void drawQuestionMark(int x, int y) { + private void drawQuestionMark(int x, int y) { Proxies.common.bindTexture(textureFile); drawTexturedModalRect(x, y, 78, 240, 16, 16); } - protected void drawProbabilityArrow(float chance, int x, int y) { + private void drawProbabilityArrow(float chance, int x, int y) { int line = 247; int column = 100; switch (EnumMutateChance.rateChance(chance)) { diff --git a/src/main/java/forestry/core/gui/GuiEscritoire.java b/src/main/java/forestry/core/gui/GuiEscritoire.java index af9646186..c20dc432f 100755 --- a/src/main/java/forestry/core/gui/GuiEscritoire.java +++ b/src/main/java/forestry/core/gui/GuiEscritoire.java @@ -22,7 +22,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; import forestry.core.config.Defaults; import forestry.core.gadgets.NaturalistGame; diff --git a/src/main/java/forestry/core/gui/GuiForestry.java b/src/main/java/forestry/core/gui/GuiForestry.java index 580f909e4..d94179138 100755 --- a/src/main/java/forestry/core/gui/GuiForestry.java +++ b/src/main/java/forestry/core/gui/GuiForestry.java @@ -62,11 +62,11 @@ public abstract class GuiForestry ext protected final FontColour fontColor; public final ResourceLocation textureFile; - public GuiForestry(String texture, C container, I inventory) { + protected GuiForestry(String texture, C container, I inventory) { this(new ResourceLocation("forestry", texture), container, inventory); } - public GuiForestry(ResourceLocation texture, C container, I inventory) { + protected GuiForestry(ResourceLocation texture, C container, I inventory) { super(container); this.widgetManager = new WidgetManager(this); this.ledgerManager = new LedgerManager(this); @@ -213,7 +213,7 @@ public abstract class GuiForestry ext super.mouseClickMove(mouseX, mouseY, mouseButton, time); } - public Slot getSlotAtPosition(int par1, int par2) { + protected Slot getSlotAtPosition(int par1, int par2) { for (int k = 0; k < this.inventorySlots.inventorySlots.size(); ++k) { Slot slot = (Slot) this.inventorySlots.inventorySlots.get(k); @@ -225,11 +225,11 @@ public abstract class GuiForestry ext return null; } - public boolean isMouseOverSlot(Slot par1Slot, int par2, int par3) { + private boolean isMouseOverSlot(Slot par1Slot, int par2, int par3) { return this.func_146978_c(par1Slot.xDisplayPosition, par1Slot.yDisplayPosition, 16, 16, par2, par3); } - public void drawToolTips(ToolTip toolTips, int mouseX, int mouseY) { + private void drawToolTips(ToolTip toolTips, int mouseX, int mouseY) { if (toolTips == null) { return; } diff --git a/src/main/java/forestry/core/gui/GuiForestryTitled.java b/src/main/java/forestry/core/gui/GuiForestryTitled.java index eabd4d4a1..57b016c97 100644 --- a/src/main/java/forestry/core/gui/GuiForestryTitled.java +++ b/src/main/java/forestry/core/gui/GuiForestryTitled.java @@ -18,7 +18,7 @@ import forestry.core.utils.StringUtil; public abstract class GuiForestryTitled extends GuiForestry { - public GuiForestryTitled(String texture, C container, I inventory) { + protected GuiForestryTitled(String texture, C container, I inventory) { super(texture, container, inventory); } diff --git a/src/main/java/forestry/core/gui/Ledger.java b/src/main/java/forestry/core/gui/Ledger.java index 2c0dd94fc..75c08709d 100755 --- a/src/main/java/forestry/core/gui/Ledger.java +++ b/src/main/java/forestry/core/gui/Ledger.java @@ -36,12 +36,12 @@ public abstract class Ledger { private static final ResourceLocation ledgerTextureRight = new ForestryResource(Defaults.TEXTURE_PATH_GUI + "/ledger.png"); private static final ResourceLocation ledgerTextureLeft = new ForestryResource(Defaults.TEXTURE_PATH_GUI + "/ledgerLeft.png"); - protected final LedgerManager manager; + private final LedgerManager manager; - protected final int fontColorHeader; - protected final int fontColorText; - protected final int fontColorSubheader; - protected final int overlayColor; + private final int fontColorHeader; + private final int fontColorText; + private final int fontColorSubheader; + private final int overlayColor; private boolean open; @@ -51,13 +51,13 @@ public abstract class Ledger { protected float currentWidth = minWidth; protected float currentHeight = minHeight; - protected final ResourceLocation texture; + private final ResourceLocation texture; - public Ledger(LedgerManager manager, String name) { + protected Ledger(LedgerManager manager, String name) { this(manager, name, true); } - public Ledger(LedgerManager manager, String name, boolean rightSide) { + protected Ledger(LedgerManager manager, String name, boolean rightSide) { this.manager = manager; if (rightSide) { texture = ledgerTextureRight; diff --git a/src/main/java/forestry/core/gui/LedgerManager.java b/src/main/java/forestry/core/gui/LedgerManager.java index 0c058845d..a4d4fd766 100755 --- a/src/main/java/forestry/core/gui/LedgerManager.java +++ b/src/main/java/forestry/core/gui/LedgerManager.java @@ -27,11 +27,12 @@ import forestry.core.proxy.Proxies; public class LedgerManager { - public final GuiForestry gui; - public IErrorSource errorSource; + private final List ledgers = new ArrayList(); + private final List errorLedgers = new ArrayList(); - protected final List ledgers = new ArrayList(); - protected final List errorLedgers = new ArrayList(); + private IErrorSource errorSource; + + public final GuiForestry gui; public LedgerManager(GuiForestry gui) { this.gui = gui; @@ -64,7 +65,7 @@ public class LedgerManager { this.ledgers.add(ledgers.size() - 1, ledger); } - protected Ledger getAtPosition(int mX, int mY) { + private Ledger getAtPosition(int mX, int mY) { if (ledgers.size() > 0) { final int xShift = ((gui.width - gui.getSizeX()) / 2) + gui.getSizeX(); diff --git a/src/main/java/forestry/core/gui/OwnerLedger.java b/src/main/java/forestry/core/gui/OwnerLedger.java index 2cb82dc58..52b4343f7 100755 --- a/src/main/java/forestry/core/gui/OwnerLedger.java +++ b/src/main/java/forestry/core/gui/OwnerLedger.java @@ -46,7 +46,7 @@ public class OwnerLedger extends Ledger { } } - public boolean isAccessButton(int mouseX, int mouseY) { + private boolean isAccessButton(int mouseX, int mouseY) { int shiftX = currentShiftX; int shiftY = currentShiftY + 44; diff --git a/src/main/java/forestry/core/gui/buttons/ButtonTextureSet.java b/src/main/java/forestry/core/gui/buttons/ButtonTextureSet.java deleted file mode 100755 index 55be211ec..000000000 --- a/src/main/java/forestry/core/gui/buttons/ButtonTextureSet.java +++ /dev/null @@ -1,47 +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.gui.buttons; - -/** - * @author CovertJaguar - */ -public class ButtonTextureSet implements IButtonTextureSet { - - private final int x, y, height, width; - - public ButtonTextureSet(int x, int y, int height, int width) { - this.x = x; - this.y = y; - this.height = height; - this.width = width; - } - - @Override - public int getX() { - return x; - } - - @Override - public int getY() { - return y; - } - - @Override - public int getHeight() { - return height; - } - - @Override - public int getWidth() { - return width; - } - -} diff --git a/src/main/java/forestry/core/gui/buttons/GuiBetterButton.java b/src/main/java/forestry/core/gui/buttons/GuiBetterButton.java index 41a9f061f..97881232d 100755 --- a/src/main/java/forestry/core/gui/buttons/GuiBetterButton.java +++ b/src/main/java/forestry/core/gui/buttons/GuiBetterButton.java @@ -32,19 +32,6 @@ public class GuiBetterButton extends GuiButton implements IToolTipProvider { private ToolTip toolTip; private boolean useTexWidth = false; - public GuiBetterButton(int id, int x, int y, String label) { - this(id, x, y, 200, StandardButtonTextureSets.LARGE_BUTTON, label); - } - - public GuiBetterButton(int id, int x, int y, int width, String label) { - this(id, x, y, width, StandardButtonTextureSets.LARGE_BUTTON, label); - } - - public GuiBetterButton(int id, int x, int y, int width, IButtonTextureSet texture, String label) { - super(id, x, y, width, texture.getHeight(), label); - this.texture = texture; - } - public GuiBetterButton(int id, int x, int y, IButtonTextureSet texture) { super(id, x, y, texture.getWidth(), texture.getHeight(), ""); this.texture = texture; @@ -96,7 +83,7 @@ public class GuiBetterButton extends GuiButton implements IToolTipProvider { return mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + getWidth() && mouseY < yPosition + getHeight(); } - protected void bindButtonTextures(Minecraft minecraft) { + protected static void bindButtonTextures(Minecraft minecraft) { minecraft.renderEngine.bindTexture(TEXTURE); } diff --git a/src/main/java/forestry/core/gui/buttons/GuiButtonSmall.java b/src/main/java/forestry/core/gui/buttons/GuiButtonSmall.java deleted file mode 100755 index 20f29db52..000000000 --- a/src/main/java/forestry/core/gui/buttons/GuiButtonSmall.java +++ /dev/null @@ -1,27 +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.gui.buttons; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class GuiButtonSmall extends GuiBetterButton { - - public GuiButtonSmall(int i, int x, int y, String s) { - this(i, x, y, 200, s); - } - - public GuiButtonSmall(int i, int x, int y, int w, String s) { - super(i, x, y, w, StandardButtonTextureSets.SMALL_BUTTON, s); - } - -} diff --git a/src/main/java/forestry/core/gui/buttons/GuiMultiButton.java b/src/main/java/forestry/core/gui/buttons/GuiMultiButton.java deleted file mode 100755 index 9cd5b4672..000000000 --- a/src/main/java/forestry/core/gui/buttons/GuiMultiButton.java +++ /dev/null @@ -1,100 +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.gui.buttons; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; - -import forestry.core.gui.tooltips.ToolTip; - -/** - * @author CovertJaguar - */ -@SideOnly(Side.CLIENT) -public class GuiMultiButton extends GuiBetterButton { - - private final MultiButtonController control; - public boolean canChange = true; - - public GuiMultiButton(int id, int x, int y, int width, MultiButtonController control) { - super(id, x, y, width, StandardButtonTextureSets.LARGE_BUTTON, ""); - this.control = control; - } - - @Override - public int getHeight() { - return texture.getHeight(); - } - - @Override - public void drawButton(Minecraft minecraft, int x, int y) { - if (!visible) { - return; - } - FontRenderer fontrenderer = minecraft.fontRenderer; - bindButtonTextures(minecraft); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - IMultiButtonState state = control.getButtonState(); - IButtonTextureSet tex = state.getTextureSet(); - int xOffset = tex.getX(); - int yOffset = tex.getY(); - int h = tex.getHeight(); - int w = tex.getWidth(); - boolean flag = x >= xPosition && y >= yPosition && x < xPosition + width && y < yPosition + h; - int hoverState = getHoverState(flag); - drawTexturedModalRect(xPosition, yPosition, xOffset, yOffset + hoverState * h, width / 2, h); - drawTexturedModalRect(xPosition + width / 2, yPosition, xOffset + w - width / 2, yOffset + hoverState * h, width / 2, h); - mouseDragged(minecraft, x, y); - displayString = state.getLabel(); - if (!displayString.equals("")) { - if (!enabled) { - drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (h - 8) / 2, 0xffa0a0a0); - } else if (flag) { - drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (h - 8) / 2, 0xffffa0); - } else { - drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (h - 8) / 2, 0xe0e0e0); - } - } - } - - @Override - public boolean mousePressed(Minecraft minecraft, int mouseX, int mouseY) { - boolean pressed = super.mousePressed(minecraft, mouseX, mouseY); - if (canChange && pressed && enabled) { - if (Mouse.getEventButton() == 0) { - control.incrementState(); - } else { - control.decrementState(); - } - } - return pressed; - } - - public MultiButtonController getController() { - return control; - } - - @Override - public ToolTip getToolTip() { - ToolTip tip = control.getButtonState().getToolTip(); - if (tip != null) { - return tip; - } - return super.getToolTip(); - } - -} diff --git a/src/main/java/forestry/core/gui/buttons/GuiToggleButton.java b/src/main/java/forestry/core/gui/buttons/GuiToggleButton.java deleted file mode 100755 index 9768a2b45..000000000 --- a/src/main/java/forestry/core/gui/buttons/GuiToggleButton.java +++ /dev/null @@ -1,61 +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.gui.buttons; - -public class GuiToggleButton extends GuiBetterButton { - - public boolean active; - - public GuiToggleButton(int id, int x, int y, String label, boolean active) { - this(id, x, y, 200, StandardButtonTextureSets.LARGE_BUTTON, label, active); - } - - public GuiToggleButton(int id, int x, int y, int width, String s, boolean active) { - super(id, x, y, width, StandardButtonTextureSets.LARGE_BUTTON, s); - this.active = active; - } - - public GuiToggleButton(int id, int x, int y, int width, IButtonTextureSet texture, String s, boolean active) { - super(id, x, y, width, texture, s); - this.active = active; - } - - public void toggle() { - active = !active; - } - - @Override - public int getHoverState(boolean mouseOver) { - int state = 1; - if (!enabled) { - state = 0; - } else if (mouseOver) { - state = 2; - } else if (!active) { - state = 3; - } - return state; - } - - @Override - public int getTextColor(boolean mouseOver) { - if (!enabled) { - return 0xffa0a0a0; - } else if (mouseOver) { - return 0xffffa0; - } else if (!active) { - return 0x777777; - } else { - return 0xe0e0e0; - } - } - -} diff --git a/src/main/java/forestry/core/gui/buttons/GuiToggleButtonSmall.java b/src/main/java/forestry/core/gui/buttons/GuiToggleButtonSmall.java deleted file mode 100755 index 14db67a00..000000000 --- a/src/main/java/forestry/core/gui/buttons/GuiToggleButtonSmall.java +++ /dev/null @@ -1,28 +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.gui.buttons; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class GuiToggleButtonSmall extends GuiToggleButton { - - public GuiToggleButtonSmall(int i, int j, int k, String s, boolean active) { - this(i, j, k, 200, s, active); - } - - public GuiToggleButtonSmall(int i, int x, int y, int w, String s, boolean active) { - super(i, x, y, w, StandardButtonTextureSets.SMALL_BUTTON, s, active); - this.active = active; - } - -} diff --git a/src/main/java/forestry/core/gui/buttons/IButtonTextureSet.java b/src/main/java/forestry/core/gui/buttons/IButtonTextureSet.java index 6128bcb7a..1813ce7b3 100755 --- a/src/main/java/forestry/core/gui/buttons/IButtonTextureSet.java +++ b/src/main/java/forestry/core/gui/buttons/IButtonTextureSet.java @@ -15,12 +15,10 @@ package forestry.core.gui.buttons; */ public interface IButtonTextureSet { - public int getX(); + int getX(); + int getY(); - public int getY(); - - public int getHeight(); - - public int getWidth(); + int getHeight(); + int getWidth(); } diff --git a/src/main/java/forestry/core/gui/buttons/IMultiButtonState.java b/src/main/java/forestry/core/gui/buttons/IMultiButtonState.java deleted file mode 100755 index 952b5999b..000000000 --- a/src/main/java/forestry/core/gui/buttons/IMultiButtonState.java +++ /dev/null @@ -1,29 +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.gui.buttons; - -import forestry.core.gui.tooltips.ToolTip; - - -/** - * @author CovertJaguar - */ -public interface IMultiButtonState { - - public String getLabel(); - - public String name(); - - public IButtonTextureSet getTextureSet(); - - public ToolTip getToolTip(); - -} diff --git a/src/main/java/forestry/core/gui/buttons/LockButtonState.java b/src/main/java/forestry/core/gui/buttons/LockButtonState.java deleted file mode 100755 index bb994af87..000000000 --- a/src/main/java/forestry/core/gui/buttons/LockButtonState.java +++ /dev/null @@ -1,44 +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.gui.buttons; - -import forestry.core.gui.tooltips.ToolTip; - -/** - * @author CovertJaguar - */ -public enum LockButtonState implements IMultiButtonState { - - UNLOCKED(new ButtonTextureSet(224, 0, 16, 16)), - LOCKED(new ButtonTextureSet(240, 0, 16, 16)); - public static final LockButtonState[] VALUES = values(); - private final IButtonTextureSet texture; - - private LockButtonState(IButtonTextureSet texture) { - this.texture = texture; - } - - @Override - public String getLabel() { - return ""; - } - - @Override - public IButtonTextureSet getTextureSet() { - return texture; - } - - @Override - public ToolTip getToolTip() { - return null; - } - -} diff --git a/src/main/java/forestry/core/gui/buttons/MultiButtonController.java b/src/main/java/forestry/core/gui/buttons/MultiButtonController.java deleted file mode 100755 index 4442297bc..000000000 --- a/src/main/java/forestry/core/gui/buttons/MultiButtonController.java +++ /dev/null @@ -1,100 +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.gui.buttons; - -import net.minecraft.nbt.NBTTagByte; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagString; - -/** - * @author CovertJaguar - */ -public class MultiButtonController { - - private int currentState; - private final T[] validStates; - - public MultiButtonController(int startState, T... validStates) { - this.currentState = startState; - this.validStates = validStates; - } - - protected MultiButtonController(MultiButtonController controller) { - this.currentState = controller.currentState; - this.validStates = controller.validStates; - } - - public MultiButtonController copy() { - return new MultiButtonController(this); - } - - public T[] getValidStates() { - return validStates; - } - - public int incrementState() { - int newState = currentState + 1; - if (newState >= validStates.length) { - newState = 0; - } - currentState = newState; - return currentState; - } - - public int decrementState() { - int newState = currentState - 1; - if (newState < 0) { - newState = validStates.length - 1; - } - currentState = newState; - return currentState; - } - - public void setCurrentState(int state) { - currentState = state; - } - - public void setCurrentState(T state) { - for (int i = 0; i < validStates.length; i++) { - if (validStates[i] == state) { - currentState = i; - return; - } - } - } - - public int getCurrentState() { - return currentState; - } - - public T getButtonState() { - return validStates[currentState]; - } - - public void writeToNBT(NBTTagCompound nbt, String tag) { - nbt.setString(tag, getButtonState().name()); - } - - public void readFromNBT(NBTTagCompound nbt, String tag) { - if (nbt.getTag(tag) instanceof NBTTagString) { - String name = nbt.getString(tag); - for (int i = 0; i < validStates.length; i++) { - if (validStates[i].name().equals(name)) { - currentState = i; - break; - } - } - } else if (nbt.getTag(tag) instanceof NBTTagByte) { - currentState = nbt.getByte(tag); - } - } - -} diff --git a/src/main/java/forestry/core/gui/buttons/StandardButtonTextureSets.java b/src/main/java/forestry/core/gui/buttons/StandardButtonTextureSets.java index 8ce3e7a6e..d4dbfa439 100755 --- a/src/main/java/forestry/core/gui/buttons/StandardButtonTextureSets.java +++ b/src/main/java/forestry/core/gui/buttons/StandardButtonTextureSets.java @@ -25,7 +25,7 @@ public enum StandardButtonTextureSets implements IButtonTextureSet { RIGHT_BUTTON_SMALL(247, 220, 12, 9); private final int x, y, height, width; - private StandardButtonTextureSets(int x, int y, int height, int width) { + StandardButtonTextureSets(int x, int y, int height, int width) { this.x = x; this.y = y; this.height = height; diff --git a/src/main/java/forestry/core/gui/slots/SlotFiltered.java b/src/main/java/forestry/core/gui/slots/SlotFiltered.java index 03a960fb6..8dee92b43 100644 --- a/src/main/java/forestry/core/gui/slots/SlotFiltered.java +++ b/src/main/java/forestry/core/gui/slots/SlotFiltered.java @@ -20,7 +20,7 @@ import forestry.core.interfaces.IFilterSlotDelegate; */ public class SlotFiltered extends SlotWatched { - protected final IFilterSlotDelegate filterSlotDelegate; + private final IFilterSlotDelegate filterSlotDelegate; public SlotFiltered(T filterSlotDelegateInventory, int slotIndex, int xPos, int yPos) { this(filterSlotDelegateInventory, filterSlotDelegateInventory, slotIndex, xPos, yPos); diff --git a/src/main/java/forestry/core/gui/slots/SlotWatched.java b/src/main/java/forestry/core/gui/slots/SlotWatched.java index 087d4a607..78a48a1b5 100644 --- a/src/main/java/forestry/core/gui/slots/SlotWatched.java +++ b/src/main/java/forestry/core/gui/slots/SlotWatched.java @@ -18,7 +18,7 @@ public abstract class SlotWatched extends SlotForestry { private ICrafter crafter; private String blockedTexture = "slots/blocked"; - public SlotWatched(IInventory inventory, int slotIndex, int xPos, int yPos) { + protected SlotWatched(IInventory inventory, int slotIndex, int xPos, int yPos) { super(inventory, slotIndex, xPos, yPos); } diff --git a/src/main/java/forestry/core/gui/widgets/SocketWidget.java b/src/main/java/forestry/core/gui/widgets/SocketWidget.java index efb0fb64f..518fa8336 100755 --- a/src/main/java/forestry/core/gui/widgets/SocketWidget.java +++ b/src/main/java/forestry/core/gui/widgets/SocketWidget.java @@ -50,7 +50,7 @@ public class SocketWidget extends Widget { return toolTip; } - protected final ToolTip toolTip = new ToolTip(500) { + private final ToolTip toolTip = new ToolTip(500) { @SuppressWarnings("unchecked") @Override public void refresh() { diff --git a/src/main/java/forestry/core/gui/widgets/TankWidget.java b/src/main/java/forestry/core/gui/widgets/TankWidget.java index e9af7d7ed..c7d2c8547 100755 --- a/src/main/java/forestry/core/gui/widgets/TankWidget.java +++ b/src/main/java/forestry/core/gui/widgets/TankWidget.java @@ -34,9 +34,9 @@ import forestry.farming.gui.ContainerFarm; */ public class TankWidget extends Widget { - protected int overlayTexX = 176; - protected int overlayTexY = 0; - protected int slot = 0; + private int overlayTexX = 176; + private int overlayTexY = 0; + private int slot = 0; public TankWidget(WidgetManager manager, int xPos, int yPos, int slot) { super(manager, xPos, yPos); diff --git a/src/main/java/forestry/core/interfaces/IBlockRenderer.java b/src/main/java/forestry/core/interfaces/IBlockRenderer.java index ad2fbbf74..eff2b7cd3 100755 --- a/src/main/java/forestry/core/interfaces/IBlockRenderer.java +++ b/src/main/java/forestry/core/interfaces/IBlockRenderer.java @@ -10,10 +10,6 @@ ******************************************************************************/ package forestry.core.interfaces; -import net.minecraft.tileentity.TileEntity; - public interface IBlockRenderer { - void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f); - - void inventoryRender(double x, double y, double z, float f, float f1); + void inventoryRender(double x, double y, double z); } diff --git a/src/main/java/forestry/core/inventory/AlyzerInventory.java b/src/main/java/forestry/core/inventory/AlyzerInventory.java index 88ede7e0c..89d2f1367 100644 --- a/src/main/java/forestry/core/inventory/AlyzerInventory.java +++ b/src/main/java/forestry/core/inventory/AlyzerInventory.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * 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 com.google.common.collect.ImmutableSet; @@ -20,11 +30,8 @@ public abstract class AlyzerInventory extends ItemInventory implements IErrorSou public static final int SLOT_ANALYZE_5 = 6; public static final int SLOT_ENERGY = 5; - protected final EntityPlayer player; - public AlyzerInventory(EntityPlayer player, int size, ItemStack itemstack) { super(player, size, itemstack); - this.player = player; } protected static boolean isEnergy(ItemStack itemstack) { @@ -35,7 +42,7 @@ public abstract class AlyzerInventory extends ItemInventory implements IErrorSou return ForestryItem.honeyDrop.isItemEqual(itemstack) || ForestryItem.honeydew.isItemEqual(itemstack); } - protected boolean hasSpecimen() { + private boolean hasSpecimen() { for (int i = SLOT_SPECIMEN; i <= SLOT_ANALYZE_5; i++) { if (i == SLOT_ENERGY) { continue; diff --git a/src/main/java/forestry/core/inventory/FakeInventoryAdapter.java b/src/main/java/forestry/core/inventory/FakeInventoryAdapter.java index 0aac42ff7..056202182 100644 --- a/src/main/java/forestry/core/inventory/FakeInventoryAdapter.java +++ b/src/main/java/forestry/core/inventory/FakeInventoryAdapter.java @@ -131,8 +131,4 @@ public class FakeInventoryAdapter implements IInventoryAdapter { } - @Override - public IInventoryAdapter configureSided(int[] sides, int[] slots) { - return this; - } } diff --git a/src/main/java/forestry/core/inventory/IInventoryAdapter.java b/src/main/java/forestry/core/inventory/IInventoryAdapter.java index 17f1e123d..4edff5e26 100644 --- a/src/main/java/forestry/core/inventory/IInventoryAdapter.java +++ b/src/main/java/forestry/core/inventory/IInventoryAdapter.java @@ -7,6 +7,4 @@ import forestry.core.interfaces.IFilterSlotDelegate; public interface IInventoryAdapter extends ISidedInventory, IFilterSlotDelegate, INBTTagable { - /* Sided */ - IInventoryAdapter configureSided(int[] sides, int[] slots); } diff --git a/src/main/java/forestry/core/inventory/InvTools.java b/src/main/java/forestry/core/inventory/InvTools.java index f82538fdc..48cddaa8a 100755 --- a/src/main/java/forestry/core/inventory/InvTools.java +++ b/src/main/java/forestry/core/inventory/InvTools.java @@ -12,24 +12,15 @@ package forestry.core.inventory; import java.util.AbstractMap; import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.TreeMap; -import net.minecraft.block.Block; -import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.oredict.OreDictionary; @@ -38,17 +29,14 @@ import cpw.mods.fml.common.Optional; import forestry.core.inventory.filters.ArrayStackFilter; import forestry.core.inventory.filters.IStackFilter; -import forestry.core.inventory.filters.InvertedStackFilter; import forestry.core.inventory.filters.StackFilter; import forestry.core.inventory.manipulators.InventoryManipulator; import forestry.core.inventory.wrappers.ChestWrapper; import forestry.core.inventory.wrappers.IInvSlot; import forestry.core.inventory.wrappers.InventoryCopy; import forestry.core.inventory.wrappers.InventoryIterator; -import forestry.core.inventory.wrappers.InventoryMapper; import forestry.core.inventory.wrappers.SidedInventoryMapper; import forestry.core.utils.AdjacentTileCache; -import forestry.core.utils.PlainInventory; import forestry.core.utils.StackUtils; import forestry.plugins.PluginManager; @@ -56,103 +44,6 @@ import buildcraft.api.transport.IPipeTile; public abstract class InvTools { - /*private static final String TAG_ID = "id"; - private static final String TAG_SIZE = "stackSize"; - private static final String TAG_DAMAGE = "Damage"; - private static final String TAG_COUNT = "Count";*/ - private static final String TAG_SLOT = "Slot"; - - public static int getXOnSide(int x, ForgeDirection side) { - return x + side.offsetX; - } - - public static int getYOnSide(int y, ForgeDirection side) { - return y + side.offsetY; - } - - public static int getZOnSide(int z, ForgeDirection side) { - return z + side.offsetZ; - } - - public static boolean blockExistsOnSide(World world, int x, int y, int z, ForgeDirection side) { - return world.blockExists(getXOnSide(x, side), getYOnSide(y, side), getZOnSide(z, side)); - } - - public static int getBlockMetadataOnSide(IBlockAccess world, int i, int j, int k, ForgeDirection side) { - return world.getBlockMetadata(getXOnSide(i, side), getYOnSide(j, side), getZOnSide(k, side)); - } - - public static Block getBlockOnSide(IBlockAccess world, int x, int y, int z, ForgeDirection side) { - return world.getBlock(getXOnSide(x, side), getYOnSide(y, side), getZOnSide(z, side)); - } - - public static TileEntity getBlockTileEntityOnSide(World world, int x, int y, int z, ForgeDirection side) { - int sx = getXOnSide(x, side); - int sy = getYOnSide(y, side); - int sz = getZOnSide(z, side); - if (world.blockExists(sx, sy, sz)) { - return world.getTileEntity(sx, sy, sz); - } - return null; - } - - public static TileEntity getBlockTileEntityOnSide(IBlockAccess world, int x, int y, int z, ForgeDirection side) { - int sx = getXOnSide(x, side); - int sy = getYOnSide(y, side); - int sz = getZOnSide(z, side); - return world.getTileEntity(sx, sy, sz); - } - - public static List getAdjacentInventories(World world, int i, int j, int k) { - return getAdjacentInventories(world, i, j, k, null); - } - - public static List getAdjacentInventories(World world, int i, int j, int k, Class type) { - List list = new ArrayList(5); - for (int side = 0; side < 6; side++) { - IInventory inv = getInventoryFromSide(world, i, j, k, ForgeDirection.getOrientation(side), type, null); - if (inv != null) { - list.add(inv); - } - } - return list; - } - - public static Map getAdjacentInventoryMap(World world, int i, int j, int k) { - return getAdjacentInventoryMap(world, i, j, k, null); - } - - public static Map getAdjacentInventoryMap(World world, int i, int j, int k, Class type) { - Map map = new TreeMap(); - for (int side = 0; side < 6; side++) { - IInventory inv = getInventoryFromSide(world, i, j, k, ForgeDirection.getOrientation(side), type, null); - if (inv != null) { - map.put(side, inv); - } - } - return map; - } - - public static IInventory getInventoryFromSide(World world, int x, int y, int z, ForgeDirection side, final Class type, final Class exclude) { - return getInventoryFromSide(world, x, y, z, side, new ITileFilter() { - @Override - public boolean matches(TileEntity tile) { - if (type != null && !type.isAssignableFrom(tile.getClass())) { - return false; - } - return !(exclude != null && exclude.isAssignableFrom(tile.getClass())); - } - }); - } - - public static IInventory getInventoryFromSide(World world, int x, int y, int z, ForgeDirection side, ITileFilter filter) { - TileEntity tile = getBlockTileEntityOnSide(world, x, y, z, side); - if (tile == null || !(tile instanceof IInventory) || !filter.matches(tile)) { - return null; - } - return getInventoryFromTile(tile, side.getOpposite()); - } - public static IInventory getInventoryFromTile(TileEntity tile, ForgeDirection side) { if (tile == null || !(tile instanceof IInventory)) { return null; @@ -175,32 +66,6 @@ public abstract class InvTools { return inv; } - public static int[] buildSlotArray(int start, int size) { - int[] slots = new int[size]; - for (int i = 0; i < size; i++) { - slots[i] = start + i; - } - return slots; - } - - /*public static void addItemToolTip(ItemStack stack, String tag, String msg) { - NBTTagCompound nbt = getItemData(stack); - NBTTagCompound display = nbt.getCompoundTag("display"); - nbt.setTag("display", display); - NBTTagList lore = display.getTagList("Lore", 8); // 8 = String - display.setTag("Lore", lore); - //lore.appendTag(new NBTTagString(tag, msg)); - lore.appendTag(new NBTTagString(msg)); - }*/ - public static NBTTagCompound getItemData(ItemStack stack) { - NBTTagCompound nbt = stack.getTagCompound(); - if (nbt == null) { - nbt = new NBTTagCompound(); - stack.setTagCompound(nbt); - } - return nbt; - } - public static ItemStack depleteItem(ItemStack stack) { if (stack.stackSize == 1) { return stack.getItem().getContainerItem(stack); @@ -210,289 +75,6 @@ public abstract class InvTools { } } - public static ItemStack damageItem(ItemStack stack, int damage) { - if (!stack.isItemStackDamageable()) { - return stack; - } - int curDamage = stack.getItemDamage(); - curDamage += damage; - stack.setItemDamage(curDamage); - if (stack.getItemDamage() > stack.getMaxDamage()) { - stack.stackSize--; - stack.setItemDamage(0); - } - if (stack.stackSize <= 0) { - stack = null; - } - return stack; - } - - public static void dropItem(ItemStack stack, World world, double x, double y, double z) { - if (stack == null || stack.stackSize < 1) { - return; - } - EntityItem entityItem = new EntityItem(world, x, y + 1.5, z, stack); - entityItem.delayBeforeCanPickup = 10; - world.spawnEntityInWorld(entityItem); - } - - public static boolean isInventoryEmpty(IInventory inv, ForgeDirection side) { - return isInventoryEmpty(getInventory(inv, side)); - } - - public static boolean isInventoryEmpty(IInventory inv) { - ItemStack stack = null; - for (IInvSlot slot : InventoryIterator.getIterable(inv)) { - stack = slot.getStackInSlot(); - if (stack != null) { - break; - } - } - return stack == null; - } - - public static boolean isInventoryFull(IInventory inv, ForgeDirection side) { - return isInventoryFull(getInventory(inv, side)); - } - - public static boolean isInventoryFull(IInventory inv) { - ItemStack stack = null; - for (IInvSlot slot : InventoryIterator.getIterable(inv)) { - stack = slot.getStackInSlot(); - if (stack == null) { - break; - } - } - return stack != null; - } - - /** - * Counts the number of items. - */ - public static int countItems(IInventory inv) { - int count = 0; - for (IInvSlot slot : InventoryIterator.getIterable(inv)) { - ItemStack stack = slot.getStackInSlot(); - if (stack != null) { - count += stack.stackSize; - } - } - return count; - } - - public static int countItems(IInventory inv, IStackFilter filter) { - int count = 0; - for (IInvSlot slot : InventoryIterator.getIterable(inv)) { - ItemStack stack = slot.getStackInSlot(); - if (stack != null && filter.matches(stack)) { - count += stack.stackSize; - } - } - return count; - } - - public static boolean numItemsMoreThan(IInventory inv, int amount) { - int count = 0; - for (IInvSlot slot : InventoryIterator.getIterable(inv)) { - ItemStack stack = slot.getStackInSlot(); - if (stack != null) { - count += stack.stackSize; - } - if (count >= amount) { - return true; - } - } - return false; - } - - /** - * Counts the number of items that match the filter. Ignores - * ISidedInventory, and bypasses InventoryMapper to - * count from the base IInventory. - */ - public static int countItems(IInventory inv, ItemStack... filters) { - if (inv instanceof InventoryMapper) { - inv = ((InventoryMapper) inv).getBaseInventory(); - } - boolean hasFilter = false; - for (ItemStack filter : filters) { - if (filter != null) { - hasFilter = true; - break; - } - } - - if (!hasFilter) { - return countItems(inv); - } - - int count = 0; - for (IInvSlot slot : InventoryIterator.getIterable(inv)) { - ItemStack stack = slot.getStackInSlot(); - if (stack != null) { - for (ItemStack filter : filters) { - if (filter != null && isItemEqual(stack, filter)) { - count += stack.stackSize; - break; - } - } - } - } - return count; - } - - public static int countItems(Iterable inventories, ItemStack... filter) { - int count = 0; - for (IInventory inv : inventories) { - count += InvTools.countItems(inv, filter); - } - return count; - } - - /** - * Returns true if the inventory contains the specified item. - * - * @param inv The IIinventory to check - * @param item The ItemStack to look for - * @return true is exists - */ - public static boolean containsItem(IInventory inv, ItemStack item) { - return countItems(inv, item) > 0; - } - - /** - * Returns a map backed by an - * ItemStackMap that lists the total number of each type of - * item in the inventory. - * - * @param inv The IInventory to generate the manifest for - * @return A Map that lists how many of each item is in * * * - * the IInventory - * @see ItemStackMap - */ - public static Map getManifest(IInventory inv) { - Map manifest = new ItemStackMap(); - for (int i = 0; i < inv.getSizeInventory(); i++) { - ItemStack slot = inv.getStackInSlot(i); - if (slot != null) { - Integer count = manifest.get(slot); - if (count == null) { - count = 0; - } - count += slot.stackSize; - manifest.put(slot, count); - } - } - return manifest; - } - - /** - * Attempts to move a single item from one inventory to another. - * - * @return null if nothing was moved, the stack moved otherwise - */ - public static ItemStack moveOneItem(IInventory source, IInventory dest) { - return moveOneItem(source, dest, StackFilter.ALL); - } - - /** - * Attempts to move a single item from one inventory to another. - * - * @param filters an ItemStack[] to match against - * @return null if nothing was moved, the stack moved otherwise - */ - public static ItemStack moveOneItem(IInventory source, IInventory dest, ItemStack... filters) { - return moveOneItem(source, dest, new ArrayStackFilter(filters)); - } - - /** - * Attempts to move a single item from one inventory to another. - * - * @param filter an IItemType to match against - * @return null if nothing was moved, the stack moved otherwise - */ - public static ItemStack moveOneItem(IInventory source, IInventory dest, IStackFilter filter) { - InventoryManipulator imSource = InventoryManipulator.get(source); - return imSource.moveItem(dest, filter); - } - - /** - * Attempts to move one item from a collection of inventories. - */ - public static ItemStack moveOneItem(Iterable sources, IInventory dest, ItemStack... filters) { - for (IInventory inv : sources) { - ItemStack moved = InvTools.moveOneItem(inv, dest, filters); - if (moved != null) { - return moved; - } - } - return null; - } - - /** - * Attempts to move one item from a collection of inventories. - */ - public static ItemStack moveOneItem(Iterable sources, IInventory dest, IStackFilter filter) { - for (IInventory inv : sources) { - ItemStack moved = InvTools.moveOneItem(inv, dest, filter); - if (moved != null) { - return moved; - } - } - return null; - } - - /** - * Attempts to move one item to a collection of inventories. - */ - public static ItemStack moveOneItem(IInventory source, Iterable destinations, ItemStack... filters) { - for (IInventory dest : destinations) { - ItemStack moved = InvTools.moveOneItem(source, dest, filters); - if (moved != null) { - return moved; - } - } - return null; - } - - /** - * Attempts to move a single item from one inventory to another. - * - * Will not move any items in the filter. - * - * @param filters an ItemStack[] to exclude - * @return null if nothing was moved, the stack moved otherwise - */ - public static ItemStack moveOneItemExcept(IInventory source, IInventory dest, ItemStack... filters) { - return moveOneItem(source, dest, new InvertedStackFilter(new ArrayStackFilter(filters))); - } - - /** - * Attempts to move one item from a collection of inventories. - */ - public static ItemStack moveOneItemExcept(Iterable sources, IInventory dest, ItemStack... filters) { - for (IInventory inv : sources) { - ItemStack moved = InvTools.moveOneItemExcept(inv, dest, filters); - if (moved != null) { - return moved; - } - } - return null; - } - - /** - * Attempts to move one item to a collection of inventories. - */ - public static ItemStack moveOneItemExcept(IInventory source, Iterable destinations, ItemStack... filters) { - for (IInventory dest : destinations) { - ItemStack moved = InvTools.moveOneItemExcept(source, dest, filters); - if (moved != null) { - return moved; - } - } - return null; - } - public static boolean isWildcard(ItemStack stack) { return isWildcard(stack.getItemDamage()); } @@ -537,39 +119,6 @@ public abstract class InvTools { return true; } - /** - * A more robust item comparison function. - * - * Compares stackSize as well. - * - * Two null stacks will return true, unlike the other functions. - * - * This function is primarily intended to be used to track changes to an - * ItemStack. - * - * @param a An ItemStack - * @param b An ItemStack - * @return True if equal - */ - public static boolean isItemEqualSemiStrict(ItemStack a, ItemStack b) { - if (a == null && b == null) { - return true; - } - if (a == null || b == null) { - return false; - } - if (a.getItem() != b.getItem()) { - return false; - } - if (a.getItemDamage() != b.getItemDamage()) { - return false; - } - if (a.stackTagCompound != null && !a.stackTagCompound.equals(b.stackTagCompound)) { - return false; - } - return true; - } - /** * A more robust item comparison function. Supports items with damage = -1 * matching any sub-type. @@ -582,18 +131,6 @@ public abstract class InvTools { return isItemEqual(a, b, true, true); } - /** - * A more robust item comparison function. Supports items with damage = -1 - * matching any sub-type. - * - * @param a An ItemStack - * @param b An ItemStack - * @return True if equal - */ - public static boolean isItemEqualIgnoreNBT(ItemStack a, ItemStack b) { - return isItemEqual(a, b, true, false); - } - public static boolean isItemEqual(final ItemStack a, final ItemStack b, final boolean matchDamage, final boolean matchNBT) { if (a == null || b == null) { return false; @@ -627,18 +164,6 @@ public abstract class InvTools { return false; } - /** - * Returns true if the item is equal to any one of several possible matches. - */ - public static boolean isItemEqual(ItemStack stack, Collection matches) { - for (ItemStack match : matches) { - if (isItemEqual(stack, match)) { - return true; - } - } - return false; - } - /** * Places an ItemStack in a destination IInventory. Will attempt to move as * much of the stack as possible, returning any remainder. @@ -689,54 +214,6 @@ public abstract class InvTools { return false; } - /** - * Checks if there is room for the ItemStack in the inventory. - * - * @param stack The ItemStack - * @param dest The IInventory - * @return true if room for stack - */ - public static boolean isRoomForStack(ItemStack stack, IInventory dest) { - if (stack == null || dest == null) { - return false; - } - InventoryManipulator im = InventoryManipulator.get(dest); - return im.canAddStack(stack); - } - - /** - * Removes a up to numItems worth of items from the inventory, not caring - * about what the items are. - */ - public static ItemStack[] removeItems(IInventory inv, int numItems) { - PlainInventory output = new PlainInventory(27, "temp"); - for (int i = 0; i < inv.getSizeInventory(); i++) { - if (numItems <= 0) { - break; - } - ItemStack slot = inv.getStackInSlot(i); - if (slot == null) { - continue; - } - ItemStack removed = inv.decrStackSize(i, numItems); - numItems -= removed.stackSize; - ItemStack remainder = moveItemStack(removed, output); - if (remainder != null) { - moveItemStack(remainder, inv); - numItems += remainder.stackSize; - break; - } - } - - List list = new LinkedList(); - for (ItemStack stack : output.getContents()) { - if (stack != null) { - list.add(stack); - } - } - return list.toArray(new ItemStack[list.size()]); - } - /** * Removes and returns a single item from the inventory. * @@ -772,24 +249,6 @@ public abstract class InvTools { return im.removeItem(filter); } - /** - * Removes and returns a single item from the inventory that matches the - * filter. - * - * @param invs The inventory - * @param filter EnumItemType to match against - * @return An ItemStack - */ - public static ItemStack removeOneItem(Iterable invs, IStackFilter filter) { - for (IInventory inv : invs) { - ItemStack stack = removeOneItem(inv, filter); - if (stack != null) { - return stack; - } - } - return null; - } - /** * Attempts to move a single item from the source inventory into a adjacent Buildcraft pipe. * If the attempt fails, the source Inventory will not be modified. @@ -849,51 +308,6 @@ public abstract class InvTools { return false; } - public static void writeInvToNBT(IInventory inv, String tag, NBTTagCompound data) { - NBTTagList list = new NBTTagList(); - for (byte slot = 0; slot < inv.getSizeInventory(); slot++) { - ItemStack stack = inv.getStackInSlot(slot); - if (stack != null) { - NBTTagCompound itemTag = new NBTTagCompound(); - itemTag.setByte(TAG_SLOT, slot); - writeItemToNBT(stack, itemTag); - list.appendTag(itemTag); - } - } - data.setTag(tag, list); - } - - public static void readInvFromNBT(IInventory inv, String tag, NBTTagCompound data) { - NBTTagList list = data.getTagList(tag, 10); - for (byte entry = 0; entry < list.tagCount(); entry++) { - NBTTagCompound itemTag = list.getCompoundTagAt(entry); - int slot = itemTag.getByte(TAG_SLOT); - if (slot >= 0 && slot < inv.getSizeInventory()) { - ItemStack stack = ItemStack.loadItemStackFromNBT(itemTag); - inv.setInventorySlotContents(slot, stack); - } - } - } - - public static void writeItemToNBT(ItemStack stack, NBTTagCompound data) { - if (stack == null || stack.stackSize <= 0) { - return; - } - if (stack.stackSize > 127) { - stack.stackSize = 127; - } - stack.writeToNBT(data); - } - - public static IInventoryAdapter configureSided(IInventoryAdapter inventory, int[] sides, int startSlot, int count) { - int[] slots = new int[count]; - for (int i = 0; i < count; i++) { - slots[i] = startSlot + i; - } - - return inventory.configureSided(sides, slots); - } - /* REMOVAL */ /** @@ -957,10 +371,6 @@ public abstract class InvTools { } /* CONTAINS */ - public static boolean contains(IInventory inventory, ItemStack query, int startSlot, int slots) { - ItemStack[] queryArray = new ItemStack[]{query}; - return contains(inventory, queryArray, startSlot, slots); - } public static boolean contains(IInventory inventory, ItemStack[] query) { return contains(inventory, query, 0, inventory.getSizeInventory()); @@ -993,21 +403,6 @@ public abstract class InvTools { return ((float) amount / (float) stackMax) >= percent; } - public static boolean containsAmount(IInventory inventory, int amount, int slot1, int length) { - int total = 0; - for (ItemStack itemStack : getStacks(inventory, slot1, length)) { - if (itemStack == null) { - continue; - } - - total += itemStack.stackSize; - if (total >= amount) { - return true; - } - } - return false; - } - public static ItemStack[] getStacks(IInventory inventory) { ItemStack[] stacks = new ItemStack[inventory.getSizeInventory()]; for (int i = 0; i < inventory.getSizeInventory(); i++) { @@ -1024,10 +419,6 @@ public abstract class InvTools { return result; } - public static boolean tryAddStacksCopy(IInventory inventory, ItemStack[] stacks, boolean all) { - return tryAddStacksCopy(inventory, stacks, 0, inventory.getSizeInventory(), all); - } - public static boolean tryAddStacksCopy(IInventory inventory, ItemStack[] stacks, int startSlot, int slots, boolean all) { for (ItemStack stack : stacks) { @@ -1043,22 +434,6 @@ public abstract class InvTools { return true; } - public static boolean tryAddStacks(IInventory inventory, ItemStack[] stacks, boolean all) { - - boolean addedAll = true; - for (ItemStack stack : stacks) { - if (stack == null) { - continue; - } - - if (!tryAddStack(inventory, stack, all)) { - addedAll = false; - } - } - - return addedAll; - } - public static boolean tryAddStack(IInventory inventory, ItemStack stack, boolean all) { return tryAddStack(inventory, stack, 0, inventory.getSizeInventory(), all, true); } diff --git a/src/main/java/forestry/core/inventory/InventoryAdapter.java b/src/main/java/forestry/core/inventory/InventoryAdapter.java index e5ec2d667..ea1ebc624 100755 --- a/src/main/java/forestry/core/inventory/InventoryAdapter.java +++ b/src/main/java/forestry/core/inventory/InventoryAdapter.java @@ -160,16 +160,16 @@ public class InventoryAdapter implements IInventoryAdapter, IStreamable { private void configureSided() { slotMap = new int[6][0]; - InvTools.configureSided(this, Defaults.FACINGS, 0, getSizeInventory()); - } - @Override - public InventoryAdapter configureSided(int[] sides, int[] slots) { - for (int side : sides) { - slotMap[side] = slots; + int count = getSizeInventory(); + int[] slots = new int[count]; + for (int i = 0; i < count; i++) { + slots[i] = i; } - return this; + for (int side : Defaults.FACINGS) { + slotMap[side] = slots; + } } @Override diff --git a/src/main/java/forestry/core/inventory/ItemStackMap.java b/src/main/java/forestry/core/inventory/ItemStackMap.java deleted file mode 100755 index 681e26994..000000000 --- a/src/main/java/forestry/core/inventory/ItemStackMap.java +++ /dev/null @@ -1,197 +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.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import net.minecraft.item.ItemStack; - -/** - * This is a custom data structure designed specifically - * for using ItemStacks as keys in a Map. - * - * The keys index on the itemID and damage of the ItemStacks, - * ignoring any other differences (NBT Tags, stackSize, etc...). - * - * @param - * @author CovertJaguar - * @see Map - */ -public class ItemStackMap implements Map { - - private class EntryWrapper implements Map.Entry { - - private final Map.Entry entry; - - public EntryWrapper(Map.Entry e) { - entry = e; - } - - @Override - public ItemStack getKey() { - return entry.getKey().getStack(); - } - - @Override - public V getValue() { - return entry.getValue(); - } - - @Override - public V setValue(V value) { - return entry.setValue(value); - } - - @Override - public String toString() { - return getKey().getItem().getUnlocalizedName() + "=" + getValue().toString(); - } - } - - private static class KeyWrapper { - - private final ItemStack stack; - - public KeyWrapper(ItemStack stack) { - this.stack = stack.copy(); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final KeyWrapper other = (KeyWrapper) obj; - if (stack.getItem() != other.stack.getItem()) { - return false; - } - if (stack.getItemDamage() != other.stack.getItemDamage()) { - return false; - } - return true; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 23 * hash + stack.getItem().hashCode(); - hash = 23 * hash + stack.getItemDamage(); - return hash; - } - - public ItemStack getStack() { - return stack.copy(); - } - } - - private final Map map = new HashMap(); - - @Override - public V put(ItemStack stack, V value) { - return map.put(new KeyWrapper(stack), value); - } - - @Override - public Collection values() { - return map.values(); - } - - @Override - public int size() { - return map.size(); - } - - @Override - public V remove(Object key) { - if (key instanceof ItemStack) { - return map.remove(new KeyWrapper((ItemStack) key)); - } - return null; - } - - @Override - public boolean isEmpty() { - return map.isEmpty(); - } - - @Override - public int hashCode() { - return map.hashCode(); - } - - @Override - public V get(Object key) { - if (key instanceof ItemStack) { - return map.get(new KeyWrapper((ItemStack) key)); - } - return null; - } - - @SuppressWarnings("unchecked") - @Override - public boolean equals(Object o) { - if (o instanceof ItemStackMap) { - return map.equals(((ItemStackMap) o).map); - } - return false; - } - - @Override - public boolean containsValue(Object value) { - return map.containsValue(value); - } - - @Override - public boolean containsKey(Object key) { - if (key instanceof ItemStack) { - return map.containsKey(new KeyWrapper((ItemStack) key)); - } - return false; - } - - @Override - public void clear() { - map.clear(); - } - - @Override - public void putAll(Map m) { - for (Map.Entry e : m.entrySet()) { - put(e.getKey(), e.getValue()); - } - } - - @Override - public Set keySet() { - Set keySet = new HashSet(); - for (KeyWrapper w : map.keySet()) { - keySet.add(w.getStack()); - } - return keySet; - } - - @Override - public Set> entrySet() { - Set> entrySet = new HashSet>(); - - for (Map.Entry entry : map.entrySet()) { - entrySet.add(new EntryWrapper(entry)); - } - return entrySet; - } -} diff --git a/src/main/java/forestry/core/inventory/filters/ArrayStackFilter.java b/src/main/java/forestry/core/inventory/filters/ArrayStackFilter.java index 9e9a7fb3a..f64a1c08f 100755 --- a/src/main/java/forestry/core/inventory/filters/ArrayStackFilter.java +++ b/src/main/java/forestry/core/inventory/filters/ArrayStackFilter.java @@ -37,7 +37,7 @@ public class ArrayStackFilter implements IStackFilter { return stacks; } - public boolean hasFilter() { + private boolean hasFilter() { for (ItemStack filter : stacks) { if (filter != null) { return true; diff --git a/src/main/java/forestry/core/items/ItemArmorNaturalist.java b/src/main/java/forestry/core/items/ItemArmorNaturalist.java index 73db02f57..e5809aad3 100755 --- a/src/main/java/forestry/core/items/ItemArmorNaturalist.java +++ b/src/main/java/forestry/core/items/ItemArmorNaturalist.java @@ -28,8 +28,8 @@ import forestry.core.utils.StringUtil; public class ItemArmorNaturalist extends ItemArmor implements IArmorNaturalist { - public ItemArmorNaturalist(int slot) { - super(ArmorMaterial.CLOTH, 0, slot); + public ItemArmorNaturalist() { + super(ArmorMaterial.CLOTH, 0, 0); this.setMaxDamage(100); setCreativeTab(CreativeTabForestry.tabForestry); } diff --git a/src/main/java/forestry/core/items/ItemForestry.java b/src/main/java/forestry/core/items/ItemForestry.java index 639ceb392..45306d8d5 100755 --- a/src/main/java/forestry/core/items/ItemForestry.java +++ b/src/main/java/forestry/core/items/ItemForestry.java @@ -33,8 +33,8 @@ public class ItemForestry extends Item { setCreativeTab(CreativeTabForestry.tabForestry); } - public ItemForestry setBonemeal(boolean isBonemeal) { - this.isBonemeal = isBonemeal; + public ItemForestry setBonemeal() { + this.isBonemeal = true; return this; } diff --git a/src/main/java/forestry/core/items/ItemForestryTool.java b/src/main/java/forestry/core/items/ItemForestryTool.java index 30e777318..4b908766b 100755 --- a/src/main/java/forestry/core/items/ItemForestryTool.java +++ b/src/main/java/forestry/core/items/ItemForestryTool.java @@ -26,13 +26,13 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import forestry.core.proxy.Proxies; -public class ItemForestryTool extends ItemForestry { +public abstract class ItemForestryTool extends ItemForestry { private final ItemStack remnants; protected float efficiencyOnProperMaterial; private final List blocksEffectiveAgainst; - public ItemForestryTool(Block[] blocksEffectiveAgainst, ItemStack remnants) { + protected ItemForestryTool(Block[] blocksEffectiveAgainst, ItemStack remnants) { super(); this.blocksEffectiveAgainst = Arrays.asList(blocksEffectiveAgainst); this.maxStackSize = 1; diff --git a/src/main/java/forestry/core/items/ItemFruit.java b/src/main/java/forestry/core/items/ItemFruit.java index dfca66579..2467964d2 100755 --- a/src/main/java/forestry/core/items/ItemFruit.java +++ b/src/main/java/forestry/core/items/ItemFruit.java @@ -29,13 +29,13 @@ import forestry.core.render.TextureManager; public class ItemFruit extends ItemForestryFood { - public static enum EnumFruit { + public enum EnumFruit { CHERRY("cropCherry"), WALNUT("cropWalnut"), CHESTNUT("cropChestnut"), LEMON("cropLemon"), PLUM("cropPlum"), DATES("cropDate"), PAPAYA("cropPapaya");//, COCONUT("cropCoconut"); public static final EnumFruit[] VALUES = values(); final String oreDict; - private EnumFruit(String oreDict) { + EnumFruit(String oreDict) { this.oreDict = oreDict; } diff --git a/src/main/java/forestry/core/items/ItemLiquidContainer.java b/src/main/java/forestry/core/items/ItemLiquidContainer.java index a07b856d5..ac5097bf7 100755 --- a/src/main/java/forestry/core/items/ItemLiquidContainer.java +++ b/src/main/java/forestry/core/items/ItemLiquidContainer.java @@ -46,7 +46,7 @@ import forestry.core.render.TextureManager; public class ItemLiquidContainer extends Item { - public static enum EnumContainerType { + public enum EnumContainerType { GLASS, JAR, CAN, CAPSULE, REFRACTORY, BUCKET } @@ -78,7 +78,7 @@ public class ItemLiquidContainer extends Item { return buckets.get(contents); } - private int getMatchingSlot(EntityPlayer player, ItemStack stack) { + private static int getMatchingSlot(EntityPlayer player, ItemStack stack) { for (int slot = 0; slot < player.inventory.mainInventory.length; slot++) { ItemStack slotStack = player.inventory.getStackInSlot(slot); @@ -107,7 +107,7 @@ public class ItemLiquidContainer extends Item { } itemstack.stackSize--; - entityplayer.getFoodStats().addStats(this.getHealAmount(), this.getSaturationModifier()); + entityplayer.getFoodStats().addStats(healAmount, saturationModifier); world.playSoundAtEntity(entityplayer, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F); /* * if (!world.isRemote && potionId > 0 && world.rand.nextFloat() < potionEffectProbability) entityplayer.addPotionEffect(new PotionEffect(potionId, @@ -299,15 +299,6 @@ public class ItemLiquidContainer extends Item { } } - - public int getHealAmount() { - return healAmount; - } - - public float getSaturationModifier() { - return saturationModifier; - } - public ItemLiquidContainer setDrink(int healAmount, float saturationModifier) { isDrink = true; this.healAmount = healAmount; diff --git a/src/main/java/forestry/core/items/ItemPipette.java b/src/main/java/forestry/core/items/ItemPipette.java index 26a79cd37..a983b2d28 100755 --- a/src/main/java/forestry/core/items/ItemPipette.java +++ b/src/main/java/forestry/core/items/ItemPipette.java @@ -53,12 +53,12 @@ public class ItemPipette extends ItemForestry implements IToolPipette { } } - public boolean isFull(int limit) { + public boolean isFull() { if (contents == null) { return false; } - return contents.getFluid().getID() > 0 && contents.amount >= limit; + return contents.getFluid().getID() > 0 && contents.amount >= 1000; } public void addTooltip(List list) { @@ -90,7 +90,7 @@ public class ItemPipette extends ItemForestry implements IToolPipette { @Override public boolean canPipette(ItemStack itemstack) { PipetteContents contained = new PipetteContents(itemstack.getTagCompound()); - return !contained.isFull(1000); + return !contained.isFull(); } @Override diff --git a/src/main/java/forestry/core/multiblock/CoordTriplet.java b/src/main/java/forestry/core/multiblock/CoordTriplet.java index 30e6b7ca5..0f91e3682 100644 --- a/src/main/java/forestry/core/multiblock/CoordTriplet.java +++ b/src/main/java/forestry/core/multiblock/CoordTriplet.java @@ -1,5 +1,7 @@ package forestry.core.multiblock; +import javax.annotation.Nonnull; + import net.minecraft.world.ChunkCoordIntPair; import net.minecraftforge.common.util.ForgeDirection; @@ -69,21 +71,10 @@ public class CoordTriplet implements Comparable { this.z = other.z; } - public CoordTriplet[] getNeighbors() { - return new CoordTriplet[]{ - new CoordTriplet(x + 1, y, z), - new CoordTriplet(x - 1, y, z), - new CoordTriplet(x, y + 1, z), - new CoordTriplet(x, y - 1, z), - new CoordTriplet(x, y, z + 1), - new CoordTriplet(x, y, z - 1) - }; - } - ///// IComparable @Override - public int compareTo(Object o) { + public int compareTo(@Nonnull Object o) { if (o instanceof CoordTriplet) { CoordTriplet other = (CoordTriplet) o; if (this.x < other.x) { @@ -105,44 +96,6 @@ public class CoordTriplet implements Comparable { return 0; } - ///// Really confusing code that should be cleaned up - - public ForgeDirection getDirectionFromSourceCoords(int x, int y, int z) { - if (this.x < x) { - return ForgeDirection.WEST; - } else if (this.x > x) { - return ForgeDirection.EAST; - } else if (this.y < y) { - return ForgeDirection.DOWN; - } else if (this.y > y) { - return ForgeDirection.UP; - } else if (this.z < z) { - return ForgeDirection.SOUTH; - } else if (this.z > z) { - return ForgeDirection.NORTH; - } else { - return ForgeDirection.UNKNOWN; - } - } - - public ForgeDirection getOppositeDirectionFromSourceCoords(int x, int y, int z) { - if (this.x < x) { - return ForgeDirection.EAST; - } else if (this.x > x) { - return ForgeDirection.WEST; - } else if (this.y < y) { - return ForgeDirection.UP; - } else if (this.y > y) { - return ForgeDirection.DOWN; - } else if (this.z < z) { - return ForgeDirection.NORTH; - } else if (this.z > z) { - return ForgeDirection.SOUTH; - } else { - return ForgeDirection.UNKNOWN; - } - } - @Override public String toString() { return String.format("(%d, %d, %d)", this.x, this.y, this.z); diff --git a/src/main/java/forestry/core/multiblock/MultiblockControllerBase.java b/src/main/java/forestry/core/multiblock/MultiblockControllerBase.java index 81dca9b66..e4a0495ea 100644 --- a/src/main/java/forestry/core/multiblock/MultiblockControllerBase.java +++ b/src/main/java/forestry/core/multiblock/MultiblockControllerBase.java @@ -469,7 +469,6 @@ public abstract class MultiblockControllerBase implements ISidedInventory, IRest throw new IllegalArgumentException("The controller with the lowest minimum-coord value must consume the one with the higher coords"); } - TileEntity te; Set partsToAcquire = new HashSet(other.connectedParts); // releases all blocks and references gently so they can be incorporated into another multiblock @@ -834,7 +833,6 @@ public abstract class MultiblockControllerBase implements ISidedInventory, IRest return null; } - TileEntity te; IChunkProvider chunkProvider = worldObj.getChunkProvider(); // Invalidate our reference coord, we'll recalculate it shortly @@ -889,7 +887,6 @@ public abstract class MultiblockControllerBase implements ISidedInventory, IRest // Now visit all connected parts, breadth-first, starting from reference coord's part IMultiblockPart part; LinkedList partsToCheck = new LinkedList(); - IMultiblockPart[] nearbyParts = null; int visitedParts = 0; partsToCheck.add(referencePart); @@ -899,7 +896,7 @@ public abstract class MultiblockControllerBase implements ISidedInventory, IRest part.setVisited(); visitedParts++; - nearbyParts = part.getNeighboringParts(); // Chunk-safe on server, but not on client + IMultiblockPart[] nearbyParts = part.getNeighboringParts(); // Chunk-safe on server, but not on client for (IMultiblockPart nearbyPart : nearbyParts) { // Ignore different machines if (nearbyPart.getMultiblockController() != this) { diff --git a/src/main/java/forestry/core/multiblock/MultiblockRegistry.java b/src/main/java/forestry/core/multiblock/MultiblockRegistry.java index 19e689d9d..472fefcf7 100644 --- a/src/main/java/forestry/core/multiblock/MultiblockRegistry.java +++ b/src/main/java/forestry/core/multiblock/MultiblockRegistry.java @@ -1,6 +1,7 @@ package forestry.core.multiblock; import java.util.HashMap; +import java.util.Map; import java.util.Set; import net.minecraft.world.World; @@ -14,7 +15,7 @@ import forestry.core.proxy.Proxies; */ public class MultiblockRegistry { // World > WorldRegistry map - private static HashMap registries = new HashMap(); + private static final Map registries = new HashMap(); /** * Called before Tile Entities are ticked in the world. Do bookkeeping here. diff --git a/src/main/java/forestry/core/multiblock/MultiblockWorldRegistry.java b/src/main/java/forestry/core/multiblock/MultiblockWorldRegistry.java index 62a12ecc2..577c1d55f 100644 --- a/src/main/java/forestry/core/multiblock/MultiblockWorldRegistry.java +++ b/src/main/java/forestry/core/multiblock/MultiblockWorldRegistry.java @@ -143,7 +143,6 @@ public class MultiblockWorldRegistry { // THIS IS THE ONLY PLACE WHERE MERGES ARE DETECTED // Multiple compatible controllers indicates an impending merge. // Locate the appropriate merge pool(s) - boolean hasAddedToPool = false; List> candidatePools = new ArrayList>(); for (Set candidatePool : mergePools) { if (!Collections.disjoint(candidatePool, compatibleControllers)) { @@ -208,13 +207,12 @@ public class MultiblockWorldRegistry { // Any controllers which have had parts removed must be checked to see if some parts are no longer // physically connected to their master. if (dirtyControllers.size() > 0) { - Set newlyDetachedParts = null; for (MultiblockControllerBase controller : dirtyControllers) { // Tell the machine to check if any parts are disconnected. // It should return a set of parts which are no longer connected. // POSTCONDITION: The controller must have informed those parts that // they are no longer connected to this machine. - newlyDetachedParts = controller.checkForDisconnections(); + Set newlyDetachedParts = controller.checkForDisconnections(); if (!controller.isEmpty()) { controller.recalculateMinMaxCoords(); diff --git a/src/main/java/forestry/core/network/ForestryPacket.java b/src/main/java/forestry/core/network/ForestryPacket.java index e96949574..dd8c69f52 100755 --- a/src/main/java/forestry/core/network/ForestryPacket.java +++ b/src/main/java/forestry/core/network/ForestryPacket.java @@ -22,7 +22,7 @@ public class ForestryPacket { protected static final String channel = "FOR"; private final PacketId id; - public ForestryPacket(DataInputStreamForestry data) throws IOException { + protected ForestryPacket(DataInputStreamForestry data) throws IOException { this.id = PacketId.INVALID; readData(data); } diff --git a/src/main/java/forestry/core/network/PacketErrorUpdate.java b/src/main/java/forestry/core/network/PacketErrorUpdate.java index 6cf42b0e0..684176b68 100644 --- a/src/main/java/forestry/core/network/PacketErrorUpdate.java +++ b/src/main/java/forestry/core/network/PacketErrorUpdate.java @@ -26,7 +26,7 @@ public class PacketErrorUpdate extends PacketCoordinates { new PacketErrorUpdate(data); } - public PacketErrorUpdate(DataInputStreamForestry data) throws IOException { + private PacketErrorUpdate(DataInputStreamForestry data) throws IOException { super(data); } diff --git a/src/main/java/forestry/core/network/PacketGuiEnergy.java b/src/main/java/forestry/core/network/PacketGuiEnergy.java index 3d7b5b259..5ad650c85 100644 --- a/src/main/java/forestry/core/network/PacketGuiEnergy.java +++ b/src/main/java/forestry/core/network/PacketGuiEnergy.java @@ -27,7 +27,7 @@ public class PacketGuiEnergy extends ForestryPacket { new PacketGuiEnergy(data); } - public PacketGuiEnergy(DataInputStreamForestry data) throws IOException { + private PacketGuiEnergy(DataInputStreamForestry data) throws IOException { super(data); } diff --git a/src/main/java/forestry/core/network/PacketItemStackDisplay.java b/src/main/java/forestry/core/network/PacketItemStackDisplay.java index 046ef8a83..f1ed1fec5 100644 --- a/src/main/java/forestry/core/network/PacketItemStackDisplay.java +++ b/src/main/java/forestry/core/network/PacketItemStackDisplay.java @@ -27,7 +27,7 @@ public class PacketItemStackDisplay extends PacketCoordinates { new PacketItemStackDisplay(data); } - public PacketItemStackDisplay(DataInputStreamForestry data) throws IOException { + private PacketItemStackDisplay(DataInputStreamForestry data) throws IOException { super(data); } diff --git a/src/main/java/forestry/core/network/PacketNBT.java b/src/main/java/forestry/core/network/PacketNBT.java index d6dfd5ae1..c1a5a8409 100755 --- a/src/main/java/forestry/core/network/PacketNBT.java +++ b/src/main/java/forestry/core/network/PacketNBT.java @@ -16,7 +16,7 @@ import net.minecraft.nbt.NBTTagCompound; public class PacketNBT extends ForestryPacket { - protected NBTTagCompound nbttagcompound; + private NBTTagCompound nbttagcompound; public PacketNBT(DataInputStreamForestry data) throws IOException { super(data); diff --git a/src/main/java/forestry/core/network/PacketProgressBarUpdate.java b/src/main/java/forestry/core/network/PacketProgressBarUpdate.java index 54192228e..cfe7c7492 100644 --- a/src/main/java/forestry/core/network/PacketProgressBarUpdate.java +++ b/src/main/java/forestry/core/network/PacketProgressBarUpdate.java @@ -28,7 +28,7 @@ public class PacketProgressBarUpdate extends ForestryPacket { new PacketProgressBarUpdate(data); } - public PacketProgressBarUpdate(DataInputStreamForestry data) throws IOException { + private PacketProgressBarUpdate(DataInputStreamForestry data) throws IOException { super(data); } diff --git a/src/main/java/forestry/core/network/PacketSocketUpdate.java b/src/main/java/forestry/core/network/PacketSocketUpdate.java index 6674d8caf..12287b347 100755 --- a/src/main/java/forestry/core/network/PacketSocketUpdate.java +++ b/src/main/java/forestry/core/network/PacketSocketUpdate.java @@ -25,8 +25,8 @@ public class PacketSocketUpdate extends PacketCoordinates { super(data); } - public PacketSocketUpdate(PacketId id, T tile) { - super(id, tile); + public PacketSocketUpdate(T tile) { + super(PacketId.SOCKET_UPDATE, tile); itemStacks = new ItemStack[tile.getSocketCount()]; for (int i = 0; i < tile.getSocketCount(); i++) { diff --git a/src/main/java/forestry/core/network/PacketTileStream.java b/src/main/java/forestry/core/network/PacketTileStream.java index 856d1ab78..9e8b19f11 100644 --- a/src/main/java/forestry/core/network/PacketTileStream.java +++ b/src/main/java/forestry/core/network/PacketTileStream.java @@ -24,7 +24,7 @@ public class PacketTileStream extends PacketCoordinates { new PacketTileStream(data); } - public PacketTileStream(DataInputStreamForestry data) throws IOException { + private PacketTileStream(DataInputStreamForestry data) throws IOException { super(data); } diff --git a/src/main/java/forestry/core/proxy/ClientProxyCommon.java b/src/main/java/forestry/core/proxy/ClientProxyCommon.java index 1813dc8c5..900879942 100755 --- a/src/main/java/forestry/core/proxy/ClientProxyCommon.java +++ b/src/main/java/forestry/core/proxy/ClientProxyCommon.java @@ -164,44 +164,31 @@ public class ClientProxyCommon extends ProxyCommon { world.playSound(x + 0.5, y + 0.5, z + 0.5, sound, volume, (1.0f + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2f) * 0.7f, false); } - /** - * Renders a EntityBiodustFX on client. - */ - // FIXME: This is causing crashes. @Override - public void addEntityBiodustFX(World world, double d1, double d2, double d3, float f1, float f2, float f3) { + public void addEntitySwarmFX(World world, double d1, double d2, double d3) { if (!ClientProxyRender.shouldSpawnParticle(world)) { return; } - // ModLoader.getMinecraftInstance().effectRenderer.addEffect(new EntityBiodustFX(world, d1, d2, d3, f1, f2, f3)); + getClientInstance().effectRenderer.addEffect(new EntityHoneydustFX(world, d1, d2, d3, 0, 0, 0)); } @Override - public void addEntitySwarmFX(World world, double d1, double d2, double d3, float f1, float f2, float f3) { + public void addEntityExplodeFX(World world, double d1, double d2, double d3) { if (!ClientProxyRender.shouldSpawnParticle(world)) { return; } - getClientInstance().effectRenderer.addEffect(new EntityHoneydustFX(world, d1, d2, d3, f1, f2, f3)); + getClientInstance().effectRenderer.addEffect(new EntityExplodeFX(world, d1, d2, d3, 0, 0, 0)); } @Override - public void addEntityExplodeFX(World world, double d1, double d2, double d3, float f1, float f2, float f3) { + public void addEntitySnowFX(World world, double d1, double d2, double d3) { if (!ClientProxyRender.shouldSpawnParticle(world)) { return; } - getClientInstance().effectRenderer.addEffect(new EntityExplodeFX(world, d1, d2, d3, f1, f2, f3)); - } - - @Override - public void addEntitySnowFX(World world, double d1, double d2, double d3, float f1, float f2, float f3) { - if (!ClientProxyRender.shouldSpawnParticle(world)) { - return; - } - - getClientInstance().effectRenderer.addEffect(new EntitySnowFX(world, d1 + world.rand.nextGaussian(), d2, d3 + world.rand.nextGaussian(), f1, f2, f3)); + getClientInstance().effectRenderer.addEffect(new EntitySnowFX(world, d1 + world.rand.nextGaussian(), d2, d3 + world.rand.nextGaussian())); } @Override diff --git a/src/main/java/forestry/core/proxy/ClientProxyRender.java b/src/main/java/forestry/core/proxy/ClientProxyRender.java index 679250943..4dda19f88 100755 --- a/src/main/java/forestry/core/proxy/ClientProxyRender.java +++ b/src/main/java/forestry/core/proxy/ClientProxyRender.java @@ -50,7 +50,7 @@ public class ClientProxyRender extends ProxyRender { @Override public void registerTESR(MachineDefinition definition) { - BlockRenderingHandler.byBlockRenderer.put(new TileRendererIndex(definition.block, definition.meta), definition.renderer); + BlockRenderingHandler.byBlockRenderer.put(new TileRendererIndex(definition.getBlock(), definition.getMeta()), definition.renderer); ClientRegistry.bindTileEntitySpecialRenderer(definition.teClass, (TileEntitySpecialRenderer) definition.renderer); } diff --git a/src/main/java/forestry/core/proxy/ProxyCommon.java b/src/main/java/forestry/core/proxy/ProxyCommon.java index 1972ad99e..f5262e5d6 100755 --- a/src/main/java/forestry/core/proxy/ProxyCommon.java +++ b/src/main/java/forestry/core/proxy/ProxyCommon.java @@ -227,16 +227,13 @@ public class ProxyCommon { public void playSoundFX(World world, int x, int y, int z, String sound, float volume, float pitch) { } - public void addEntityBiodustFX(World world, double d1, double d2, double d3, float f1, float f2, float f3) { + public void addEntitySwarmFX(World world, double d1, double d2, double d3) { } - public void addEntitySwarmFX(World world, double d1, double d2, double d3, float f1, float f2, float f3) { + public void addEntityExplodeFX(World world, double d1, double d2, double d3) { } - public void addEntityExplodeFX(World world, double d1, double d2, double d3, float f1, float f2, float f3) { - } - - public void addEntitySnowFX(World world, double d1, double d2, double d3, float f1, float f2, float f3) { + public void addEntitySnowFX(World world, double d1, double d2, double d3) { } public void addEntityIgnitionFX(World world, double d1, double d2, double d3) { diff --git a/src/main/java/forestry/core/proxy/ProxyLog.java b/src/main/java/forestry/core/proxy/ProxyLog.java index 037d72dd1..6c54bb181 100755 --- a/src/main/java/forestry/core/proxy/ProxyLog.java +++ b/src/main/java/forestry/core/proxy/ProxyLog.java @@ -97,7 +97,7 @@ public class ProxyLog { } /* GENERIC */ - public void log(Level logLevel, String message, Object... params) { + private void log(Level logLevel, String message, Object... params) { LogManager.getLogger(Defaults.MOD).log(logLevel, new MessageFormatMessage(String.format(message, params), params)); } diff --git a/src/main/java/forestry/core/render/BlockRenderingHandler.java b/src/main/java/forestry/core/render/BlockRenderingHandler.java index 7f0320a97..0d69f045b 100755 --- a/src/main/java/forestry/core/render/BlockRenderingHandler.java +++ b/src/main/java/forestry/core/render/BlockRenderingHandler.java @@ -31,7 +31,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler { if (block.getRenderType() == ForestryClient.byBlockModelId) { TileRendererIndex index = new TileRendererIndex(block, metadata); if (byBlockRenderer.containsKey(index)) { - byBlockRenderer.get(index).inventoryRender(-0.5, -0.5, -0.5, 0, 0); + byBlockRenderer.get(index).inventoryRender(-0.5, -0.5, -0.5); } } diff --git a/src/main/java/forestry/core/render/CrateRenderingHandler.java b/src/main/java/forestry/core/render/CrateRenderingHandler.java index 0dfa881d8..0dc9ede64 100644 --- a/src/main/java/forestry/core/render/CrateRenderingHandler.java +++ b/src/main/java/forestry/core/render/CrateRenderingHandler.java @@ -40,7 +40,7 @@ public class CrateRenderingHandler implements IItemRenderer { private static final ResourceLocation ITEM_TEXTURE = TextureMap.locationItemsTexture; private static final ResourceLocation GLINT_TEXTURE = new ResourceLocation("textures/misc/enchanted_item_glint.png"); - public static final float PIXEL = 1.0f / 16.0f; + private static final float PIXEL = 1.0f / 16.0f; private final RenderItem renderItem = new RenderItem(); diff --git a/src/main/java/forestry/core/render/EntityBiodustFX.java b/src/main/java/forestry/core/render/EntityBiodustFX.java deleted file mode 100755 index c454e4d50..000000000 --- a/src/main/java/forestry/core/render/EntityBiodustFX.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.core.render; - -import net.minecraft.client.particle.EntityReddustFX; -import net.minecraft.world.World; - -public class EntityBiodustFX extends EntityReddustFX { - - public EntityBiodustFX(World world, double d, double d1, double d2, float f, float f1, float f2) { - this(world, d, d1, d2, 1.0F, f, f1, f2); - } - - public EntityBiodustFX(World world, double d, double d1, double d2, float f, float f1, float f2, float f3) { - super(world, d, d1, d2, f, f1, f2, f3); - // float f4 = (float)Math.random() * 0.4F + 0.6F; - // particleRed = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) - // * f1 * f4; - // particleGreen = ((float)(Math.random() * 0.20000000298023224D) + - // 0.8F) * f2 * f4; - // particleBlue = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) - // * f3 * f4; - particleRed = 0F; - particleGreen = 1.0F; - particleBlue = 0F; - } - -} diff --git a/src/main/java/forestry/core/render/EntityIgnitionFX.java b/src/main/java/forestry/core/render/EntityIgnitionFX.java index a1a30cc11..8c7fbc3c5 100644 --- a/src/main/java/forestry/core/render/EntityIgnitionFX.java +++ b/src/main/java/forestry/core/render/EntityIgnitionFX.java @@ -26,11 +26,11 @@ public class EntityIgnitionFX extends EntityFX { this.motionX *= 0.8; this.motionY *= 0.8; this.motionZ *= 0.8; - this.motionY = (double)(this.rand.nextFloat() * 0.4F + 0.05F); + this.motionY = (double) (this.rand.nextFloat() * 0.4F + 0.05F); this.particleRed = this.particleGreen = this.particleBlue = 1.0F; this.particleScale *= (this.rand.nextFloat() / 2) + 0.3F; this.ignitionParticleScale = this.particleScale; - this.particleMaxAge = (int)(16.0 / (Math.random() * 0.8 + 0.2)); + this.particleMaxAge = (int) (16.0 / (Math.random() * 0.8 + 0.2)); this.noClip = false; this.setParticleTextureIndex(49); } diff --git a/src/main/java/forestry/core/render/EntitySnowFX.java b/src/main/java/forestry/core/render/EntitySnowFX.java index d2767d1fc..6c8e1f9c1 100755 --- a/src/main/java/forestry/core/render/EntitySnowFX.java +++ b/src/main/java/forestry/core/render/EntitySnowFX.java @@ -10,8 +10,6 @@ ******************************************************************************/ package forestry.core.render; -import java.util.Random; - import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.IIcon; @@ -20,9 +18,8 @@ import net.minecraft.world.World; public class EntitySnowFX extends EntityFX { public static IIcon icons[]; - private static final Random spreadRand = new Random(); - public EntitySnowFX(World world, double x, double y, double z, float motionScaleX, float motionScaleY, float motionScaleZ) { + public EntitySnowFX(World world, double x, double y, double z) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); this.setParticleIcon(icons[rand.nextInt(icons.length)]); diff --git a/src/main/java/forestry/core/render/ModelEscritoire.java b/src/main/java/forestry/core/render/ModelEscritoire.java index 58140e00a..e02067781 100755 --- a/src/main/java/forestry/core/render/ModelEscritoire.java +++ b/src/main/java/forestry/core/render/ModelEscritoire.java @@ -172,7 +172,7 @@ public class ModelEscritoire extends ModelBase { standLowLB.render(f5); } - private void setRotation(ModelRenderer model, float x, float y, float z) { + private static void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; diff --git a/src/main/java/forestry/core/render/OverlayRenderingHandler.java b/src/main/java/forestry/core/render/OverlayRenderingHandler.java index c4cc01449..f189e5612 100755 --- a/src/main/java/forestry/core/render/OverlayRenderingHandler.java +++ b/src/main/java/forestry/core/render/OverlayRenderingHandler.java @@ -22,11 +22,11 @@ public abstract class OverlayRenderingHandler implements ISimpleBlockRenderingHa protected static final double OVERLAY_SHIFT = 0.001; - protected int determineMixedBrightness(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, int mixedBrightness) { + private static int determineMixedBrightness(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, int mixedBrightness) { return renderer.renderMinY > 0.0D ? mixedBrightness : block.getMixedBrightnessForBlock(world, x, y, z); } - protected void renderBottomFace(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon textureIndex, int mixedBrightness, + protected static void renderBottomFace(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon textureIndex, int mixedBrightness, float r, float g, float b) { if (!renderer.renderAllFaces && !block.shouldSideBeRendered(world, x, y - 1, z, 0)) { @@ -41,7 +41,7 @@ public abstract class OverlayRenderingHandler implements ISimpleBlockRenderingHa } - protected void renderTopFace(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon textureIndex, int mixedBrightness, float r, + protected static void renderTopFace(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon textureIndex, int mixedBrightness, float r, float g, float b) { if (!renderer.renderAllFaces && !block.shouldSideBeRendered(world, x, y + 1, z, 1)) { @@ -56,7 +56,7 @@ public abstract class OverlayRenderingHandler implements ISimpleBlockRenderingHa } - protected void renderEastFace(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon textureIndex, int mixedBrightness, float r, + protected static void renderEastFace(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon textureIndex, int mixedBrightness, float r, float g, float b) { if (!renderer.renderAllFaces && !block.shouldSideBeRendered(world, x, y, z - 1, 2)) { @@ -71,7 +71,7 @@ public abstract class OverlayRenderingHandler implements ISimpleBlockRenderingHa } - protected void renderWestFace(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon textureIndex, int mixedBrightness, float r, + protected static void renderWestFace(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon textureIndex, int mixedBrightness, float r, float g, float b) { if (!renderer.renderAllFaces && !block.shouldSideBeRendered(world, x, y, z + 1, 3)) { @@ -86,7 +86,7 @@ public abstract class OverlayRenderingHandler implements ISimpleBlockRenderingHa } - protected void renderNorthFace(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon textureIndex, int mixedBrightness, + protected static void renderNorthFace(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon textureIndex, int mixedBrightness, float r, float g, float b) { if (!renderer.renderAllFaces && !block.shouldSideBeRendered(world, x - 1, y, z, 4)) { @@ -101,7 +101,7 @@ public abstract class OverlayRenderingHandler implements ISimpleBlockRenderingHa } - protected void renderSouthFace(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon textureIndex, int mixedBrightness, + protected static void renderSouthFace(IBlockAccess world, Block block, int x, int y, int z, RenderBlocks renderer, IIcon textureIndex, int mixedBrightness, float r, float g, float b) { if (!renderer.renderAllFaces && !block.shouldSideBeRendered(world, x + 1, y, z, 5)) { diff --git a/src/main/java/forestry/core/render/RenderAnalyzer.java b/src/main/java/forestry/core/render/RenderAnalyzer.java index 9078db829..9c12acbc7 100755 --- a/src/main/java/forestry/core/render/RenderAnalyzer.java +++ b/src/main/java/forestry/core/render/RenderAnalyzer.java @@ -50,7 +50,7 @@ public class RenderAnalyzer extends TileEntitySpecialRenderer implements IBlockR } @Override - public void inventoryRender(double x, double y, double z, float f, float f1) { + public void inventoryRender(double x, double y, double z) { render(null, null, ForgeDirection.WEST, x, y, z); } diff --git a/src/main/java/forestry/core/render/RenderEscritoire.java b/src/main/java/forestry/core/render/RenderEscritoire.java index 5fe932cf9..6eda76057 100755 --- a/src/main/java/forestry/core/render/RenderEscritoire.java +++ b/src/main/java/forestry/core/render/RenderEscritoire.java @@ -51,7 +51,7 @@ public class RenderEscritoire extends TileEntitySpecialRenderer implements IBloc } @Override - public void inventoryRender(double x, double y, double z, float f, float f1) { + public void inventoryRender(double x, double y, double z) { render(null, ForgeDirection.EAST, x, y, z); } diff --git a/src/main/java/forestry/core/render/RenderMachine.java b/src/main/java/forestry/core/render/RenderMachine.java index e0ed9a457..9578392c8 100755 --- a/src/main/java/forestry/core/render/RenderMachine.java +++ b/src/main/java/forestry/core/render/RenderMachine.java @@ -44,7 +44,7 @@ public class RenderMachine extends TileEntitySpecialRenderer implements IBlockRe private ResourceLocation[] textures; - public RenderMachine() { + private RenderMachine() { basefront = new ModelRenderer(model, 0, 0); basefront.addBox(-8F, -8F, -8F, 16, 4, 16); @@ -94,7 +94,7 @@ public class RenderMachine extends TileEntitySpecialRenderer implements IBlockRe } @Override - public void inventoryRender(double x, double y, double z, float f, float f1) { + public void inventoryRender(double x, double y, double z) { render(EnumTankLevel.EMPTY, EnumTankLevel.EMPTY, ForgeDirection.UP, x, y, z); } @@ -109,7 +109,7 @@ public class RenderMachine extends TileEntitySpecialRenderer implements IBlockRe render(waterLevel.ordinal(), melangeLevel.ordinal(), orientation, x, y, z); } - public void render(int waterLevelInt, int melangeLevelInt, ForgeDirection orientation, double x, double y, double z) { + private void render(int waterLevelInt, int melangeLevelInt, ForgeDirection orientation, double x, double y, double z) { EnumTankLevel waterLevel = EnumTankLevel.values()[waterLevelInt]; EnumTankLevel melangeLevel = EnumTankLevel.values()[melangeLevelInt]; diff --git a/src/main/java/forestry/core/render/RenderMill.java b/src/main/java/forestry/core/render/RenderMill.java index dec40df06..009fad6b1 100755 --- a/src/main/java/forestry/core/render/RenderMill.java +++ b/src/main/java/forestry/core/render/RenderMill.java @@ -93,7 +93,7 @@ public class RenderMill extends TileEntitySpecialRenderer implements IBlockRende } @Override - public void inventoryRender(double x, double y, double z, float f, float f1) { + public void inventoryRender(double x, double y, double z) { byte charge = 0; render(0.0f, charge, ForgeDirection.WEST, x, y, z); } diff --git a/src/main/java/forestry/core/render/TileRendererIndex.java b/src/main/java/forestry/core/render/TileRendererIndex.java index 5357cd6a1..747e0a00d 100755 --- a/src/main/java/forestry/core/render/TileRendererIndex.java +++ b/src/main/java/forestry/core/render/TileRendererIndex.java @@ -25,12 +25,12 @@ public class TileRendererIndex { return block.hashCode() + meta; } - public boolean equals(Object aobj) { - if (!(aobj instanceof TileRendererIndex)) { + public boolean equals(Object obj) { + if (!(obj instanceof TileRendererIndex)) { return false; } - TileRendererIndex index = (TileRendererIndex) aobj; + TileRendererIndex index = (TileRendererIndex) obj; return index.block == block && index.meta == meta; } diff --git a/src/main/java/forestry/core/triggers/Trigger.java b/src/main/java/forestry/core/triggers/Trigger.java index d97f55217..c9cc790dc 100755 --- a/src/main/java/forestry/core/triggers/Trigger.java +++ b/src/main/java/forestry/core/triggers/Trigger.java @@ -29,11 +29,11 @@ public abstract class Trigger implements ITriggerExternal { private final String uid; private final String unlocalized; - public Trigger(String uid) { + protected Trigger(String uid) { this(uid, uid); } - public Trigger(String uid, String localization) { + protected Trigger(String uid, String localization) { this.uid = "forestry:" + uid; unlocalized = "trigger." + localization; StatementManager.registerStatement(this); diff --git a/src/main/java/forestry/core/utils/ChunkCoords.java b/src/main/java/forestry/core/utils/ChunkCoords.java index bdc787fb4..73160839a 100644 --- a/src/main/java/forestry/core/utils/ChunkCoords.java +++ b/src/main/java/forestry/core/utils/ChunkCoords.java @@ -13,9 +13,9 @@ package forestry.core.utils; import net.minecraft.world.chunk.Chunk; public class ChunkCoords { - public int dimension; - public int xCoord; - public int zCoord; + public final int dimension; + public final int xCoord; + public final int zCoord; public ChunkCoords(Chunk chunk) { this.dimension = chunk.worldObj.provider.dimensionId; diff --git a/src/main/java/forestry/core/utils/ForestryModEnvWarningCallable.java b/src/main/java/forestry/core/utils/ForestryModEnvWarningCallable.java index cb896771f..416da76f4 100755 --- a/src/main/java/forestry/core/utils/ForestryModEnvWarningCallable.java +++ b/src/main/java/forestry/core/utils/ForestryModEnvWarningCallable.java @@ -22,12 +22,22 @@ import cpw.mods.fml.relauncher.Side; import forestry.core.config.Defaults; import forestry.plugins.PluginManager; +/** + * ICrashCallable for highlighting certain mods and listing disabled modules for crash reports. + **/ public class ForestryModEnvWarningCallable implements ICrashCallable { private final List modIDs; private final List disabledModules; - public ForestryModEnvWarningCallable() { + public static void register() { + ForestryModEnvWarningCallable callable = new ForestryModEnvWarningCallable(); + if (callable.modIDs.size() > 0 || callable.disabledModules.size() > 0) { + FMLCommonHandler.instance().registerCrashCallable(callable); + } + } + + private ForestryModEnvWarningCallable() { this.modIDs = new ArrayList(); if (FMLCommonHandler.instance().getSide() == Side.CLIENT && FMLClientHandler.instance().hasOptifine()) { @@ -39,21 +49,18 @@ public class ForestryModEnvWarningCallable implements ICrashCallable { } try { - @SuppressWarnings("unused") Class c = Class.forName("org.bukkit.Bukkit"); - modIDs.add("Bukkit, Cauldron, or other Bukkit replacement"); + if (c != null) { + modIDs.add("Bukkit, Cauldron, or other Bukkit replacement"); + } } catch (Throwable ignored) { - } // No need to do anything. - + // No need to do anything. + } this.disabledModules = new ArrayList(); for (PluginManager.Module module : PluginManager.configDisabledModules) { disabledModules.add(module.configName()); } - - if (modIDs.size() > 0 || disabledModules.size() > 0) { - FMLCommonHandler.instance().registerCrashCallable(this); - } } @Override diff --git a/src/main/java/forestry/core/utils/GeneticsUtil.java b/src/main/java/forestry/core/utils/GeneticsUtil.java index 54fe53e9f..6d631ee61 100644 --- a/src/main/java/forestry/core/utils/GeneticsUtil.java +++ b/src/main/java/forestry/core/utils/GeneticsUtil.java @@ -10,9 +10,7 @@ ******************************************************************************/ package forestry.core.utils; -import java.util.ArrayList; import java.util.HashSet; -import java.util.List; import java.util.Map; import java.util.Set; @@ -26,13 +24,11 @@ import net.minecraft.world.World; import com.mojang.authlib.GameProfile; -import forestry.api.apiculture.EnumBeeChromosome; import forestry.api.arboriculture.EnumGermlingType; import forestry.api.arboriculture.ITree; import forestry.api.arboriculture.TreeManager; import forestry.api.core.IArmorNaturalist; import forestry.api.genetics.AlleleManager; -import forestry.api.genetics.IAllele; import forestry.api.genetics.IAlleleSpecies; import forestry.api.genetics.IChromosomeType; import forestry.api.genetics.IIndividual; diff --git a/src/main/java/forestry/core/utils/NBTUtil.java b/src/main/java/forestry/core/utils/NBTUtil.java index 1ac2b6f7b..de742d4cb 100644 --- a/src/main/java/forestry/core/utils/NBTUtil.java +++ b/src/main/java/forestry/core/utils/NBTUtil.java @@ -53,7 +53,7 @@ public class NBTUtil { public static final EnumNBTType[] VALUES = values(); public final Class classObject; - private EnumNBTType(Class c) { + EnumNBTType(Class c) { this.classObject = c; } diff --git a/src/main/java/forestry/core/utils/ShapelessRecipeCustom.java b/src/main/java/forestry/core/utils/ShapelessRecipeCustom.java index 225bac08b..f515dd35c 100644 --- a/src/main/java/forestry/core/utils/ShapelessRecipeCustom.java +++ b/src/main/java/forestry/core/utils/ShapelessRecipeCustom.java @@ -15,11 +15,25 @@ import net.minecraftforge.oredict.OreDictionary; public class ShapelessRecipeCustom implements IRecipe { + @SuppressWarnings("unchecked") + public static ShapelessRecipeCustom buildRecipe(ItemStack product, ItemStack... ingredients) { + ShapelessRecipeCustom recipe = new ShapelessRecipeCustom(product, ingredients); + CraftingManager.getInstance().getRecipeList().add(recipe); + return recipe; + } + + @SuppressWarnings("unchecked") + public static ShapelessRecipeCustom buildPriorityRecipe(ItemStack product, ItemStack... ingredients) { + ShapelessRecipeCustom recipe = new ShapelessRecipeCustom(product, ingredients); + CraftingManager.getInstance().getRecipeList().add(0, recipe); + return recipe; + } + private final List ingredients; private final ItemStack product; private boolean preserveNBT = false; - public ShapelessRecipeCustom(ItemStack product, ItemStack... ingredients) { + private ShapelessRecipeCustom(ItemStack product, ItemStack... ingredients) { this.ingredients = Arrays.asList(ingredients); this.product = product; } @@ -84,17 +98,4 @@ public class ShapelessRecipeCustom implements IRecipe { return product.copy(); } - @SuppressWarnings("unchecked") - public static ShapelessRecipeCustom buildRecipe(ItemStack product, ItemStack... ingredients) { - ShapelessRecipeCustom recipe = new ShapelessRecipeCustom(product, ingredients); - CraftingManager.getInstance().getRecipeList().add(recipe); - return recipe; - } - - @SuppressWarnings("unchecked") - public static ShapelessRecipeCustom buildPriorityRecipe(ItemStack product, ItemStack... ingredients) { - ShapelessRecipeCustom recipe = new ShapelessRecipeCustom(product, ingredients); - CraftingManager.getInstance().getRecipeList().add(0, recipe); - return recipe; - } } diff --git a/src/main/java/forestry/core/worldgen/WorldGenBase.java b/src/main/java/forestry/core/worldgen/WorldGenBase.java index 9c39e3fa5..19a8c6ec3 100755 --- a/src/main/java/forestry/core/worldgen/WorldGenBase.java +++ b/src/main/java/forestry/core/worldgen/WorldGenBase.java @@ -43,10 +43,10 @@ public abstract class WorldGenBase extends WorldGenerator { @Override public final boolean generate(World world, Random random, int x, int y, int z) { - return generate(world, random, x, y, z, false); + return generate(world, x, y, z, false); } - public boolean generate(World world, Random random, int x, int y, int z, boolean forced) { + public boolean generate(World world, int x, int y, int z, boolean forced) { return false; } diff --git a/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java b/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java index 6275dc33a..ee80ebd9c 100755 --- a/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java +++ b/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java @@ -27,16 +27,12 @@ public class WorldGenMinableMeta extends WorldGenerator { private final int mineableBlockMeta; private final int numberOfBlocks; - public WorldGenMinableMeta(Block block, int meta, int numberOfBlocks) { - mineableBlock = block; + public WorldGenMinableMeta(ForestryBlock block, int meta, int numberOfBlocks) { + mineableBlock = block.block(); mineableBlockMeta = meta; this.numberOfBlocks = numberOfBlocks; } - public WorldGenMinableMeta(ForestryBlock block, int meta, int numberOfBlocks) { - this(block.block(), meta, numberOfBlocks); - } - @Override public boolean generate(World world, Random random, int i, int j, int k) { diff --git a/src/main/java/forestry/energy/GuiHandlerEnergy.java b/src/main/java/forestry/energy/GuiHandlerEnergy.java index 3c0a05f3c..291226a32 100755 --- a/src/main/java/forestry/energy/GuiHandlerEnergy.java +++ b/src/main/java/forestry/energy/GuiHandlerEnergy.java @@ -15,7 +15,6 @@ import net.minecraft.world.World; import forestry.core.GuiHandlerBase; import forestry.core.network.GuiId; -import forestry.core.network.PacketId; import forestry.core.network.PacketSocketUpdate; import forestry.core.proxy.Proxies; import forestry.energy.gadgets.EngineBronze; @@ -76,7 +75,7 @@ public class GuiHandlerEnergy extends GuiHandlerBase { case EngineTinGUI: EngineTin tile = getTile(world, x, y, z, player, EngineTin.class); - Proxies.net.sendToPlayer(new PacketSocketUpdate(PacketId.SOCKET_UPDATE, tile), player); + Proxies.net.sendToPlayer(new PacketSocketUpdate(tile), player); return new ContainerEngineTin(player.inventory, tile); case GeneratorGUI: diff --git a/src/main/java/forestry/energy/circuits/CircuitElectricChange.java b/src/main/java/forestry/energy/circuits/CircuitElectricChange.java index fb56f3c9e..9bd1ea2cf 100755 --- a/src/main/java/forestry/energy/circuits/CircuitElectricChange.java +++ b/src/main/java/forestry/energy/circuits/CircuitElectricChange.java @@ -15,10 +15,10 @@ import forestry.energy.gadgets.EngineTin; public abstract class CircuitElectricChange extends Circuit { - int euChange = 7; - int rfChange = 20; + private int euChange = 7; + private int rfChange = 20; - public CircuitElectricChange(String uid, boolean requiresDiscovery) { + protected CircuitElectricChange(String uid, boolean requiresDiscovery) { super(uid, requiresDiscovery); } diff --git a/src/main/java/forestry/energy/gadgets/EngineBronze.java b/src/main/java/forestry/energy/gadgets/EngineBronze.java index 33c786fb1..45a143f29 100755 --- a/src/main/java/forestry/energy/gadgets/EngineBronze.java +++ b/src/main/java/forestry/energy/gadgets/EngineBronze.java @@ -38,7 +38,6 @@ import forestry.core.fluids.TankManager; import forestry.core.fluids.tanks.FilteredTank; import forestry.core.fluids.tanks.StandardTank; import forestry.core.gadgets.Engine; -import forestry.core.gadgets.TileBase; import forestry.core.interfaces.ILiquidTankContainer; import forestry.core.inventory.IInventoryAdapter; import forestry.core.inventory.TileInventoryAdapter; @@ -63,7 +62,7 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank private boolean shutdown; public EngineBronze() { - super(Defaults.ENGINE_BRONZE_HEAT_MAX, 300000, 5000); + super(Defaults.ENGINE_BRONZE_HEAT_MAX, 300000); setHints(Config.hints.get("engine.bronze")); setInternalInventory(new EngineBronzeInventoryAdapter(this)); @@ -81,7 +80,7 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.EngineBronzeGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } @@ -119,8 +118,7 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank double heatStage = getHeatLevel(); - // If we have reached a safe temperature, we reenable energy - // transfer + // If we have reached a safe temperature, enable energy transfer if (heatStage > 0.25 && shutdown) { shutdown(false); } else if (shutdown) @@ -234,7 +232,7 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank // / STATE INFORMATION @Override - public boolean isBurning() { + protected boolean isBurning() { return mayBurn() && burnTime > 0; } diff --git a/src/main/java/forestry/energy/gadgets/EngineClockwork.java b/src/main/java/forestry/energy/gadgets/EngineClockwork.java index e96400838..f871db2cc 100755 --- a/src/main/java/forestry/energy/gadgets/EngineClockwork.java +++ b/src/main/java/forestry/energy/gadgets/EngineClockwork.java @@ -21,7 +21,6 @@ import net.minecraftforge.common.util.FakePlayer; import forestry.core.TemperatureState; import forestry.core.config.Defaults; import forestry.core.gadgets.Engine; -import forestry.core.gadgets.TileBase; import forestry.core.utils.DamageSourceForestry; public class EngineClockwork extends Engine { @@ -40,11 +39,11 @@ public class EngineClockwork extends Engine { private short delay = 0; public EngineClockwork() { - super(ENGINE_CLOCKWORK_HEAT_MAX, 10000, 500); + super(ENGINE_CLOCKWORK_HEAT_MAX, 10000); } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { if (!(player instanceof EntityPlayerMP)) { return; @@ -127,7 +126,7 @@ public class EngineClockwork extends Engine { } @Override - public boolean isBurning() { + protected boolean isBurning() { return tension > 0; } diff --git a/src/main/java/forestry/energy/gadgets/EngineCopper.java b/src/main/java/forestry/energy/gadgets/EngineCopper.java index 646af7969..9060aa529 100755 --- a/src/main/java/forestry/energy/gadgets/EngineCopper.java +++ b/src/main/java/forestry/energy/gadgets/EngineCopper.java @@ -36,7 +36,6 @@ import forestry.core.config.Config; import forestry.core.config.Defaults; import forestry.core.config.ForestryItem; import forestry.core.gadgets.Engine; -import forestry.core.gadgets.TileBase; import forestry.core.inventory.AdjacentInventoryCache; import forestry.core.inventory.IInventoryAdapter; import forestry.core.inventory.InvTools; @@ -65,7 +64,7 @@ public class EngineCopper extends Engine implements ISidedInventory { private final AdjacentInventoryCache inventoryCache = new AdjacentInventoryCache(this, getTileCache()); public EngineCopper() { - super(Defaults.ENGINE_COPPER_HEAT_MAX, 200000, 4000); + super(Defaults.ENGINE_COPPER_HEAT_MAX, 200000); setHints(Config.hints.get("engine.copper")); ashForItem = Defaults.ENGINE_COPPER_ASH_FOR_ITEM; @@ -73,7 +72,7 @@ public class EngineCopper extends Engine implements ISidedInventory { } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.EngineCopperGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } @@ -137,15 +136,15 @@ public class EngineCopper extends Engine implements ISidedInventory { energyManager.generateEnergy(currentOutput); } } else if (isRedstoneActivated()) { - int fuelslot = getFuelSlot(); - int wasteslot = getFreeWasteSlot(); + int fuelSlot = getFuelSlot(); + int wasteSlot = getFreeWasteSlot(); - if (fuelslot >= 0 && wasteslot >= 0) { + if (fuelSlot >= 0 && wasteSlot >= 0) { IInventoryAdapter inventory = getInternalInventory(); - burnTime = totalBurnTime = determineBurnDuration(inventory.getStackInSlot(fuelslot)); + burnTime = totalBurnTime = determineBurnDuration(inventory.getStackInSlot(fuelSlot)); if (burnTime > 0) { - fuelItem = inventory.getStackInSlot(fuelslot).getItem(); - decrStackSize(fuelslot, 1); + fuelItem = inventory.getStackInSlot(fuelSlot).getItem(); + decrStackSize(fuelSlot, 1); } } } @@ -196,13 +195,13 @@ public class EngineCopper extends Engine implements ISidedInventory { } // If we have reached the necessary amount, we need to add ash - int wasteslot = getFreeWasteSlot(); - if (wasteslot >= 0) { + int wasteSlot = getFreeWasteSlot(); + if (wasteSlot >= 0) { IInventoryAdapter inventory = getInternalInventory(); - if (inventory.getStackInSlot(wasteslot) == null) { - inventory.setInventorySlotContents(wasteslot, ForestryItem.ash.getItemStack()); + if (inventory.getStackInSlot(wasteSlot) == null) { + inventory.setInventorySlotContents(wasteSlot, ForestryItem.ash.getItemStack()); } else { - inventory.getStackInSlot(wasteslot).stackSize++; + inventory.getStackInSlot(wasteSlot).stackSize++; } } // Reset @@ -214,7 +213,7 @@ public class EngineCopper extends Engine implements ISidedInventory { /** * Returns the fuel value (power per cycle) an item of the passed ItemStack provides */ - private int determineFuelValue(ItemStack fuel) { + private static int determineFuelValue(ItemStack fuel) { if (FuelManager.copperEngineFuel.containsKey(fuel)) { return FuelManager.copperEngineFuel.get(fuel).powerPerCycle; } else { @@ -225,7 +224,7 @@ public class EngineCopper extends Engine implements ISidedInventory { /** * Returns the fuel value (power per cycle) an item of the passed ItemStack provides */ - private int determineBurnDuration(ItemStack fuel) { + private static int determineBurnDuration(ItemStack fuel) { if (FuelManager.copperEngineFuel.containsKey(fuel)) { return FuelManager.copperEngineFuel.get(fuel).burnDuration; } else { @@ -345,7 +344,7 @@ public class EngineCopper extends Engine implements ISidedInventory { iCrafting.sendProgressBarUpdate(containerEngine, 4, heat); } - /* ITRIGGERPROVIDER */ + /* ITriggerProvider */ @Optional.Method(modid = "BuildCraftAPI|statements") @Override public Collection getExternalTriggers(ForgeDirection side, TileEntity tile) { diff --git a/src/main/java/forestry/energy/gadgets/EngineDefinition.java b/src/main/java/forestry/energy/gadgets/EngineDefinition.java index 8e56ba60a..d7f7e72c6 100755 --- a/src/main/java/forestry/energy/gadgets/EngineDefinition.java +++ b/src/main/java/forestry/energy/gadgets/EngineDefinition.java @@ -39,7 +39,7 @@ public class EngineDefinition extends MachineDefinition { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fXplayerClick, float fY, float fZ) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side) { if (player.isSneaking()) { return false; diff --git a/src/main/java/forestry/energy/gadgets/EngineTin.java b/src/main/java/forestry/energy/gadgets/EngineTin.java index 329436692..27c8f00e9 100755 --- a/src/main/java/forestry/energy/gadgets/EngineTin.java +++ b/src/main/java/forestry/energy/gadgets/EngineTin.java @@ -26,7 +26,6 @@ import forestry.core.TemperatureState; import forestry.core.config.Config; import forestry.core.config.Defaults; import forestry.core.gadgets.Engine; -import forestry.core.gadgets.TileBase; import forestry.core.interfaces.ISocketable; import forestry.core.inventory.InventoryAdapter; import forestry.core.inventory.TileInventoryAdapter; @@ -44,21 +43,21 @@ public class EngineTin extends Engine implements ISocketable, IInventory { public int rfPerCycle; public int euStorage; - public EuConfig(int euForCycle, int rfPerCycle, int euStorage) { - this.euForCycle = euForCycle; - this.rfPerCycle = rfPerCycle; - this.euStorage = euStorage; + public EuConfig() { + this.euForCycle = Defaults.ENGINE_TIN_EU_FOR_CYCLE; + this.rfPerCycle = Defaults.ENGINE_TIN_ENERGY_PER_CYCLE; + this.euStorage = Defaults.ENGINE_TIN_MAX_EU_STORED; } } public static final short SLOT_BATTERY = 0; private final InventoryAdapter sockets = new InventoryAdapter(1, "sockets"); - private final EuConfig euConfig = new EuConfig(Defaults.ENGINE_TIN_EU_FOR_CYCLE, Defaults.ENGINE_TIN_ENERGY_PER_CYCLE, Defaults.ENGINE_TIN_MAX_EU_STORED); + private final EuConfig euConfig = new EuConfig(); - protected BasicSink ic2EnergySink; + private BasicSink ic2EnergySink; public EngineTin() { - super(Defaults.ENGINE_TIN_HEAT_MAX, 100000, 4000); + super(Defaults.ENGINE_TIN_HEAT_MAX, 100000); setHints(Config.hints.get("engine.tin")); setInternalInventory(new EngineTinInventoryAdapter(this)); @@ -69,7 +68,7 @@ public class EngineTin extends Engine implements ISocketable, IInventory { } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.EngineTinGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } @@ -120,7 +119,7 @@ public class EngineTin extends Engine implements ISocketable, IInventory { super.invalidate(); } - // / HEAT MANAGMENT + // / HEAT MANAGEMENT @Override public int dissipateHeat() { if (heat <= 0) { @@ -214,7 +213,7 @@ public class EngineTin extends Engine implements ISocketable, IInventory { // / STATE INFORMATION @Override - public boolean isBurning() { + protected boolean isBurning() { return mayBurn() && ic2EnergySink != null && ic2EnergySink.canUseEnergy(euConfig.euForCycle); } @@ -271,7 +270,7 @@ public class EngineTin extends Engine implements ISocketable, IInventory { } } - /* ISOCKETABLE */ + /* ISocketable */ @Override public int getSocketCount() { return sockets.getSizeInventory(); diff --git a/src/main/java/forestry/energy/gadgets/MachineGenerator.java b/src/main/java/forestry/energy/gadgets/MachineGenerator.java index 522ce591f..2687fd544 100755 --- a/src/main/java/forestry/energy/gadgets/MachineGenerator.java +++ b/src/main/java/forestry/energy/gadgets/MachineGenerator.java @@ -51,14 +51,16 @@ import ic2.api.energy.prefab.BasicSource; public class MachineGenerator extends TileBase implements ISidedInventory, ILiquidTankContainer, IRenderableMachine { // / CONSTANTS - public static final short SLOT_CAN = 0; - public static final int maxEnergy = 30000; + private static final int maxEnergy = 30000; + + public static final short SLOT_CAN = 0; - public final FilteredTank resourceTank; private final TankManager tankManager; + private final FilteredTank resourceTank; + private int tickCount = 0; - protected BasicSource ic2EnergySource; + private BasicSource ic2EnergySource; public MachineGenerator() { setHints(Config.hints.get("generator")); @@ -74,7 +76,7 @@ public class MachineGenerator extends TileBase implements ISidedInventory, ILiqu } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.GeneratorGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } diff --git a/src/main/java/forestry/energy/gui/GuiEngine.java b/src/main/java/forestry/energy/gui/GuiEngine.java index 77243a01d..3372a9b0f 100755 --- a/src/main/java/forestry/energy/gui/GuiEngine.java +++ b/src/main/java/forestry/energy/gui/GuiEngine.java @@ -20,6 +20,16 @@ import forestry.core.utils.StringUtil; public abstract class GuiEngine extends GuiForestryTitled { + protected GuiEngine(String texture, C container, I tile) { + super(texture, container, tile); + } + + @Override + protected void initLedgers() { + super.initLedgers(); + ledgerManager.insert(new EngineLedger()); + } + protected class EngineLedger extends Ledger { public EngineLedger() { @@ -58,13 +68,4 @@ public abstract class GuiEngine extends G } } - public GuiEngine(String texture, C container, I tile) { - super(texture, container, tile); - } - - @Override - protected void initLedgers() { - super.initLedgers(); - ledgerManager.insert(new EngineLedger()); - } } diff --git a/src/main/java/forestry/energy/gui/GuiEngineBronze.java b/src/main/java/forestry/energy/gui/GuiEngineBronze.java index f268d9b09..aa512aca1 100755 --- a/src/main/java/forestry/energy/gui/GuiEngineBronze.java +++ b/src/main/java/forestry/energy/gui/GuiEngineBronze.java @@ -33,7 +33,7 @@ public class GuiEngineBronze extends GuiEngine { drawHealthMeter(guiLeft + 74, guiTop + 25, storageHeight, rated); } - public static EnumTankLevel rateLevel(int scaled) { + private static EnumTankLevel rateLevel(int scaled) { if (scaled < 5) { return EnumTankLevel.EMPTY; diff --git a/src/main/java/forestry/energy/render/RenderEngine.java b/src/main/java/forestry/energy/render/RenderEngine.java index 57d455edd..47d8e4d66 100755 --- a/src/main/java/forestry/energy/render/RenderEngine.java +++ b/src/main/java/forestry/energy/render/RenderEngine.java @@ -94,7 +94,7 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IBlockRen } @Override - public void inventoryRender(double x, double y, double z, float f, float f1) { + public void inventoryRender(double x, double y, double z) { render(TemperatureState.COOL, 0.25F, ForgeDirection.UP, x, y, z); } diff --git a/src/main/java/forestry/factory/gadgets/MachineBottler.java b/src/main/java/forestry/factory/gadgets/MachineBottler.java index 065144e2a..89b7525f2 100755 --- a/src/main/java/forestry/factory/gadgets/MachineBottler.java +++ b/src/main/java/forestry/factory/gadgets/MachineBottler.java @@ -42,7 +42,6 @@ import forestry.core.config.Defaults; import forestry.core.fluids.FluidHelper; import forestry.core.fluids.TankManager; import forestry.core.fluids.tanks.StandardTank; -import forestry.core.gadgets.TileBase; import forestry.core.gadgets.TilePowered; import forestry.core.interfaces.ILiquidTankContainer; import forestry.core.inventory.IInventoryAdapter; @@ -64,7 +63,7 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq public static final short SLOT_OUTPUT = 1; public static final short SLOT_INPUT_FULL_CAN = 2; - public static final short CYCLES_FILLING_DEFAULT = 5; + private static final short CYCLES_FILLING_DEFAULT = 5; /* RECIPE MANAGMENT */ public static class Recipe { @@ -138,7 +137,7 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq } } - public final StandardTank resourceTank; + private final StandardTank resourceTank; private final TankManager tankManager; private Recipe currentRecipe; @@ -156,7 +155,7 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.BottlerGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } @@ -242,7 +241,7 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq return true; } - public void checkRecipe() { + private void checkRecipe() { ItemStack emptyCan = getStackInSlot(SLOT_INPUT_EMPTY_CAN); Recipe recipe = RecipeManager.findMatchingRecipe(resourceTank.getFluid(), emptyCan); diff --git a/src/main/java/forestry/factory/gadgets/MachineCarpenter.java b/src/main/java/forestry/factory/gadgets/MachineCarpenter.java index 05ed5e6ff..55ec7ce4c 100755 --- a/src/main/java/forestry/factory/gadgets/MachineCarpenter.java +++ b/src/main/java/forestry/factory/gadgets/MachineCarpenter.java @@ -47,7 +47,6 @@ import forestry.core.fluids.FluidHelper; import forestry.core.fluids.Fluids; import forestry.core.fluids.TankManager; import forestry.core.fluids.tanks.FilteredTank; -import forestry.core.gadgets.TileBase; import forestry.core.gadgets.TilePowered; import forestry.core.interfaces.IItemStackDisplay; import forestry.core.interfaces.ILiquidTankContainer; @@ -77,18 +76,18 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL public final static short SLOT_INVENTORY_COUNT = 18; /* MEMBER */ - public final FilteredTank resourceTank; + private final FilteredTank resourceTank; private final TankManager tankManager; private final TileInventoryAdapter craftingInventory; private final InventoryCraftResult craftPreviewInventory; @Nullable - public MachineCarpenter.Recipe currentRecipe; + private MachineCarpenter.Recipe currentRecipe; private int packageTime; private int totalTime; private ItemStack pendingProduct; - public ItemStack getBoxStack() { + private ItemStack getBoxStack() { return getInternalInventory().getStackInSlot(SLOT_BOX); } @@ -101,13 +100,11 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL craftPreviewInventory = new InventoryCraftResult(); setInternalInventory(new CarpenterInventoryAdapter(this)); - InvTools.configureSided(getInternalInventory(), Defaults.FACINGS, SLOT_BOX, 21); - tankManager = new TankManager(resourceTank); } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.CarpenterGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } diff --git a/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java b/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java index bf69280a5..3486662a2 100755 --- a/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java +++ b/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java @@ -41,7 +41,6 @@ import forestry.api.recipes.ICentrifugeRecipe; import forestry.core.EnumErrorCode; import forestry.core.config.Config; import forestry.core.config.Defaults; -import forestry.core.gadgets.TileBase; import forestry.core.gadgets.TilePowered; import forestry.core.inventory.IInventoryAdapter; import forestry.core.inventory.InvTools; @@ -61,7 +60,7 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory { public static final int SLOT_PRODUCT_COUNT = 9; /* MEMBER */ - public ICentrifugeRecipe currentRecipe; + private ICentrifugeRecipe currentRecipe; private final Stack pendingProducts = new Stack(); private int productionTime; @@ -74,7 +73,7 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory { } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.CentrifugeGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } @@ -168,7 +167,7 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory { return true; } - public void checkRecipe() { + private void checkRecipe() { ICentrifugeRecipe machingRecipe = RecipeManager.findMatchingRecipe(getInternalInventory().getStackInSlot(SLOT_RESOURCE)); if (currentRecipe != machingRecipe) { diff --git a/src/main/java/forestry/factory/gadgets/MachineFabricator.java b/src/main/java/forestry/factory/gadgets/MachineFabricator.java index 0c4e8cb96..ec7f9daa5 100755 --- a/src/main/java/forestry/factory/gadgets/MachineFabricator.java +++ b/src/main/java/forestry/factory/gadgets/MachineFabricator.java @@ -38,7 +38,6 @@ import forestry.core.fluids.Fluids; import forestry.core.fluids.TankManager; import forestry.core.fluids.tanks.FilteredTank; import forestry.core.fluids.tanks.StandardTank; -import forestry.core.gadgets.TileBase; import forestry.core.gadgets.TilePowered; import forestry.core.interfaces.ICrafter; import forestry.core.interfaces.ICraftingPlan; @@ -91,7 +90,7 @@ public class MachineFabricator extends TilePowered implements ICrafter, ILiquidT } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.FabricatorGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } @@ -323,7 +322,7 @@ public class MachineFabricator extends TilePowered implements ICrafter, ILiquidT return (heat * i) / MAX_HEAT; } - public int getMeltingPoint() { + private int getMeltingPoint() { if (moltenTank.getFluidAmount() > 0) { Smelting smelt = RecipeManager.findMatchingSmelting(moltenTank.getFluid()); if (smelt != null) { diff --git a/src/main/java/forestry/factory/gadgets/MachineFermenter.java b/src/main/java/forestry/factory/gadgets/MachineFermenter.java index 3fab84919..abb3ca1a7 100755 --- a/src/main/java/forestry/factory/gadgets/MachineFermenter.java +++ b/src/main/java/forestry/factory/gadgets/MachineFermenter.java @@ -46,7 +46,6 @@ import forestry.core.fluids.Fluids; import forestry.core.fluids.TankManager; import forestry.core.fluids.tanks.FilteredTank; import forestry.core.fluids.tanks.StandardTank; -import forestry.core.gadgets.TileBase; import forestry.core.gadgets.TilePowered; import forestry.core.interfaces.ILiquidTankContainer; import forestry.core.inventory.IInventoryAdapter; @@ -164,18 +163,18 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL } } - public final FilteredTank resourceTank; - public final FilteredTank productTank; + private final FilteredTank resourceTank; + private final FilteredTank productTank; private final TankManager tankManager; private Recipe currentRecipe; private float currentResourceModifier; - public int fermentationTime = 0; - public int fermentationTotalTime = 0; - public int fuelBurnTime = 0; - public int fuelTotalTime = 0; - public int fuelCurrentFerment = 0; + private int fermentationTime = 0; + private int fermentationTotalTime = 0; + private int fuelBurnTime = 0; + private int fuelTotalTime = 0; + private int fuelCurrentFerment = 0; public MachineFermenter() { super(2000, 150, 8000); @@ -189,7 +188,7 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.FermenterGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } @@ -363,7 +362,7 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL /** * Returns the burnTime an item of the passed ItemStack provides */ - private int determineFuelValue(ItemStack item) { + private static int determineFuelValue(ItemStack item) { if (item == null) { return 0; } @@ -375,7 +374,7 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL } } - private int determineFermentPerCycle(ItemStack item) { + private static int determineFermentPerCycle(ItemStack item) { if (item == null) { return 0; } @@ -387,7 +386,7 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL } } - private float determineResourceMod(ItemStack itemstack) { + private static float determineResourceMod(ItemStack itemstack) { if (!(itemstack.getItem() instanceof IVariableFermentable)) { return 1.0f; } @@ -491,11 +490,11 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL return Utils.rateTankLevel(getProductScaled(100)); } - public ItemStack getFermentationStack() { + private ItemStack getFermentationStack() { return getInternalInventory().getStackInSlot(SLOT_RESOURCE); } - public ItemStack getFuelStack() { + private ItemStack getFuelStack() { return getInternalInventory().getStackInSlot(SLOT_FUEL); } diff --git a/src/main/java/forestry/factory/gadgets/MachineMoistener.java b/src/main/java/forestry/factory/gadgets/MachineMoistener.java index c9ee2d86f..ad5a4c4c6 100755 --- a/src/main/java/forestry/factory/gadgets/MachineMoistener.java +++ b/src/main/java/forestry/factory/gadgets/MachineMoistener.java @@ -126,13 +126,13 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu } } - public final FilteredTank resourceTank; + private final FilteredTank resourceTank; private final TankManager tankManager; - public MachineMoistener.Recipe currentRecipe; + private MachineMoistener.Recipe currentRecipe; - public int burnTime = 0; - public int totalTime = 0; - public int productionTime = 0; + private int burnTime = 0; + private int totalTime = 0; + private int productionTime = 0; private int timePerItem = 0; private ItemStack currentProduct; private ItemStack pendingProduct; @@ -145,7 +145,7 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.MoistenerGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } diff --git a/src/main/java/forestry/factory/gadgets/MachineRaintank.java b/src/main/java/forestry/factory/gadgets/MachineRaintank.java index 26a2d1a35..d34a8aebe 100755 --- a/src/main/java/forestry/factory/gadgets/MachineRaintank.java +++ b/src/main/java/forestry/factory/gadgets/MachineRaintank.java @@ -79,7 +79,7 @@ public class MachineRaintank extends TileBase implements ISidedInventory, ILiqui } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.RaintankGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } diff --git a/src/main/java/forestry/factory/gadgets/MachineSqueezer.java b/src/main/java/forestry/factory/gadgets/MachineSqueezer.java index 5956c5a8e..f4e3e1697 100755 --- a/src/main/java/forestry/factory/gadgets/MachineSqueezer.java +++ b/src/main/java/forestry/factory/gadgets/MachineSqueezer.java @@ -39,7 +39,6 @@ import forestry.core.fluids.FluidHelper; import forestry.core.fluids.TankManager; import forestry.core.fluids.tanks.FilteredTank; import forestry.core.fluids.tanks.StandardTank; -import forestry.core.gadgets.TileBase; import forestry.core.gadgets.TilePowered; import forestry.core.interfaces.ILiquidTankContainer; import forestry.core.inventory.IInventoryAdapter; @@ -143,7 +142,7 @@ public class MachineSqueezer extends TilePowered implements ISidedInventory, ILi /* MEMBER */ private final TankManager tankManager; - public final FilteredTank productTank; + private final FilteredTank productTank; private Recipe currentRecipe; @@ -160,7 +159,7 @@ public class MachineSqueezer extends TilePowered implements ISidedInventory, ILi } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.SqueezerGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } diff --git a/src/main/java/forestry/factory/gadgets/MachineStill.java b/src/main/java/forestry/factory/gadgets/MachineStill.java index 537bdbd55..e937044a7 100755 --- a/src/main/java/forestry/factory/gadgets/MachineStill.java +++ b/src/main/java/forestry/factory/gadgets/MachineStill.java @@ -38,7 +38,6 @@ import forestry.core.fluids.FluidHelper; import forestry.core.fluids.TankManager; import forestry.core.fluids.tanks.FilteredTank; import forestry.core.fluids.tanks.StandardTank; -import forestry.core.gadgets.TileBase; import forestry.core.gadgets.TilePowered; import forestry.core.interfaces.ILiquidTankContainer; import forestry.core.inventory.IInventoryAdapter; @@ -122,14 +121,14 @@ public class MachineStill extends TilePowered implements ISidedInventory, ILiqui } /* MEMBER */ - public final FilteredTank resourceTank; - public final FilteredTank productTank; + private final FilteredTank resourceTank; + private final FilteredTank productTank; private final TankManager tankManager; private Recipe currentRecipe; private FluidStack bufferedLiquid; - public int distillationTime = 0; - public int distillationTotalTime = 0; + private int distillationTime = 0; + private int distillationTotalTime = 0; public MachineStill() { super(1100, 50, 8000); @@ -143,7 +142,7 @@ public class MachineStill extends TilePowered implements ISidedInventory, ILiqui } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.StillGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } @@ -245,7 +244,7 @@ public class MachineStill extends TilePowered implements ISidedInventory, ILiqui return false; } - public void checkRecipe() { + private void checkRecipe() { Recipe matchingRecipe = RecipeManager.findMatchingRecipe(resourceTank.getFluid()); if (matchingRecipe == null && bufferedLiquid != null && distillationTime > 0) { diff --git a/src/main/java/forestry/factory/gadgets/MillRainmaker.java b/src/main/java/forestry/factory/gadgets/MillRainmaker.java index 520f6f72c..43a9bd522 100755 --- a/src/main/java/forestry/factory/gadgets/MillRainmaker.java +++ b/src/main/java/forestry/factory/gadgets/MillRainmaker.java @@ -16,7 +16,6 @@ import net.minecraft.nbt.NBTTagCompound; import forestry.api.fuels.FuelManager; import forestry.api.fuels.RainSubstrate; import forestry.core.gadgets.Mill; -import forestry.core.gadgets.TileBase; import forestry.core.proxy.Proxies; public class MillRainmaker extends Mill { @@ -29,7 +28,7 @@ public class MillRainmaker extends Mill { } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { if (!Proxies.common.isSimulating(player.worldObj)) { return; } @@ -71,7 +70,7 @@ public class MillRainmaker extends Mill { nbttagcompound.setBoolean("Reverse", reverse); } - public void addCharge(RainSubstrate substrate) { + private void addCharge(RainSubstrate substrate) { charge = 1; speed = substrate.speed; duration = substrate.duration; @@ -90,10 +89,10 @@ public class MillRainmaker extends Mill { float f3 = 0.52F; float f4 = worldObj.rand.nextFloat() * 0.6F - 0.3F; - Proxies.common.addEntityExplodeFX(worldObj, (f - f3), f1, (f2 + f4), 0F, 0F, 0F); - Proxies.common.addEntityExplodeFX(worldObj, (f + f3), f1, (f2 + f4), 0F, 0F, 0F); - Proxies.common.addEntityExplodeFX(worldObj, (f + f4), f1, (f2 - f3), 0F, 0F, 0F); - Proxies.common.addEntityExplodeFX(worldObj, (f + f4), f1, (f2 + f3), 0F, 0F, 0F); + Proxies.common.addEntityExplodeFX(worldObj, (f - f3), f1, (f2 + f4)); + Proxies.common.addEntityExplodeFX(worldObj, (f + f3), f1, (f2 + f4)); + Proxies.common.addEntityExplodeFX(worldObj, (f + f4), f1, (f2 - f3)); + Proxies.common.addEntityExplodeFX(worldObj, (f + f4), f1, (f2 + f3)); } if (Proxies.common.isSimulating(worldObj)) { diff --git a/src/main/java/forestry/factory/gadgets/TileWorktable.java b/src/main/java/forestry/factory/gadgets/TileWorktable.java index 242097fd8..6bacf1c0f 100755 --- a/src/main/java/forestry/factory/gadgets/TileWorktable.java +++ b/src/main/java/forestry/factory/gadgets/TileWorktable.java @@ -56,7 +56,7 @@ public class TileWorktable extends TileBase implements ICrafter { } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.WorktableGUI.ordinal(), player.worldObj, xCoord, yCoord, zCoord); } @@ -106,7 +106,7 @@ public class TileWorktable extends TileBase implements ICrafter { } public void chooseRecipe(int recipeIndex) { - if (recipeIndex >= memorized.capacity) { + if (recipeIndex >= RecipeMemory.capacity) { for (int slot = 0; slot < craftingInventory.getSizeInventory(); slot++) { craftingInventory.setInventorySlotContents(slot, null); } diff --git a/src/main/java/forestry/factory/gui/ContainerWorktable.java b/src/main/java/forestry/factory/gui/ContainerWorktable.java index 52dc930ab..15b67b810 100755 --- a/src/main/java/forestry/factory/gui/ContainerWorktable.java +++ b/src/main/java/forestry/factory/gui/ContainerWorktable.java @@ -27,6 +27,7 @@ import forestry.core.proxy.Proxies; import forestry.core.utils.StackUtils; import forestry.factory.gadgets.TileWorktable; import forestry.factory.network.PacketWorktableMemoryUpdate; +import forestry.factory.recipes.RecipeMemory; public class ContainerWorktable extends ContainerTile implements IContainerCrafting, IGuiSelectable { @@ -99,8 +100,8 @@ public class ContainerWorktable extends ContainerTile implements tile.setRecipe(craftMatrix); } - public void clearRecipe() { - sendRecipeClick(0, tile.getMemory().capacity); + public static void clearRecipe() { + sendRecipeClick(0, RecipeMemory.capacity); } public static void sendRecipeClick(int mouseButton, int recipeIndex) { diff --git a/src/main/java/forestry/factory/gui/GuiWorktable.java b/src/main/java/forestry/factory/gui/GuiWorktable.java index 192fa0575..52e9300df 100755 --- a/src/main/java/forestry/factory/gui/GuiWorktable.java +++ b/src/main/java/forestry/factory/gui/GuiWorktable.java @@ -76,7 +76,7 @@ public class GuiWorktable extends GuiForestryTitled InventoryCraftingAuto(T container, int i, int j) { - super(container, i, j); - int k = i * j; - stackList = new ItemStack[k]; - eventHandler = container; - inventoryWidth = i; - } - - @Override - public ItemStack getStackInSlot(int i) { - if (i >= getSizeInventory()) { - return null; - } else { - return stackList[i]; - } - } - - @Override - public ItemStack getStackInRowAndColumn(int i, int j) { - if (i < 0 || i >= inventoryWidth) { - return null; - } else { - int k = i + j * inventoryWidth; - return getStackInSlot(k); - } - } - - @Override - public ItemStack decrStackSize(int i, int j) { - if (stackList[i] != null) { - if (stackList[i].stackSize <= j) { - ItemStack itemstack = stackList[i]; - stackList[i] = null; - eventHandler.onCraftMatrixChanged(this, i); - return itemstack; - } - ItemStack itemstack1 = stackList[i].splitStack(j); - if (stackList[i].stackSize == 0) { - stackList[i] = null; - } - eventHandler.onCraftMatrixChanged(this, i); - return itemstack1; - } else { - return null; - } - } - - @Override - public void setInventorySlotContents(int i, ItemStack itemstack) { - stackList[i] = itemstack; - eventHandler.onCraftMatrixChanged(this, i); - } - - @Override - public String getInventoryName() { - return "Crafting"; - } - - @Override - public int getSizeInventory() { - return stackList.length; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public void markDirty() { - } - - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - return true; - } - - @Override - public void openInventory() { - } - - @Override - public void closeInventory() { - } - -} diff --git a/src/main/java/forestry/factory/recipes/RecipeMemory.java b/src/main/java/forestry/factory/recipes/RecipeMemory.java index 83d7be43f..05daf0112 100644 --- a/src/main/java/forestry/factory/recipes/RecipeMemory.java +++ b/src/main/java/forestry/factory/recipes/RecipeMemory.java @@ -146,6 +146,8 @@ public class RecipeMemory implements INBTTagable, IStreamable { } } + public static final int capacity = 9; + private static final Container DUMMY_CONTAINER = new ContainerDummy(); private static final List> memoryBlacklist = new ArrayList>(); @@ -155,7 +157,6 @@ public class RecipeMemory implements INBTTagable, IStreamable { private LinkedList recipes = new LinkedList(); private long lastUpdate; - public final int capacity = 9; private static boolean isValid(World world, Recipe recipe) { if (recipe == null) { @@ -225,7 +226,7 @@ public class RecipeMemory implements INBTTagable, IStreamable { } - public Recipe getRecipe(int recipeIndex) { + private Recipe getRecipe(int recipeIndex) { if (recipes.size() > recipeIndex) { return recipes.get(recipeIndex); } diff --git a/src/main/java/forestry/farming/FarmHelper.java b/src/main/java/forestry/farming/FarmHelper.java index 7f4774bf6..44c40bf5e 100755 --- a/src/main/java/forestry/farming/FarmHelper.java +++ b/src/main/java/forestry/farming/FarmHelper.java @@ -10,7 +10,6 @@ ******************************************************************************/ package forestry.farming; -import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -23,51 +22,12 @@ import forestry.core.vect.VectUtil; public class FarmHelper { - public static FarmDirection getOpposite(FarmDirection farmDirection) { + private static FarmDirection getOpposite(FarmDirection farmDirection) { ForgeDirection forgeDirection = farmDirection.getForgeDirection(); ForgeDirection forgeDirectionOpposite = forgeDirection.getOpposite(); return FarmDirection.getFarmDirection(forgeDirectionOpposite); } - public static int getFarmSizeNorthSouth(World world, Vect start) { - FarmDirection farmSide = FarmDirection.NORTH; - FarmDirection startSide = FarmDirection.EAST; - - Vect corner = getFarmMultiblockCorner(world, start, farmSide, startSide); - - return getFarmSizeInDirection(world, corner, farmSide, getOpposite(startSide)); - } - - public static int getFarmSizeEastWest(World world, Vect start) { - FarmDirection farmSide = FarmDirection.EAST; - FarmDirection startSide = FarmDirection.NORTH; - - Vect corner = getFarmMultiblockCorner(world, start, farmSide, startSide); - - return getFarmSizeInDirection(world, corner, farmSide, getOpposite(startSide)); - } - - private static int getFarmSizeInDirection(World world, Vect start, FarmDirection farmSide, FarmDirection searchDirection) { - int size = 0; - - FarmDirection toCenter = getOpposite(farmSide); - - Vect target = start.add(farmSide); - - TileEntity farmTile; - do { - size++; - - target = target.add(searchDirection); - - Vect farmTileLocation = target.add(toCenter); - farmTile = VectUtil.getTile(world, farmTileLocation); - - } while (farmTile instanceof IFarmComponent); - - return size; - } - public static Vect getFarmMultiblockCorner(World world, Vect start, FarmDirection farmSide, FarmDirection layoutDirection) { Vect edge = getFarmMultiblockEdge(world, start, farmSide); return getFarmMultiblockEdge(world, edge, getOpposite(layoutDirection)); diff --git a/src/main/java/forestry/farming/GuiHandlerFarming.java b/src/main/java/forestry/farming/GuiHandlerFarming.java index ae1484f18..3567529ca 100755 --- a/src/main/java/forestry/farming/GuiHandlerFarming.java +++ b/src/main/java/forestry/farming/GuiHandlerFarming.java @@ -15,7 +15,6 @@ import net.minecraft.world.World; import forestry.core.GuiHandlerBase; import forestry.core.network.GuiId; -import forestry.core.network.PacketId; import forestry.core.network.PacketSocketUpdate; import forestry.core.proxy.Proxies; import forestry.farming.gui.ContainerFarm; @@ -34,7 +33,7 @@ public class GuiHandlerFarming extends GuiHandlerBase { switch (GuiId.values()[id]) { case MultiFarmGUI: TileFarm tile = getTile(world, x, y, z, player, TileFarm.class); - Proxies.net.sendToPlayer(new PacketSocketUpdate(PacketId.SOCKET_UPDATE, tile), player); + Proxies.net.sendToPlayer(new PacketSocketUpdate(tile), player); return new ContainerFarm(player.inventory, tile); default: return null; diff --git a/src/main/java/forestry/farming/circuits/CircuitFarmLogic.java b/src/main/java/forestry/farming/circuits/CircuitFarmLogic.java index c1b16a58e..f54117ba1 100755 --- a/src/main/java/forestry/farming/circuits/CircuitFarmLogic.java +++ b/src/main/java/forestry/farming/circuits/CircuitFarmLogic.java @@ -36,7 +36,7 @@ public class CircuitFarmLogic extends Circuit { return tile instanceof IFarmHousing; } - IFarmHousing getCircuitable(Object tile) { + private IFarmHousing getCircuitable(Object tile) { if (!isCircuitable(tile)) { return null; } diff --git a/src/main/java/forestry/farming/gui/GuiFarm.java b/src/main/java/forestry/farming/gui/GuiFarm.java index cff75ee1b..38c326b65 100755 --- a/src/main/java/forestry/farming/gui/GuiFarm.java +++ b/src/main/java/forestry/farming/gui/GuiFarm.java @@ -26,7 +26,6 @@ import forestry.core.gui.tooltips.ToolTip; import forestry.core.gui.widgets.SocketWidget; import forestry.core.gui.widgets.TankWidget; import forestry.core.gui.widgets.Widget; -import forestry.core.interfaces.IClimatised; import forestry.core.proxy.Proxies; import forestry.core.utils.StringUtil; import forestry.farming.multiblock.IFarmController; diff --git a/src/main/java/forestry/farming/logic/Crop.java b/src/main/java/forestry/farming/logic/Crop.java index 8f370e348..64a837079 100755 --- a/src/main/java/forestry/farming/logic/Crop.java +++ b/src/main/java/forestry/farming/logic/Crop.java @@ -25,7 +25,7 @@ public abstract class Crop implements ICrop { protected final World world; protected final Vect position; - public Crop(World world, Vect position) { + protected Crop(World world, Vect position) { this.world = world; this.position = position; } @@ -34,13 +34,6 @@ public abstract class Crop implements ICrop { world.setBlock(position.x, position.y, position.z, block, meta, Defaults.FLAG_BLOCK_SYNCH); } - protected final void clearBlock(Vect position) { - world.setBlockToAir(position.x, position.y, position.z); - if (world.getTileEntity(position.x, position.y, position.z) != null) { - world.setTileEntity(position.x, position.y, position.z, null); - } - } - protected final Block getBlock(Vect position) { return world.getBlock(position.x, position.y, position.z); } @@ -49,10 +42,6 @@ public abstract class Crop implements ICrop { return world.getBlockMetadata(position.x, position.y, position.z); } - protected final ItemStack getAsItemStack(Vect position) { - return new ItemStack(getBlock(position), 1, getBlockMeta(position)); - } - protected abstract boolean isCrop(Vect pos); protected abstract Collection harvestBlock(Vect pos); diff --git a/src/main/java/forestry/farming/logic/CropBasicAgriCraft.java b/src/main/java/forestry/farming/logic/CropBasicAgriCraft.java index 2aea9cced..ebfc62223 100644 --- a/src/main/java/forestry/farming/logic/CropBasicAgriCraft.java +++ b/src/main/java/forestry/farming/logic/CropBasicAgriCraft.java @@ -24,8 +24,8 @@ import forestry.core.vect.Vect; public class CropBasicAgriCraft extends Crop { - protected final Block block; - protected final int meta; + private final Block block; + private final int meta; public CropBasicAgriCraft(World world, Block block, int meta, Vect position) { super(world, position); diff --git a/src/main/java/forestry/farming/logic/CropBasicFruit.java b/src/main/java/forestry/farming/logic/CropBasicFruit.java index f46a872ea..c65c2b378 100644 --- a/src/main/java/forestry/farming/logic/CropBasicFruit.java +++ b/src/main/java/forestry/farming/logic/CropBasicFruit.java @@ -22,8 +22,8 @@ import forestry.core.vect.Vect; public class CropBasicFruit extends Crop { - protected final Block block; - protected final int meta; + private final Block block; + private final int meta; public CropBasicFruit(World world, Block block, int meta, Vect position) { super(world, position); diff --git a/src/main/java/forestry/farming/logic/CropFruit.java b/src/main/java/forestry/farming/logic/CropFruit.java index 1700b3090..86b27391a 100755 --- a/src/main/java/forestry/farming/logic/CropFruit.java +++ b/src/main/java/forestry/farming/logic/CropFruit.java @@ -18,18 +18,14 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import forestry.api.genetics.IFruitBearer; -import forestry.api.genetics.IFruitFamily; import forestry.core.network.PacketFXSignal; import forestry.core.proxy.Proxies; import forestry.core.vect.Vect; public class CropFruit extends Crop { - private final IFruitFamily family; - - public CropFruit(World world, Vect position, IFruitFamily family) { + public CropFruit(World world, Vect position) { super(world, position); - this.family = family; } @Override diff --git a/src/main/java/forestry/farming/logic/FarmLogic.java b/src/main/java/forestry/farming/logic/FarmLogic.java index 783a8fadc..18e82a80d 100755 --- a/src/main/java/forestry/farming/logic/FarmLogic.java +++ b/src/main/java/forestry/farming/logic/FarmLogic.java @@ -29,7 +29,7 @@ public abstract class FarmLogic implements IFarmLogic { protected boolean isManual; - public FarmLogic(IFarmHousing housing) { + protected FarmLogic(IFarmHousing housing) { this.housing = housing; } diff --git a/src/main/java/forestry/farming/logic/FarmLogicCrops.java b/src/main/java/forestry/farming/logic/FarmLogicCrops.java index e02d0b37c..ec3d22f5d 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicCrops.java +++ b/src/main/java/forestry/farming/logic/FarmLogicCrops.java @@ -38,7 +38,7 @@ public abstract class FarmLogicCrops extends FarmLogicWatered { private final Iterable seeds; private static final ItemStack farmland = new ItemStack(Blocks.farmland, 1, Defaults.WILDCARD); - public FarmLogicCrops(IFarmHousing housing, Iterable seeds) { + protected FarmLogicCrops(IFarmHousing housing, Iterable seeds) { super(housing, new ItemStack(Blocks.dirt), new ItemStack(Blocks.farmland)); this.seeds = seeds; @@ -59,7 +59,7 @@ public abstract class FarmLogicCrops extends FarmLogicWatered { return false; } - public boolean isWindfall(ItemStack itemstack) { + private boolean isWindfall(ItemStack itemstack) { for (IFarmable germling : seeds) { if (germling.isWindfall(itemstack)) { return true; diff --git a/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java b/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java index 60c32b40e..1c7ffe9b3 100644 --- a/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java +++ b/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java @@ -27,20 +27,20 @@ import forestry.farming.gadgets.StructureLogicFarm; public abstract class FarmLogicHomogeneous extends FarmLogic { - protected final ItemStack resource; - protected final ItemStack soilBlock; + private final ItemStack resource; + private final ItemStack soilBlock; protected final Iterable germlings; ArrayList produce = new ArrayList(); - public FarmLogicHomogeneous(IFarmHousing housing, ItemStack resource, ItemStack soilBlock, Iterable germlings) { + protected FarmLogicHomogeneous(IFarmHousing housing, ItemStack resource, ItemStack soilBlock, Iterable germlings) { super(housing); this.resource = resource; this.soilBlock = soilBlock; this.germlings = germlings; } - public boolean isAcceptedSoil(ItemStack itemStack) { + protected boolean isAcceptedSoil(ItemStack itemStack) { return StackUtils.isIdenticalItem(soilBlock, itemStack); } @@ -59,7 +59,7 @@ public abstract class FarmLogicHomogeneous extends FarmLogic { return false; } - public boolean isWindfall(ItemStack itemstack) { + protected boolean isWindfall(ItemStack itemstack) { for (IFarmable germling : germlings) { if (germling.isWindfall(itemstack)) { return true; diff --git a/src/main/java/forestry/farming/logic/FarmLogicOrchard.java b/src/main/java/forestry/farming/logic/FarmLogicOrchard.java index 29ba8df8d..6ab8bc965 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicOrchard.java +++ b/src/main/java/forestry/farming/logic/FarmLogicOrchard.java @@ -208,7 +208,7 @@ public class FarmLogicOrchard extends FarmLogic { return false; } - private boolean isBlockTraversable(World world, Vect position, ImmutableList traversalBlocks) { + private static boolean isBlockTraversable(World world, Vect position, ImmutableList traversalBlocks) { Block candidate = VectUtil.getBlock(world, position); for (Block block : traversalBlocks) { @@ -226,7 +226,7 @@ public class FarmLogicOrchard extends FarmLogic { if (tile instanceof IFruitBearer) { IFruitBearer fruitBearer = (IFruitBearer) tile; if (fruitBearer.hasFruit() && fruitBearer.getRipeness() >= 0.9f) { - return new CropFruit(world, position, fruitBearer.getFruitFamily()); + return new CropFruit(world, position); } } else { for (IFarmable seed : farmables) { diff --git a/src/main/java/forestry/farming/logic/FarmLogicWatered.java b/src/main/java/forestry/farming/logic/FarmLogicWatered.java index da92eb223..0f96f1f04 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicWatered.java +++ b/src/main/java/forestry/farming/logic/FarmLogicWatered.java @@ -39,7 +39,7 @@ public abstract class FarmLogicWatered extends FarmLogic { ArrayList produce = new ArrayList(); - public FarmLogicWatered(IFarmHousing housing, ItemStack resource, ItemStack ground) { + protected FarmLogicWatered(IFarmHousing housing, ItemStack resource, ItemStack ground) { super(housing); this.ground = ground; this.resource = resource; @@ -55,7 +55,7 @@ public abstract class FarmLogicWatered extends FarmLogic { return (int) (20 * hydrationModifier); } - public boolean isAcceptedGround(ItemStack ground) { + protected boolean isAcceptedGround(ItemStack ground) { return StackUtils.isIdenticalItem(this.ground, ground); } diff --git a/src/main/java/forestry/farming/logic/FarmableCocoa.java b/src/main/java/forestry/farming/logic/FarmableCocoa.java index 1240af319..8d4513fac 100755 --- a/src/main/java/forestry/farming/logic/FarmableCocoa.java +++ b/src/main/java/forestry/farming/logic/FarmableCocoa.java @@ -25,7 +25,7 @@ import forestry.core.vect.Vect; public class FarmableCocoa implements IFarmable { - public static final Block COCOA_PLANT = Blocks.cocoa; + private static final Block COCOA_PLANT = Blocks.cocoa; public static final Item COCOA_SEED = Items.dye; public static final int COCOA_META = 3; diff --git a/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java b/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java index 2ea895dca..b950a8239 100755 --- a/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java +++ b/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java @@ -17,7 +17,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import forestry.api.farming.ICrop; -import forestry.core.config.Defaults; import forestry.core.config.ForestryBlock; import forestry.core.proxy.Proxies; import forestry.core.utils.StackUtils; @@ -48,7 +47,7 @@ public class FarmableVanillaShroom extends FarmableGenericSapling { } Proxies.common.addBlockPlaceEffects(world, x, y, z, Blocks.brown_mushroom, 0); - return ForestryBlock.mushroom.setBlock(world, x, y, z, meta, Defaults.FLAG_BLOCK_SYNCH); + return ForestryBlock.mushroom.setBlock(world, x, y, z, meta); } } diff --git a/src/main/java/forestry/farming/multiblock/BlockFarm.java b/src/main/java/forestry/farming/multiblock/BlockFarm.java index bae0484a6..e4a00c46a 100644 --- a/src/main/java/forestry/farming/multiblock/BlockFarm.java +++ b/src/main/java/forestry/farming/multiblock/BlockFarm.java @@ -79,8 +79,8 @@ public class BlockFarm extends BlockStructure { } @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack) { - super.onBlockPlacedBy(world, x, y, z, entityliving, stack); + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack) { + super.onBlockPlacedBy(world, x, y, z, entityLiving, stack); if (!stack.hasTagCompound()) { return; } @@ -162,17 +162,17 @@ public class BlockFarm extends BlockStructure { @Override @SideOnly(Side.CLIENT) public void addHitEffects(EntityDiggingFX fx, World world, int x, int y, int z, int meta) { - setTexture(fx, world, x, y, z, meta); + setTexture(fx, world, x, y, z); } @Override @SideOnly(Side.CLIENT) public void addDestroyEffects(EntityDiggingFX fx, World world, int x, int y, int z, int meta) { - setTexture(fx, world, x, y, z, meta); + setTexture(fx, world, x, y, z); } @SideOnly(Side.CLIENT) - private void setTexture(EntityDiggingFX fx, World world, int x, int y, int z, int meta) { + private static void setTexture(EntityDiggingFX fx, World world, int x, int y, int z) { fx.setParticleIcon(instance.getIcon(world, x, y, z, 0)); } } @@ -194,11 +194,11 @@ public class BlockFarm extends BlockStructure { @SideOnly(Side.CLIENT) @Override public IIcon getIcon(int side, int metadata) { - return getBlockTextureFromSideAndMetadata(EnumFarmBlockTexture.BRICK, side, metadata); + return getBlockTextureForSide(EnumFarmBlockTexture.BRICK, side); } @SideOnly(Side.CLIENT) - public IIcon getBlockTextureFromSideAndMetadata(EnumFarmBlockTexture type, int side, int metadata) { + public static IIcon getBlockTextureForSide(EnumFarmBlockTexture type, int side) { Block block = StackUtils.getBlock(type.getBase()); if (block == null) { return null; @@ -208,28 +208,27 @@ public class BlockFarm extends BlockStructure { } @SideOnly(Side.CLIENT) - public IIcon getOverlayTextureForBlock(int side, int metadata) { + public static IIcon getOverlayTextureForBlock(int side, int metadata) { - EnumFarmBlockTexture type = EnumFarmBlockTexture.BRICK_STONE; if (metadata == 0 && side == 2) { - return type.getIcon(TileFarm.TYPE_REVERSE); + return EnumFarmBlockTexture.getIcon(TileFarm.TYPE_REVERSE); } else if (metadata == 0 && (side == 0 || side == 1)) { - return type.getIcon(TileFarm.TYPE_TOP); + return EnumFarmBlockTexture.getIcon(TileFarm.TYPE_TOP); } switch (metadata) { case 1: - return type.getIcon(TileFarm.TYPE_BAND); + return EnumFarmBlockTexture.getIcon(TileFarm.TYPE_BAND); case 2: - return type.getIcon(TileFarm.TYPE_GEARS); + return EnumFarmBlockTexture.getIcon(TileFarm.TYPE_GEARS); case 3: - return type.getIcon(TileFarm.TYPE_HATCH); + return EnumFarmBlockTexture.getIcon(TileFarm.TYPE_HATCH); case 4: - return type.getIcon(TileFarm.TYPE_VALVE); + return EnumFarmBlockTexture.getIcon(TileFarm.TYPE_VALVE); case 5: - return type.getIcon(TileFarm.TYPE_CONTROL); + return EnumFarmBlockTexture.getIcon(TileFarm.TYPE_CONTROL); default: - return type.getIcon(TileFarm.TYPE_PLAIN); + return EnumFarmBlockTexture.getIcon(TileFarm.TYPE_PLAIN); } } diff --git a/src/main/java/forestry/farming/multiblock/EnumFarmBlockTexture.java b/src/main/java/forestry/farming/multiblock/EnumFarmBlockTexture.java index 0d948cd4d..e7f802772 100644 --- a/src/main/java/forestry/farming/multiblock/EnumFarmBlockTexture.java +++ b/src/main/java/forestry/farming/multiblock/EnumFarmBlockTexture.java @@ -62,7 +62,7 @@ public enum EnumFarmBlockTexture { } @SideOnly(Side.CLIENT) - public IIcon getIcon(int type) { + public static IIcon getIcon(int type) { return icons.get(type); } diff --git a/src/main/java/forestry/farming/multiblock/FarmController.java b/src/main/java/forestry/farming/multiblock/FarmController.java index aad29c408..5189b0e70 100644 --- a/src/main/java/forestry/farming/multiblock/FarmController.java +++ b/src/main/java/forestry/farming/multiblock/FarmController.java @@ -87,7 +87,7 @@ public class FarmController extends RectangularMultiblockControllerBase implemen } } - public static FarmDirection getLayoutDirection(FarmDirection farmSide) { + private static FarmDirection getLayoutDirection(FarmDirection farmSide) { switch (farmSide) { case NORTH: return FarmDirection.WEST; @@ -153,7 +153,7 @@ public class FarmController extends RectangularMultiblockControllerBase implemen return tankManager; } - public BiomeGenBase getBiome() { + private BiomeGenBase getBiome() { if (cachedBiome == null) { CoordTriplet coords = getReferenceCoord(); cachedBiome = worldObj.getBiomeGenForCoords(coords.x, coords.z); diff --git a/src/main/java/forestry/farming/multiblock/TileFarm.java b/src/main/java/forestry/farming/multiblock/TileFarm.java index a8debe282..45531526a 100644 --- a/src/main/java/forestry/farming/multiblock/TileFarm.java +++ b/src/main/java/forestry/farming/multiblock/TileFarm.java @@ -16,12 +16,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - import forestry.api.core.ForestryAPI; import forestry.api.core.IErrorLogic; import forestry.api.core.IErrorLogicSource; @@ -94,11 +90,6 @@ public abstract class TileFarm extends RectangularMultiblockTileEntityBase imple return farmBlockTexture; } - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) { - return null; - } - /* TILEFORESTRY */ @Override diff --git a/src/main/java/forestry/farming/multiblock/TileGearbox.java b/src/main/java/forestry/farming/multiblock/TileGearbox.java index 2d6e48897..5f9593d36 100644 --- a/src/main/java/forestry/farming/multiblock/TileGearbox.java +++ b/src/main/java/forestry/farming/multiblock/TileGearbox.java @@ -22,7 +22,7 @@ import forestry.energy.EnergyManager; public class TileGearbox extends TileFarm implements IPowerHandler, IFarmComponent.Active { - public static final int WORK_CYCLES = 4; + private static final int WORK_CYCLES = 4; private final EnergyManager energyManager; diff --git a/src/main/java/forestry/farming/render/FarmItemRenderer.java b/src/main/java/forestry/farming/render/FarmItemRenderer.java index f874dd961..f2e677fce 100755 --- a/src/main/java/forestry/farming/render/FarmItemRenderer.java +++ b/src/main/java/forestry/farming/render/FarmItemRenderer.java @@ -24,7 +24,7 @@ import forestry.farming.multiblock.EnumFarmBlockTexture; public class FarmItemRenderer implements IItemRenderer { - private void renderFarmBlock(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { + private static void renderFarmBlock(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); @@ -45,38 +45,38 @@ public class FarmItemRenderer implements IItemRenderer { tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1F, 0.0F); - render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(type, 0, item.getItemDamage())); - render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getOverlayTextureForBlock(0, item.getItemDamage())); + render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, BlockFarm.getBlockTextureForSide(type, 0)); + render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, BlockFarm.getOverlayTextureForBlock(0, item.getItemDamage())); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); - render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(type, 1, item.getItemDamage())); - render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getOverlayTextureForBlock(1, item.getItemDamage())); + render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, BlockFarm.getBlockTextureForSide(type, 1)); + render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, BlockFarm.getOverlayTextureForBlock(1, item.getItemDamage())); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1F); - render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(type, 2, item.getItemDamage())); - render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getOverlayTextureForBlock(2, item.getItemDamage())); + render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, BlockFarm.getBlockTextureForSide(type, 2)); + render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, BlockFarm.getOverlayTextureForBlock(2, item.getItemDamage())); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); - render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(type, 3, item.getItemDamage())); - render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getOverlayTextureForBlock(3, item.getItemDamage())); + render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, BlockFarm.getBlockTextureForSide(type, 3)); + render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, BlockFarm.getOverlayTextureForBlock(3, item.getItemDamage())); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(-1F, 0.0F, 0.0F); - render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(type, 4, item.getItemDamage())); - render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getOverlayTextureForBlock(4, item.getItemDamage())); + render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, BlockFarm.getBlockTextureForSide(type, 4)); + render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, BlockFarm.getOverlayTextureForBlock(4, item.getItemDamage())); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); - render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(type, 5, item.getItemDamage())); - render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getOverlayTextureForBlock(5, item.getItemDamage())); + render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, BlockFarm.getBlockTextureForSide(type, 5)); + render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, BlockFarm.getOverlayTextureForBlock(5, item.getItemDamage())); tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); diff --git a/src/main/java/forestry/farming/render/FarmRenderingHandler.java b/src/main/java/forestry/farming/render/FarmRenderingHandler.java index a6b6b3ae9..1056e0d0d 100755 --- a/src/main/java/forestry/farming/render/FarmRenderingHandler.java +++ b/src/main/java/forestry/farming/render/FarmRenderingHandler.java @@ -11,7 +11,6 @@ package forestry.farming.render; import net.minecraft.block.Block; -import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.world.IBlockAccess; @@ -31,45 +30,26 @@ public class FarmRenderingHandler extends OverlayRenderingHandler { // Render the plain block. renderer.renderStandardBlock(block, x, y, z); - renderFarmOverlay(world, (BlockFarm) ForestryBlock.farm.block(), x, y, z, renderer, 0xffffff); + renderFarmOverlay(world, (BlockFarm) ForestryBlock.farm.block(), x, y, z, renderer); return true; } - private boolean renderFarmOverlay(IBlockAccess world, BlockFarm block, int x, int y, int z, RenderBlocks renderer, int multiplier) { - - float mR = (multiplier >> 16 & 255) / 255.0F; - float mG = (multiplier >> 8 & 255) / 255.0F; - float mB = (multiplier & 255) / 255.0F; - - if (EntityRenderer.anaglyphEnable) { - mR = (mR * 30.0F + mG * 59.0F + mB * 11.0F) / 100.0F; - mG = (mR * 30.0F + mG * 70.0F) / 100.0F; - mB = (mR * 30.0F + mB * 70.0F) / 100.0F; - } - - return renderFarmOverlayWithColourMultiplier(world, block, x, y, z, mR, mG, mB, renderer); - } - - private boolean renderFarmOverlayWithColourMultiplier(IBlockAccess world, BlockFarm block, int x, int y, int z, float r, float g, float b, - RenderBlocks renderer) { - + private static void renderFarmOverlay(IBlockAccess world, BlockFarm block, int x, int y, int z, RenderBlocks renderer) { int mixedBrightness = block.getMixedBrightnessForBlock(world, x, y, z); int metadata = world.getBlockMetadata(x, y, z); - float adjR = 0.5f * r; - float adjG = 0.5f * g; - float adjB = 0.5f * b; + float adjR = 0.5f; + float adjG = 0.5f; + float adjB = 0.5f; // Bottom - renderBottomFace(world, block, x, y, z, renderer, block.getOverlayTextureForBlock(0, metadata), mixedBrightness, adjR, adjG, adjB); - renderTopFace(world, block, x, y, z, renderer, block.getOverlayTextureForBlock(1, metadata), mixedBrightness, adjR, adjG, adjB); - renderEastFace(world, block, x, y, z, renderer, block.getOverlayTextureForBlock(2, metadata), mixedBrightness, adjR, adjG, adjB); - renderWestFace(world, block, x, y, z, renderer, block.getOverlayTextureForBlock(3, metadata), mixedBrightness, adjR, adjG, adjB); - renderNorthFace(world, block, x, y, z, renderer, block.getOverlayTextureForBlock(4, metadata), mixedBrightness, adjR, adjG, adjB); - renderSouthFace(world, block, x, y, z, renderer, block.getOverlayTextureForBlock(5, metadata), mixedBrightness, adjR, adjG, adjB); - - return true; + renderBottomFace(world, block, x, y, z, renderer, BlockFarm.getOverlayTextureForBlock(0, metadata), mixedBrightness, adjR, adjG, adjB); + renderTopFace(world, block, x, y, z, renderer, BlockFarm.getOverlayTextureForBlock(1, metadata), mixedBrightness, adjR, adjG, adjB); + renderEastFace(world, block, x, y, z, renderer, BlockFarm.getOverlayTextureForBlock(2, metadata), mixedBrightness, adjR, adjG, adjB); + renderWestFace(world, block, x, y, z, renderer, BlockFarm.getOverlayTextureForBlock(3, metadata), mixedBrightness, adjR, adjG, adjB); + renderNorthFace(world, block, x, y, z, renderer, BlockFarm.getOverlayTextureForBlock(4, metadata), mixedBrightness, adjR, adjG, adjB); + renderSouthFace(world, block, x, y, z, renderer, BlockFarm.getOverlayTextureForBlock(5, metadata), mixedBrightness, adjR, adjG, adjB); } @Override diff --git a/src/main/java/forestry/food/BeverageEffect.java b/src/main/java/forestry/food/BeverageEffect.java index 813e250b7..b6ec77cd5 100755 --- a/src/main/java/forestry/food/BeverageEffect.java +++ b/src/main/java/forestry/food/BeverageEffect.java @@ -23,7 +23,7 @@ public abstract class BeverageEffect implements IBeverageEffect { private final int id; protected String description; - public BeverageEffect(int id) { + protected BeverageEffect(int id) { this.id = id; if (BeverageManager.effectList[id] != null) { @@ -38,7 +38,7 @@ public abstract class BeverageEffect implements IBeverageEffect { return this.id; } - public String getLevel() { + protected String getLevel() { return null; } diff --git a/src/main/java/forestry/food/items/ItemBeverage.java b/src/main/java/forestry/food/items/ItemBeverage.java index 3eea971c4..089570da4 100755 --- a/src/main/java/forestry/food/items/ItemBeverage.java +++ b/src/main/java/forestry/food/items/ItemBeverage.java @@ -10,6 +10,8 @@ ******************************************************************************/ package forestry.food.items; +import java.util.Arrays; +import java.util.Collections; import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; @@ -69,18 +71,18 @@ public class ItemBeverage extends ItemForestryFood { iconContents = TextureManager.getInstance().registerTex(register, "liquids/" + iconType + ".contents"); } - public IBeverageEffect[] loadEffects(ItemStack stack) { - IBeverageEffect[] effects = new IBeverageEffect[0]; + public static List loadEffects(ItemStack stack) { + List effectsList = Collections.emptyList(); NBTTagCompound nbttagcompound = stack.getTagCompound(); if (nbttagcompound == null) { - return effects; + return effectsList; } if (nbttagcompound.hasKey("E")) { int effectLength = nbttagcompound.getInteger("L"); NBTTagList nbttaglist = nbttagcompound.getTagList("E", 10); - effects = new IBeverageEffect[effectLength]; + IBeverageEffect[] effects = new IBeverageEffect[effectLength]; for (int i = 0; i < nbttaglist.tagCount(); i++) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); byte byte0 = nbttagcompound1.getByte("S"); @@ -88,21 +90,23 @@ public class ItemBeverage extends ItemForestryFood { effects[byte0] = BeverageManager.effectList[nbttagcompound1.getInteger("ID")]; } } + effectsList = Arrays.asList(effects); } - return effects; + return effectsList; } - public void saveEffects(ItemStack stack, IBeverageEffect[] effects) { + public static void saveEffects(ItemStack stack, List effects) { NBTTagCompound nbttagcompound = new NBTTagCompound(); NBTTagList nbttaglist = new NBTTagList(); - nbttagcompound.setInteger("L", effects.length); - for (int i = 0; i < effects.length; i++) { - if (effects[i] != null) { + nbttagcompound.setInteger("L", effects.size()); + for (int i = 0; i < effects.size(); i++) { + IBeverageEffect effect = effects.get(i); + if (effect != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("S", (byte) i); - nbttagcompound1.setInteger("ID", effects[i].getId()); + nbttagcompound1.setInteger("ID", effect.getId()); nbttaglist.appendTag(nbttagcompound1); } } @@ -132,9 +136,7 @@ public class ItemBeverage extends ItemForestryFood { @Override public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) { - int meta = itemstack.getItemDamage(); - BeverageInfo beverage = beverages[meta]; - IBeverageEffect[] effects = beverage.loadEffects(itemstack); + List effects = BeverageInfo.loadEffects(itemstack); itemstack.stackSize--; entityplayer.getFoodStats().func_151686_a(this, itemstack); @@ -200,9 +202,7 @@ public class ItemBeverage extends ItemForestryFood { @SuppressWarnings({"rawtypes", "unchecked"}) @Override public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) { - int meta = itemstack.getItemDamage(); - BeverageInfo beverage = beverages[meta]; - IBeverageEffect[] effects = beverage.loadEffects(itemstack); + List effects = BeverageInfo.loadEffects(itemstack); for (IBeverageEffect effect : effects) { if (effect.getDescription() != null) { diff --git a/src/main/java/forestry/food/items/ItemInfuser.java b/src/main/java/forestry/food/items/ItemInfuser.java index b9951ec0a..47456c3d6 100755 --- a/src/main/java/forestry/food/items/ItemInfuser.java +++ b/src/main/java/forestry/food/items/ItemInfuser.java @@ -12,6 +12,7 @@ package forestry.food.items; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -180,8 +181,7 @@ public class ItemInfuser extends ItemForestry { @Override public ItemStack getSeasoned(ItemStack base, ItemStack[] ingredients) { Mixture[] mixtures = getMatchingMixtures(ingredients); - ArrayList effects = new ArrayList(); - effects.addAll(Arrays.asList(((ItemBeverage) base.getItem()).beverages[base.getItemDamage()].loadEffects(base))); + List effects = ItemBeverage.BeverageInfo.loadEffects(base); int weight = 0; int meta = 0; @@ -195,7 +195,7 @@ public class ItemInfuser extends ItemForestry { ItemStack seasoned = base.copy(); seasoned.setItemDamage(meta); - ((ItemBeverage) base.getItem()).beverages[meta].saveEffects(seasoned, effects.toArray(new IBeverageEffect[effects.size()])); + ItemBeverage.BeverageInfo.saveEffects(seasoned, effects); return seasoned; } } diff --git a/src/main/java/forestry/lepidopterology/ButterflySpawner.java b/src/main/java/forestry/lepidopterology/ButterflySpawner.java index 4be79eba0..ac8611fc9 100755 --- a/src/main/java/forestry/lepidopterology/ButterflySpawner.java +++ b/src/main/java/forestry/lepidopterology/ButterflySpawner.java @@ -54,7 +54,7 @@ public class ButterflySpawner implements ILeafTickHandler { return false; } - private void attemptButterflySpawn(World world, IButterfly butterfly, double x, double y, double z) { + private static void attemptButterflySpawn(World world, IButterfly butterfly, double x, double y, double z) { if (PluginLepidopterology.butterflyInterface.spawnButterflyInWorld(world, butterfly.copy(), x, y + 0.1f, z) != null) { Proxies.log.finest("Spawned a butterfly '%s' at %s/%s/%s.", butterfly.getDisplayName(), x, y, z); } diff --git a/src/main/java/forestry/lepidopterology/MatingRecipe.java b/src/main/java/forestry/lepidopterology/MatingRecipe.java index 198de9522..36d01f9f4 100755 --- a/src/main/java/forestry/lepidopterology/MatingRecipe.java +++ b/src/main/java/forestry/lepidopterology/MatingRecipe.java @@ -22,7 +22,7 @@ import forestry.plugins.PluginLepidopterology; public class MatingRecipe implements IRecipe { private final ItemStack unknown; - ItemStack cached; + private ItemStack cached; public MatingRecipe() { unknown = PluginLepidopterology.butterflyInterface.getMemberStack(PluginLepidopterology.butterflyInterface.getIndividualTemplates().get(0), EnumFlutterType.BUTTERFLY.ordinal()); diff --git a/src/main/java/forestry/lepidopterology/entities/AIButterflyBase.java b/src/main/java/forestry/lepidopterology/entities/AIButterflyBase.java index d2564942e..fd9a366e9 100755 --- a/src/main/java/forestry/lepidopterology/entities/AIButterflyBase.java +++ b/src/main/java/forestry/lepidopterology/entities/AIButterflyBase.java @@ -20,7 +20,7 @@ public abstract class AIButterflyBase extends EntityAIBase { protected final EntityButterfly entity; - public AIButterflyBase(EntityButterfly entity) { + protected AIButterflyBase(EntityButterfly entity) { this.entity = entity; } @@ -53,7 +53,7 @@ public abstract class AIButterflyBase extends EntityAIBase { } } - protected boolean validateDestination(ChunkCoordinates dest, boolean allowFluids) { + private boolean validateDestination(ChunkCoordinates dest, boolean allowFluids) { if (dest.posY < 1) { return false; } diff --git a/src/main/java/forestry/lepidopterology/entities/AIButterflyInteract.java b/src/main/java/forestry/lepidopterology/entities/AIButterflyInteract.java index ffd99acd3..55ddb41da 100755 --- a/src/main/java/forestry/lepidopterology/entities/AIButterflyInteract.java +++ b/src/main/java/forestry/lepidopterology/entities/AIButterflyInteract.java @@ -21,7 +21,7 @@ public abstract class AIButterflyInteract extends AIButterflyBase { private boolean canInteract = false; private boolean hasInteracted = false; - public AIButterflyInteract(EntityButterfly entity) { + protected AIButterflyInteract(EntityButterfly entity) { super(entity); setMutexBits(3); } diff --git a/src/main/java/forestry/lepidopterology/entities/AIButterflyMovement.java b/src/main/java/forestry/lepidopterology/entities/AIButterflyMovement.java index eceeb80ea..52c513d56 100644 --- a/src/main/java/forestry/lepidopterology/entities/AIButterflyMovement.java +++ b/src/main/java/forestry/lepidopterology/entities/AIButterflyMovement.java @@ -19,7 +19,7 @@ public abstract class AIButterflyMovement extends AIButterflyBase { protected ChunkCoordinates flightTarget; - public AIButterflyMovement(EntityButterfly entity) { + protected AIButterflyMovement(EntityButterfly entity) { super(entity); } diff --git a/src/main/java/forestry/lepidopterology/entities/AIButterflyRest.java b/src/main/java/forestry/lepidopterology/entities/AIButterflyRest.java index bf9a9b32b..6ee140d84 100755 --- a/src/main/java/forestry/lepidopterology/entities/AIButterflyRest.java +++ b/src/main/java/forestry/lepidopterology/entities/AIButterflyRest.java @@ -94,14 +94,14 @@ public class AIButterflyRest extends AIButterflyBase { return isRest(block) || block.isLeaves(entity.worldObj, x, y - 1, z); } - private boolean isRest(Block block) { + private static boolean isRest(Block block) { if (block instanceof BlockFence) { return true; } return block instanceof BlockWall; } - private boolean isPlant(Block block) { + private static boolean isPlant(Block block) { if (block instanceof BlockFlower) { return true; } else if (block instanceof IPlantable) { diff --git a/src/main/java/forestry/lepidopterology/entities/EntityButterfly.java b/src/main/java/forestry/lepidopterology/entities/EntityButterfly.java index 13efaab7d..416c7840e 100755 --- a/src/main/java/forestry/lepidopterology/entities/EntityButterfly.java +++ b/src/main/java/forestry/lepidopterology/entities/EntityButterfly.java @@ -108,7 +108,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly public int cooldownPollination = 0; public int cooldownEgg = 0; - public int lifespanRemaining = 24000 * 7; // one minecraft week in ticks + private int lifespanRemaining = 24000 * 7; // one minecraft week in ticks /* CONSTRUCTOR */ public EntityButterfly(World world) { @@ -305,7 +305,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly setSize(getScale(), 0.2f); } - public EntityButterfly setIndividual(IButterfly butterfly) { + private EntityButterfly setIndividual(IButterfly butterfly) { if (butterfly != null) { contained = butterfly; } else { diff --git a/src/main/java/forestry/lepidopterology/genetics/AlleleButterflySpecies.java b/src/main/java/forestry/lepidopterology/genetics/AlleleButterflySpecies.java index 6b0b26b4f..5054776b6 100755 --- a/src/main/java/forestry/lepidopterology/genetics/AlleleButterflySpecies.java +++ b/src/main/java/forestry/lepidopterology/genetics/AlleleButterflySpecies.java @@ -75,8 +75,8 @@ public class AlleleButterflySpecies extends AlleleSpecies implements IAlleleButt return this; } - public AlleleButterflySpecies setNocturnal(boolean isActualNocturnal) { - this.isActualNocturnal = isActualNocturnal; + public AlleleButterflySpecies setNocturnal() { + this.isActualNocturnal = true; return this; } diff --git a/src/main/java/forestry/lepidopterology/genetics/Butterfly.java b/src/main/java/forestry/lepidopterology/genetics/Butterfly.java index 94c36660b..2dbe2b5b8 100755 --- a/src/main/java/forestry/lepidopterology/genetics/Butterfly.java +++ b/src/main/java/forestry/lepidopterology/genetics/Butterfly.java @@ -50,8 +50,8 @@ public class Butterfly extends IndividualLiving implements IButterfly { private static final Random rand = new Random(); - public IButterflyGenome genome; - public IButterflyGenome mate; + private IButterflyGenome genome; + private IButterflyGenome mate; /* CONSTRUCTOR */ public Butterfly(NBTTagCompound nbttagcompound) { diff --git a/src/main/java/forestry/lepidopterology/genetics/ButterflyHelper.java b/src/main/java/forestry/lepidopterology/genetics/ButterflyHelper.java index e4b4e2be2..7ae49c9a7 100755 --- a/src/main/java/forestry/lepidopterology/genetics/ButterflyHelper.java +++ b/src/main/java/forestry/lepidopterology/genetics/ButterflyHelper.java @@ -43,7 +43,7 @@ import forestry.plugins.PluginLepidopterology; public class ButterflyHelper extends SpeciesRoot implements IButterflyRoot { - public static int butterflySpeciesCount = -1; + private static int butterflySpeciesCount = -1; public static final String UID = "rootButterflies"; @Override @@ -183,7 +183,7 @@ public class ButterflyHelper extends SpeciesRoot implements IButterflyRoot { } /* TEMPLATES */ - public static final ArrayList butterflyTemplates = new ArrayList(); + private static final ArrayList butterflyTemplates = new ArrayList(); @Override public ArrayList getIndividualTemplates() { diff --git a/src/main/java/forestry/lepidopterology/genetics/ButterflyTemplates.java b/src/main/java/forestry/lepidopterology/genetics/ButterflyTemplates.java index 237cd3186..4248de879 100755 --- a/src/main/java/forestry/lepidopterology/genetics/ButterflyTemplates.java +++ b/src/main/java/forestry/lepidopterology/genetics/ButterflyTemplates.java @@ -98,7 +98,6 @@ public class ButterflyTemplates { IAllele[] alleles = getDefaultTemplate(); Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiSpeckledWood); Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 2); - ; return alleles; } @@ -106,7 +105,6 @@ public class ButterflyTemplates { IAllele[] alleles = getDefaultTemplate(); Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiMadeiranSpeckledWood); Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 2); - ; return alleles; } @@ -114,7 +112,6 @@ public class ButterflyTemplates { IAllele[] alleles = getDefaultTemplate(); Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiCanarySpeckledWood); Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 2); - ; return alleles; } @@ -124,7 +121,6 @@ public class ButterflyTemplates { Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.LARGER); Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTEST); Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 2); - ; return alleles; } @@ -134,7 +130,6 @@ public class ButterflyTemplates { Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.LARGER); Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTEST); Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 2); - ; return alleles; } @@ -144,7 +139,6 @@ public class ButterflyTemplates { Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.LARGER); Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTEST); Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 2); - ; return alleles; } @@ -217,7 +211,6 @@ public class ButterflyTemplates { Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiBlueWing); Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.AVERAGE); Allele.helper.set(alleles, EnumButterflyChromosome.METABOLISM, 5); - ; return alleles; } diff --git a/src/main/java/forestry/lepidopterology/gui/GuiFlutterlyzer.java b/src/main/java/forestry/lepidopterology/gui/GuiFlutterlyzer.java index bd95f2e15..9411b4023 100755 --- a/src/main/java/forestry/lepidopterology/gui/GuiFlutterlyzer.java +++ b/src/main/java/forestry/lepidopterology/gui/GuiFlutterlyzer.java @@ -102,7 +102,7 @@ public class GuiFlutterlyzer extends GuiAlyzer { newLine(); newLine(); - drawSpeciesRow(StringUtil.localize("gui.species"), butterfly, EnumButterflyChromosome.SPECIES); + drawSpeciesRow(StringUtil.localize("gui.species"), butterfly, EnumButterflyChromosome.SPECIES, null, null); newLine(); drawRow(StringUtil.localize("gui.size"), butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.SIZE).getName(), diff --git a/src/main/java/forestry/lepidopterology/render/ButterflyItemRenderer.java b/src/main/java/forestry/lepidopterology/render/ButterflyItemRenderer.java index 0cbf4f9ee..02470a0cc 100755 --- a/src/main/java/forestry/lepidopterology/render/ButterflyItemRenderer.java +++ b/src/main/java/forestry/lepidopterology/render/ButterflyItemRenderer.java @@ -29,7 +29,7 @@ import forestry.plugins.PluginLepidopterology; public class ButterflyItemRenderer implements IItemRenderer { private final ModelButterfly model; - EntityButterfly entity; + private EntityButterfly entity; public ButterflyItemRenderer() { model = new ModelButterfly(); @@ -70,7 +70,7 @@ public class ButterflyItemRenderer implements IItemRenderer { return wingYaw; } - public static float getRegularWingYaw(float flap) { + private static float getRegularWingYaw(float flap) { return flap < 0.5 ? 0.75f + flap : 1.75f - flap; } diff --git a/src/main/java/forestry/lepidopterology/render/ModelButterfly.java b/src/main/java/forestry/lepidopterology/render/ModelButterfly.java index 46688909b..e9bf0afda 100755 --- a/src/main/java/forestry/lepidopterology/render/ModelButterfly.java +++ b/src/main/java/forestry/lepidopterology/render/ModelButterfly.java @@ -88,7 +88,7 @@ public class ModelButterfly extends ModelBase { } - private void setRotation(ModelRenderer model, float x, float y, float z) { + private static void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; diff --git a/src/main/java/forestry/lepidopterology/render/RenderButterfly.java b/src/main/java/forestry/lepidopterology/render/RenderButterfly.java index b9706ec42..8b640198a 100755 --- a/src/main/java/forestry/lepidopterology/render/RenderButterfly.java +++ b/src/main/java/forestry/lepidopterology/render/RenderButterfly.java @@ -26,7 +26,7 @@ public class RenderButterfly extends RenderLiving { butterflyModel = (ModelButterfly) mainModel; } - public void renderButterfly(EntityButterfly entity, double x, double y, double z, float light, float partialTickTime) { + private void renderButterfly(EntityButterfly entity, double x, double y, double z, float light, float partialTickTime) { if (!entity.isRenderable()) { return; } diff --git a/src/main/java/forestry/mail/PacketHandlerMail.java b/src/main/java/forestry/mail/PacketHandlerMail.java index 80bfb2872..c4ced3185 100755 --- a/src/main/java/forestry/mail/PacketHandlerMail.java +++ b/src/main/java/forestry/mail/PacketHandlerMail.java @@ -119,7 +119,7 @@ public class PacketHandlerMail implements IPacketHandler { return; } - Proxies.net.sendToPlayer(new PacketPOBoxInfo(PacketId.POBOX_INFO, pobox.getPOBoxInfo()), player); + Proxies.net.sendToPlayer(new PacketPOBoxInfo(pobox.getPOBoxInfo()), player); } } diff --git a/src/main/java/forestry/mail/PostRegistry.java b/src/main/java/forestry/mail/PostRegistry.java index a0d77c01d..894ae6516 100755 --- a/src/main/java/forestry/mail/PostRegistry.java +++ b/src/main/java/forestry/mail/PostRegistry.java @@ -11,6 +11,7 @@ package forestry.mail; import java.io.File; +import java.util.EnumMap; import java.util.HashMap; import java.util.Map; @@ -30,7 +31,6 @@ import forestry.api.mail.IPostalCarrier; import forestry.api.mail.ITradeStation; import forestry.api.mail.PostManager; import forestry.core.config.ForestryItem; -import forestry.core.network.PacketId; import forestry.core.proxy.Proxies; import forestry.mail.items.ItemLetter; import forestry.mail.network.PacketPOBoxInfo; @@ -75,7 +75,7 @@ public class PostRegistry implements IPostRegistry { EntityPlayer player = Proxies.common.getPlayer(world, address.getPlayerProfile()); if (player != null) { - Proxies.net.sendToPlayer(new PacketPOBoxInfo(PacketId.POBOX_INFO, pobox.getPOBoxInfo()), player); + Proxies.net.sendToPlayer(new PacketPOBoxInfo(pobox.getPOBoxInfo()), player); } } @@ -185,7 +185,7 @@ public class PostRegistry implements IPostRegistry { } /* CARRIER */ - private final HashMap carriers = new HashMap(); + private final Map carriers = new EnumMap(EnumAddressee.class); @Override public Map getRegisteredCarriers() { diff --git a/src/main/java/forestry/mail/PostalCarrier.java b/src/main/java/forestry/mail/PostalCarrier.java index deb20e760..8d1b8d9b2 100755 --- a/src/main/java/forestry/mail/PostalCarrier.java +++ b/src/main/java/forestry/mail/PostalCarrier.java @@ -25,7 +25,6 @@ import forestry.api.mail.IPostalCarrier; import forestry.api.mail.IPostalState; import forestry.api.mail.ITradeStation; import forestry.api.mail.PostManager; -import forestry.core.network.PacketId; import forestry.core.proxy.Proxies; import forestry.core.render.TextureManager; import forestry.core.utils.StringUtil; @@ -58,36 +57,36 @@ public class PostalCarrier implements IPostalCarrier { } @Override - public IPostalState deliverLetter(World world, IPostOffice office, IMailAddress recipient, ItemStack letterstack, boolean doDeliver) { + public IPostalState deliverLetter(World world, IPostOffice office, IMailAddress recipient, ItemStack letterStack, boolean doDeliver) { if (type == EnumAddressee.TRADER) { - return handleTradeLetter(world, office, recipient, letterstack, doDeliver); + return handleTradeLetter(world, recipient, letterStack, doDeliver); } else { - return storeInPOBox(world, office, recipient, letterstack, doDeliver); + return storeInPOBox(world, recipient, letterStack); } } - private static IPostalState handleTradeLetter(World world, IPostOffice office, IMailAddress recipient, ItemStack letterstack, boolean doLodge) { + private static IPostalState handleTradeLetter(World world, IMailAddress recipient, ItemStack letterStack, boolean doLodge) { ITradeStation trade = PostManager.postRegistry.getTradeStation(world, recipient); if (trade == null) { return EnumDeliveryState.NO_MAILBOX; } - return trade.handleLetter(world, recipient, letterstack, doLodge); + return trade.handleLetter(world, recipient, letterStack, doLodge); } - private static EnumDeliveryState storeInPOBox(World world, IPostOffice office, IMailAddress recipient, ItemStack letterstack, boolean doLodge) { + private static EnumDeliveryState storeInPOBox(World world, IMailAddress recipient, ItemStack letterStack) { POBox pobox = PostRegistry.getPOBox(world, recipient); if (pobox == null) { return EnumDeliveryState.NO_MAILBOX; } - if (!pobox.storeLetter(letterstack.copy())) { + if (!pobox.storeLetter(letterStack.copy())) { return EnumDeliveryState.MAILBOX_FULL; } else { EntityPlayer player = Proxies.common.getPlayer(world, recipient.getPlayerProfile()); if (player != null) { - Proxies.net.sendToPlayer(new PacketPOBoxInfo(PacketId.POBOX_INFO, pobox.getPOBoxInfo()), player); + Proxies.net.sendToPlayer(new PacketPOBoxInfo(pobox.getPOBoxInfo()), player); } } diff --git a/src/main/java/forestry/mail/TradeStation.java b/src/main/java/forestry/mail/TradeStation.java index 1da6c9303..479c763fd 100755 --- a/src/main/java/forestry/mail/TradeStation.java +++ b/src/main/java/forestry/mail/TradeStation.java @@ -43,8 +43,8 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve public static class TradeStationInventory extends InventoryAdapter { - public TradeStationInventory(int size, String name) { - super(size, name); + public TradeStationInventory() { + super(TradeStation.SLOT_SIZE, "INV"); } @Override @@ -111,14 +111,14 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve public static final short SLOT_RECEIVE_BUFFER_COUNT = 15; public static final short SLOT_SEND_BUFFER = 30; public static final short SLOT_SEND_BUFFER_COUNT = 10; - public static final short SLOT_SIZE = SLOT_TRADEGOOD_COUNT + SLOT_EXCHANGE_COUNT + SLOT_LETTERS_COUNT + SLOT_STAMPS_COUNT + SLOT_RECEIVE_BUFFER_COUNT + SLOT_SEND_BUFFER_COUNT; + public static final int SLOT_SIZE = SLOT_TRADEGOOD_COUNT + SLOT_EXCHANGE_COUNT + SLOT_LETTERS_COUNT + SLOT_STAMPS_COUNT + SLOT_RECEIVE_BUFFER_COUNT + SLOT_SEND_BUFFER_COUNT; // / MEMBER private GameProfile owner; private IMailAddress address; private boolean isVirtual = false; private boolean isInvalid = false; - private final InventoryAdapter inventory = new TradeStationInventory(SLOT_SIZE, "INV"); + private final InventoryAdapter inventory = new TradeStationInventory(); // / CONSTRUCTORS public TradeStation(GameProfile owner, IMailAddress address) { @@ -350,15 +350,18 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve } // How many orders are fillable? - int itemCount = 0; + float orderCount = 0; for (ItemStack stack : InvTools.getStacks(inventory, SLOT_SEND_BUFFER, SLOT_SEND_BUFFER_COUNT)) { if (stack != null && stack.isItemEqual(tradegood) && ItemStack.areItemStackTagsEqual(stack, tradegood)) { - itemCount += stack.stackSize; + orderCount += (stack.stackSize / (float) tradegood.stackSize); + if (orderCount >= max) { + return max; + } } } - return (int) Math.floor(itemCount / tradegood.stackSize); + return (int) Math.floor(orderCount); } public boolean canReceivePayment() { @@ -677,8 +680,4 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve return inventory.isLocked(slotIndex); } - @Override - public IInventoryAdapter configureSided(int[] sides, int[] slots) { - return inventory.configureSided(sides, slots); - } } diff --git a/src/main/java/forestry/mail/commands/CommandMail.java b/src/main/java/forestry/mail/commands/CommandMail.java index a967a8e43..7cc1bd2f9 100644 --- a/src/main/java/forestry/mail/commands/CommandMail.java +++ b/src/main/java/forestry/mail/commands/CommandMail.java @@ -56,7 +56,7 @@ public class CommandMail extends SubCommand { } } - private String makeTradeListEntry(TradeStationInfo info) { + private static String makeTradeListEntry(TradeStationInfo info) { EnumChatFormatting formatting = info.state.isOk() ? EnumChatFormatting.GREEN : EnumChatFormatting.RED; String tradegood = "[ ? ]"; diff --git a/src/main/java/forestry/mail/gadgets/MachineMailbox.java b/src/main/java/forestry/mail/gadgets/MachineMailbox.java index d893c3aa7..c9e540d35 100755 --- a/src/main/java/forestry/mail/gadgets/MachineMailbox.java +++ b/src/main/java/forestry/mail/gadgets/MachineMailbox.java @@ -55,7 +55,7 @@ public class MachineMailbox extends TileBase implements IMailContainer { /* GUI */ @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { if (!Proxies.common.isSimulating(worldObj)) { return; @@ -65,7 +65,7 @@ public class MachineMailbox extends TileBase implements IMailContainer { // Handle letter sending if (PostManager.postRegistry.isLetter(held)) { - IPostalState result = this.tryDispatchLetter(held, true); + IPostalState result = this.tryDispatchLetter(held); if (!result.isOk()) { player.addChatMessage(new ChatComponentTranslation("for.chat.mail." + result.getIdentifier())); } else { @@ -95,12 +95,12 @@ public class MachineMailbox extends TileBase implements IMailContainer { return PostRegistry.getOrCreatePOBox(worldObj, address); } - private IPostalState tryDispatchLetter(ItemStack letterstack, boolean dispatchLetter) { + private IPostalState tryDispatchLetter(ItemStack letterstack) { ILetter letter = PostManager.postRegistry.getLetter(letterstack); IPostalState result; if (letter != null) { - result = PostManager.postRegistry.getPostOffice(worldObj).lodgeLetter(worldObj, letterstack, dispatchLetter); + result = PostManager.postRegistry.getPostOffice(worldObj).lodgeLetter(worldObj, letterstack, true); } else { result = EnumDeliveryState.NOT_MAILABLE; } diff --git a/src/main/java/forestry/mail/gadgets/MachinePhilatelist.java b/src/main/java/forestry/mail/gadgets/MachinePhilatelist.java index 85a57455c..587299b46 100755 --- a/src/main/java/forestry/mail/gadgets/MachinePhilatelist.java +++ b/src/main/java/forestry/mail/gadgets/MachinePhilatelist.java @@ -35,7 +35,7 @@ public class MachinePhilatelist extends TileBase implements IInventory { } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, GuiId.PhilatelistGUI.ordinal(), worldObj, xCoord, yCoord, zCoord); } diff --git a/src/main/java/forestry/mail/gadgets/MachineTrader.java b/src/main/java/forestry/mail/gadgets/MachineTrader.java index 276519e2a..bfc8fca6b 100755 --- a/src/main/java/forestry/mail/gadgets/MachineTrader.java +++ b/src/main/java/forestry/mail/gadgets/MachineTrader.java @@ -51,11 +51,11 @@ public class MachineTrader extends TileBase { public MachineTrader() { address = new MailAddress(); - setInternalInventory(new TradeStation.TradeStationInventory(TradeStation.SLOT_SIZE, "INV")); + setInternalInventory(new TradeStation.TradeStationInventory()); } @Override - public void openGui(EntityPlayer player, TileBase tile) { + public void openGui(EntityPlayer player) { if (isLinked()) { player.openGui(ForestryAPI.instance, GuiId.TraderGUI.ordinal(), worldObj, xCoord, yCoord, zCoord); } else { @@ -271,7 +271,7 @@ public class MachineTrader extends TileBase { } } - public void setAddress(IMailAddress address) { + private void setAddress(IMailAddress address) { if (address == null) { throw new NullPointerException("address must not be null"); } diff --git a/src/main/java/forestry/mail/gui/ContainerCatalogue.java b/src/main/java/forestry/mail/gui/ContainerCatalogue.java index a0c4be0ac..cd5f53e91 100755 --- a/src/main/java/forestry/mail/gui/ContainerCatalogue.java +++ b/src/main/java/forestry/mail/gui/ContainerCatalogue.java @@ -187,7 +187,7 @@ public class ContainerCatalogue extends Container implements IGuiSelectable { crafter.sendProgressBarUpdate(this, 2, currentFilter); } - Proxies.net.sendToPlayer(new PacketLetterInfo(PacketId.LETTER_INFO, EnumAddressee.TRADER, currentTrade, null), player); + Proxies.net.sendToPlayer(new PacketLetterInfo(EnumAddressee.TRADER, currentTrade, null), player); needsSynch = false; } } diff --git a/src/main/java/forestry/mail/gui/ContainerLetter.java b/src/main/java/forestry/mail/gui/ContainerLetter.java index 412def11c..31d13afec 100755 --- a/src/main/java/forestry/mail/gui/ContainerLetter.java +++ b/src/main/java/forestry/mail/gui/ContainerLetter.java @@ -135,10 +135,10 @@ public class ContainerLetter extends ContainerItemInventory { } // Update info on client - Proxies.net.sendToPlayer(new PacketLetterInfo(PacketId.LETTER_INFO, type, tradeInfo, recipient), player); + Proxies.net.sendToPlayer(new PacketLetterInfo(type, tradeInfo, recipient), player); } - public static IMailAddress getRecipient(String recipientName, EnumAddressee type) { + private static IMailAddress getRecipient(String recipientName, EnumAddressee type) { switch (type) { case PLAYER: { GameProfile gameProfile = MinecraftServer.getServer().func_152358_ax().func_152655_a(recipientName); @@ -181,7 +181,7 @@ public class ContainerLetter extends ContainerItemInventory { } /* Managing Trade info */ - public void updateTradeInfo(World world, IMailAddress address) { + private void updateTradeInfo(World world, IMailAddress address) { // Updating is done by the server. if (!Proxies.common.isSimulating(world)) { return; diff --git a/src/main/java/forestry/mail/gui/ContainerMailbox.java b/src/main/java/forestry/mail/gui/ContainerMailbox.java index 0f9ce6e28..1d1c6ed65 100755 --- a/src/main/java/forestry/mail/gui/ContainerMailbox.java +++ b/src/main/java/forestry/mail/gui/ContainerMailbox.java @@ -17,7 +17,6 @@ import net.minecraft.item.ItemStack; import forestry.core.gui.ContainerTile; import forestry.core.gui.slots.SlotOutput; -import forestry.core.network.PacketId; import forestry.core.proxy.Proxies; import forestry.core.utils.GuiUtil; import forestry.mail.POBox; @@ -56,7 +55,7 @@ public class ContainerMailbox extends ContainerTile { if (GuiUtil.isIndexInRange(slotIndex, SLOT_LETTERS, SLOT_LETTERS_COUNT)) { if (Proxies.common.isSimulating(player.worldObj) && mailInventory != null) { POBoxInfo info = mailInventory.getPOBoxInfo(); - Proxies.net.sendToPlayer(new PacketPOBoxInfo(PacketId.POBOX_INFO, info), player); + Proxies.net.sendToPlayer(new PacketPOBoxInfo(info), player); } } diff --git a/src/main/java/forestry/mail/gui/ContainerTradeName.java b/src/main/java/forestry/mail/gui/ContainerTradeName.java index f58100c17..3d0f3bfba 100755 --- a/src/main/java/forestry/mail/gui/ContainerTradeName.java +++ b/src/main/java/forestry/mail/gui/ContainerTradeName.java @@ -34,7 +34,7 @@ public class ContainerTradeName extends ContainerTile { for (Object crafter : crafters) { if (crafter instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) crafter; - tile.openGui(player, tile); + tile.openGui(player); } } } diff --git a/src/main/java/forestry/mail/items/ItemLetter.java b/src/main/java/forestry/mail/items/ItemLetter.java index 38acf380f..3275db199 100755 --- a/src/main/java/forestry/mail/items/ItemLetter.java +++ b/src/main/java/forestry/mail/items/ItemLetter.java @@ -103,13 +103,13 @@ public class ItemLetter extends ItemInventoried { return icons[size.ordinal()][state.ordinal()]; } - public static int encodeMeta(LetterState state, LetterSize size) { + private static int encodeMeta(LetterState state, LetterSize size) { int meta = size.ordinal() << 4; meta |= state.ordinal(); return meta; } - public static LetterState getState(int meta) { + private static LetterState getState(int meta) { int ordinal = meta & 0x0f; LetterState[] values = LetterState.values(); if (ordinal >= values.length) { @@ -118,7 +118,7 @@ public class ItemLetter extends ItemInventoried { return values[ordinal]; } - public static LetterSize getSize(int meta) { + private static LetterSize getSize(int meta) { int ordinal = meta >> 4; LetterSize[] values = LetterSize.values(); if (ordinal >= values.length) { @@ -127,7 +127,7 @@ public class ItemLetter extends ItemInventoried { return values[ordinal]; } - public static LetterSize getSize(ILetter letter) { + private static LetterSize getSize(ILetter letter) { int count = letter.countAttachments(); if (count > 5) { diff --git a/src/main/java/forestry/mail/network/PacketLetterInfo.java b/src/main/java/forestry/mail/network/PacketLetterInfo.java index 21ae6e4e7..e76abdd74 100644 --- a/src/main/java/forestry/mail/network/PacketLetterInfo.java +++ b/src/main/java/forestry/mail/network/PacketLetterInfo.java @@ -37,8 +37,8 @@ public class PacketLetterInfo extends ForestryPacket { super(data); } - public PacketLetterInfo(PacketId id, EnumAddressee type, TradeStationInfo info, IMailAddress address) { - super(id); + public PacketLetterInfo(EnumAddressee type, TradeStationInfo info, IMailAddress address) { + super(PacketId.LETTER_INFO); this.type = type; if (type == EnumAddressee.TRADER) { this.tradeInfo = info; diff --git a/src/main/java/forestry/mail/network/PacketPOBoxInfo.java b/src/main/java/forestry/mail/network/PacketPOBoxInfo.java index 4f6c04151..6354890de 100755 --- a/src/main/java/forestry/mail/network/PacketPOBoxInfo.java +++ b/src/main/java/forestry/mail/network/PacketPOBoxInfo.java @@ -26,8 +26,8 @@ public class PacketPOBoxInfo extends ForestryPacket { super(data); } - public PacketPOBoxInfo(PacketId id, POBoxInfo info) { - super(id); + public PacketPOBoxInfo(POBoxInfo info) { + super(PacketId.POBOX_INFO); this.poboxInfo = info; } diff --git a/src/main/java/forestry/pipes/GuiHandlerPipes.java b/src/main/java/forestry/pipes/GuiHandlerPipes.java index 62708248f..1632a8637 100755 --- a/src/main/java/forestry/pipes/GuiHandlerPipes.java +++ b/src/main/java/forestry/pipes/GuiHandlerPipes.java @@ -24,7 +24,7 @@ import buildcraft.transport.TileGenericPipe; public class GuiHandlerPipes implements IGuiHandler { @SuppressWarnings("rawtypes") - private Pipe getPipe(World world, int x, int y, int z) { + private static Pipe getPipe(World world, int x, int y, int z) { TileEntity tile = world.getTileEntity(x, y, z); if (tile == null) { return null; diff --git a/src/main/java/forestry/pipes/proxy/ProxyPipes.java b/src/main/java/forestry/pipes/proxy/ProxyPipes.java index ecb00a7f0..8527808c7 100755 --- a/src/main/java/forestry/pipes/proxy/ProxyPipes.java +++ b/src/main/java/forestry/pipes/proxy/ProxyPipes.java @@ -36,7 +36,7 @@ public class ProxyPipes { } @SuppressWarnings("rawtypes") - public Item createPipe(Class clas, CreativeTabBuildCraft creativeTab) { + public static Item createPipe(Class clas, CreativeTabBuildCraft creativeTab) { return registerPipe(clas, creativeTab); } @@ -69,8 +69,7 @@ public class ProxyPipes { return item; } - public void registerCraftingPropolis(ItemStack resource) { + public static void registerCraftingPropolis(ItemStack resource) { GameRegistry.addRecipe(new ItemStack(PluginPropolisPipe.pipeItemsPropolis), "#X#", '#', resource, 'X', BuildCraftTransport.pipeItemsDiamond); - } } diff --git a/src/main/java/forestry/plugins/PluginApiculture.java b/src/main/java/forestry/plugins/PluginApiculture.java index 34f7b919f..1adc352ae 100644 --- a/src/main/java/forestry/plugins/PluginApiculture.java +++ b/src/main/java/forestry/plugins/PluginApiculture.java @@ -157,19 +157,18 @@ public class PluginApiculture extends ForestryPlugin { @SidedProxy(clientSide = "forestry.apiculture.proxy.ClientProxyApiculture", serverSide = "forestry.apiculture.proxy.ProxyApiculture") public static ProxyApiculture proxy; private static final String CONFIG_CATEGORY = "apiculture"; - public static final String[] EMPTY_STRINGS = new String[0]; + private static final String[] EMPTY_STRINGS = new String[0]; public static String beekeepingMode = "NORMAL"; private static float secondPrincessChance = 0; public static final int ticksPerBeeWorkCycle = 550; - public static boolean apiarySideSensitive = false; public static boolean fancyRenderedBees = false; public static HiveRegistry hiveRegistry; - public static MachineDefinition definitionApiary; - public static MachineDefinition definitionChest; - public static MachineDefinition definitionBeehouse; - public static MachineDefinition definitionAnalyzer; + private static MachineDefinition definitionApiary; + private static MachineDefinition definitionChest; + private static MachineDefinition definitionBeehouse; + private static MachineDefinition definitionAnalyzer; private final Map defaultAcceptedFlowers = new HashMap(); private final Map defaultPlantableFlowers = new HashMap(); @@ -455,11 +454,7 @@ public class PluginApiculture extends ForestryPlugin { // Config forestry.core.config.deprecated.Configuration apicultureConfig = new forestry.core.config.deprecated.Configuration(); - forestry.core.config.deprecated.Property property = apicultureConfig.get("apiary.sidesensitive", CONFIG_CATEGORY, apiarySideSensitive); - property.comment = "set to false if apiaries should output all items regardless of side a pipe is attached to"; - apiarySideSensitive = Boolean.parseBoolean(property.value); - - property = apicultureConfig.get("render.bees.fancy", CONFIG_CATEGORY, fancyRenderedBees); + forestry.core.config.deprecated.Property property = apicultureConfig.get("render.bees.fancy", CONFIG_CATEGORY, fancyRenderedBees); property.comment = "set to true to enable a fancy butterfly-like renderer for bees. (experimental!)"; fancyRenderedBees = Boolean.parseBoolean(property.value); @@ -866,7 +861,7 @@ public class PluginApiculture extends ForestryPlugin { definitionChest.register(); } - public static IRecipe[] createAlyzerRecipes(Block block, int meta) { + private static IRecipe[] createAlyzerRecipes(Block block, int meta) { ArrayList recipes = new ArrayList(); recipes.add(ShapedRecipeCustom.createShapedRecipe(new ItemStack(block, 1, meta), "XTX", " Y ", "X X", 'Y', ForestryItem.sturdyCasing, 'T', ForestryItem.beealyzer, 'X', "ingotBronze")); recipes.add(ShapedRecipeCustom.createShapedRecipe(new ItemStack(block, 1, meta), "XTX", " Y ", "X X", 'Y', ForestryItem.sturdyCasing, 'T', ForestryItem.treealyzer, 'X', "ingotBronze")); @@ -1050,14 +1045,14 @@ public class PluginApiculture extends ForestryPlugin { @Override public void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { if (Config.getBeehivesAmount() > 0.0) { - HiveDecorator.instance().decorateHives(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated); + HiveDecorator.decorateHives(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated); } } @Override public void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) { if (Config.getBeehivesAmount() > 0.0) { - HiveDecorator.instance().decorateHives(world, rand, chunkX, chunkZ); + HiveDecorator.decorateHives(world, rand, chunkX, chunkZ); } } diff --git a/src/main/java/forestry/plugins/PluginArboriculture.java b/src/main/java/forestry/plugins/PluginArboriculture.java index dd881974c..1556437fd 100644 --- a/src/main/java/forestry/plugins/PluginArboriculture.java +++ b/src/main/java/forestry/plugins/PluginArboriculture.java @@ -109,7 +109,7 @@ public class PluginArboriculture extends ForestryPlugin { public static int modelIdFences; public static int modelIdPods; - public static MachineDefinition definitionChest; + private static MachineDefinition definitionChest; public static final List validFences = new ArrayList(); @Override @@ -148,14 +148,14 @@ public class PluginArboriculture extends ForestryPlugin { ForestryBlock.fences.registerBlock(new BlockArbFence(false), ItemWoodBlock.class, "fences"); OreDictionary.registerOre("fenceWood", ForestryBlock.fences.getWildcard()); - ForestryBlock.stairs.registerBlock(new BlockArbStairs(ForestryBlock.planks.block(), 0, false), ItemWoodBlock.class, "stairs"); + ForestryBlock.stairs.registerBlock(new BlockArbStairs(ForestryBlock.planks.block(), false), ItemWoodBlock.class, "stairs"); OreDictionary.registerOre("stairWood", ForestryBlock.stairs.getWildcard()); ForestryBlock.logsFireproof.registerBlock(new BlockLog(true), ItemWoodBlock.class, "logsFireproof"); ForestryBlock.planksFireproof.registerBlock(new BlockPlanks(true), ItemWoodBlock.class, "planksFireproof"); ForestryBlock.slabsFireproof.registerBlock(new BlockSlab(true), ItemWoodBlock.class, "slabsFireproof"); ForestryBlock.fencesFireproof.registerBlock(new BlockArbFence(true), ItemWoodBlock.class, "fencesFireproof"); - ForestryBlock.stairsFireproof.registerBlock(new BlockArbStairs(ForestryBlock.planksFireproof.block(), 0, true), ItemWoodBlock.class, "stairsFireproof"); + ForestryBlock.stairsFireproof.registerBlock(new BlockArbStairs(ForestryBlock.planksFireproof.block(), true), ItemWoodBlock.class, "stairsFireproof"); for (WoodType woodType : WoodType.VALUES) { woodType.registerLog(ForestryBlock.logs.block(), false); diff --git a/src/main/java/forestry/plugins/PluginBiomesOPlenty.java b/src/main/java/forestry/plugins/PluginBiomesOPlenty.java index 3b7e8c2b9..81e062163 100644 --- a/src/main/java/forestry/plugins/PluginBiomesOPlenty.java +++ b/src/main/java/forestry/plugins/PluginBiomesOPlenty.java @@ -33,11 +33,6 @@ public class PluginBiomesOPlenty extends ForestryPlugin { private static final String BoP = "BiomesOPlenty"; - public static Block BoPSaplings; - public static Block BoPColorizedSaplings; - public static Block BoPTurnip; - public static Item BoPTurnipSeeds; - @Override public boolean isAvailable() { return Proxies.common.isModLoaded(BoP); @@ -52,17 +47,17 @@ public class PluginBiomesOPlenty extends ForestryPlugin { public void doInit() { super.doInit(); - BoPSaplings = GameRegistry.findBlock(BoP, "saplings"); - BoPColorizedSaplings = GameRegistry.findBlock(BoP, "colorizedSaplings"); - BoPTurnipSeeds = GameRegistry.findItem(BoP, "turnipSeeds"); - BoPTurnip = GameRegistry.findBlock(BoP, "turnip"); + Block boPSaplings = GameRegistry.findBlock(BoP, "saplings"); + Block boPColorizedSaplings = GameRegistry.findBlock(BoP, "colorizedSaplings"); + Item boPTurnipSeeds = GameRegistry.findItem(BoP, "turnipSeeds"); + Block boPTurnip = GameRegistry.findBlock(BoP, "turnip"); List saplingItemKeys = new ArrayList(); - if (BoPSaplings != null) { + if (boPSaplings != null) { saplingItemKeys.add("saplings"); } - if (BoPColorizedSaplings != null) { + if (boPColorizedSaplings != null) { saplingItemKeys.add("colorizedSaplings"); } @@ -72,9 +67,9 @@ public class PluginBiomesOPlenty extends ForestryPlugin { FMLInterModComms.sendMessage(Defaults.MOD, "add-farmable-sapling", String.format("farmArboreal@%s.-1", saplingName)); } ItemStack BoPPersimmon = new ItemStack(GameRegistry.findItem(BoP, "food"), 1, 8); - Farmables.farmables.get("farmArboreal").add(new FarmableGenericSapling(BoPSaplings, 15, BoPPersimmon)); + Farmables.farmables.get("farmArboreal").add(new FarmableGenericSapling(boPSaplings, 15, BoPPersimmon)); - Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(BoPTurnipSeeds, 1, 0), BoPTurnip, 7)); - Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(BoPTurnip, 7)); + Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(boPTurnipSeeds, 1, 0), boPTurnip, 7)); + Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(boPTurnip, 7)); } } diff --git a/src/main/java/forestry/plugins/PluginCore.java b/src/main/java/forestry/plugins/PluginCore.java index 7be397075..d76bb51d1 100644 --- a/src/main/java/forestry/plugins/PluginCore.java +++ b/src/main/java/forestry/plugins/PluginCore.java @@ -80,9 +80,8 @@ import forestry.core.utils.ShapedRecipeCustom; @Plugin(pluginID = "Core", name = "Core", author = "SirSengir", url = Defaults.URL, unlocalizedDescription = "for.plugin.core.description") public class PluginCore extends ForestryPlugin { - public static MachineDefinition definitionEscritoire; - // ICrashCallable for highlighting certain mods during crashes. - public static ForestryModEnvWarningCallable crashCallable; + private static MachineDefinition definitionEscritoire; + public static final RootCommand rootCommand = new RootCommand(); private AlleleHelper alleleHelper; @@ -143,7 +142,7 @@ public class PluginCore extends ForestryPlugin { super.doInit(); definitionEscritoire.register(); - crashCallable = new ForestryModEnvWarningCallable(); + ForestryModEnvWarningCallable.register(); alleleHelper.init(); @@ -169,7 +168,7 @@ public class PluginCore extends ForestryPlugin { protected void registerItems() { // / FERTILIZERS ForestryItem.fertilizerBio.registerItem((new ItemForestry()), "fertilizerBio"); - ForestryItem.fertilizerCompound.registerItem((new ItemForestry()).setBonemeal(true), "fertilizerCompound"); + ForestryItem.fertilizerCompound.registerItem((new ItemForestry()).setBonemeal(), "fertilizerCompound"); // / GEMS ForestryItem.apatite.registerItem((new ItemForestry()), "apatite"); @@ -198,7 +197,7 @@ public class PluginCore extends ForestryPlugin { ForestryItem.craftingMaterial.registerItem(new ItemMisc(), "craftingMaterial"); /* ARMOR */ - ForestryItem.naturalistHat.registerItem(new ItemArmorNaturalist(0), "naturalistHelmet"); + ForestryItem.naturalistHat.registerItem(new ItemArmorNaturalist(), "naturalistHelmet"); // / PEAT PRODUCTION ForestryItem.peat.registerItem((new ItemForestry()), "peat"); diff --git a/src/main/java/forestry/plugins/PluginEnergy.java b/src/main/java/forestry/plugins/PluginEnergy.java index 47511ab1b..df0f9ec9b 100755 --- a/src/main/java/forestry/plugins/PluginEnergy.java +++ b/src/main/java/forestry/plugins/PluginEnergy.java @@ -36,9 +36,9 @@ public class PluginEnergy extends ForestryPlugin { @SidedProxy(clientSide = "forestry.energy.proxy.ClientProxyEnergy", serverSide = "forestry.energy.proxy.ProxyEnergy") public static ProxyEnergy proxy; - public static MachineDefinition definitionEngineCopper; - public static MachineDefinition definitionEngineBronze; - public static MachineDefinition definitionEngineClockwork; + private static MachineDefinition definitionEngineCopper; + private static MachineDefinition definitionEngineBronze; + private static MachineDefinition definitionEngineClockwork; @Override public void preInit() { diff --git a/src/main/java/forestry/plugins/PluginExtraUtilities.java b/src/main/java/forestry/plugins/PluginExtraUtilities.java index f6b03bbd9..53bf32d17 100644 --- a/src/main/java/forestry/plugins/PluginExtraUtilities.java +++ b/src/main/java/forestry/plugins/PluginExtraUtilities.java @@ -35,8 +35,6 @@ public class PluginExtraUtilities extends ForestryPlugin { private static final String ExU = "ExtraUtilities"; - public static Block ExUEnderLilly; - @Override public boolean isAvailable() { return Proxies.common.isModLoaded(ExU); @@ -51,11 +49,11 @@ public class PluginExtraUtilities extends ForestryPlugin { public void doInit() { super.doInit(); - ExUEnderLilly = GameRegistry.findBlock(ExU, "plant/ender_lilly"); + Block exUEnderLilly = GameRegistry.findBlock(ExU, "plant/ender_lilly"); Farmables.farmables.put("farmEnder", new ArrayList()); if (Config.isExUtilEnderLilyEnabled()) { Circuit.farmEnderManaged = new CircuitFarmLogic("managedEnder", FarmLogicEnder.class); - Farmables.farmables.get("farmEnder").add(new FarmableGenericCrop(new ItemStack(ExUEnderLilly, 1, 0), ExUEnderLilly, 7)); + Farmables.farmables.get("farmEnder").add(new FarmableGenericCrop(new ItemStack(exUEnderLilly, 1, 0), exUEnderLilly, 7)); } } diff --git a/src/main/java/forestry/plugins/PluginFactory.java b/src/main/java/forestry/plugins/PluginFactory.java index 7c78dda93..d975cdbf3 100644 --- a/src/main/java/forestry/plugins/PluginFactory.java +++ b/src/main/java/forestry/plugins/PluginFactory.java @@ -29,7 +29,6 @@ import forestry.core.config.ForestryItem; import forestry.core.fluids.Fluids; import forestry.core.gadgets.BlockBase; import forestry.core.gadgets.MachineDefinition; -import forestry.core.gadgets.MachineNBTDefinition; import forestry.core.items.ItemForestryBlock; import forestry.core.items.ItemNBTTile; import forestry.core.network.IPacketHandler; @@ -57,17 +56,17 @@ import forestry.factory.triggers.FactoryTriggers; @Plugin(pluginID = "Factory", name = "Factory", author = "SirSengir", url = Defaults.URL, unlocalizedDescription = "for.plugin.factory.description") public class PluginFactory extends ForestryPlugin { - public static MachineDefinition definitionBottler; - public static MachineDefinition definitionCarpenter; - public static MachineDefinition definitionCentrifuge; - public static MachineDefinition definitionFermenter; - public static MachineDefinition definitionMoistener; - public static MachineDefinition definitionSqueezer; - public static MachineDefinition definitionStill; - public static MachineDefinition definitionRainmaker; - public static MachineDefinition definitionFabricator; - public static MachineDefinition definitionRaintank; - public static MachineDefinition definitionWorktable; + private static MachineDefinition definitionBottler; + private static MachineDefinition definitionCarpenter; + private static MachineDefinition definitionCentrifuge; + private static MachineDefinition definitionFermenter; + private static MachineDefinition definitionMoistener; + private static MachineDefinition definitionSqueezer; + private static MachineDefinition definitionStill; + private static MachineDefinition definitionRainmaker; + private static MachineDefinition definitionFabricator; + private static MachineDefinition definitionRaintank; + private static MachineDefinition definitionWorktable; @Override protected void setupAPI() { @@ -196,7 +195,7 @@ public class PluginFactory extends ForestryPlugin { BlockBase factoryPlain = ((BlockBase) ForestryBlock.factoryPlain.block()); - definitionFabricator = factoryPlain.addDefinition(new MachineNBTDefinition(Defaults.DEFINITION_FABRICATOR_META, "forestry.Fabricator", MachineFabricator.class, + definitionFabricator = factoryPlain.addDefinition(new MachineDefinition(Defaults.DEFINITION_FABRICATOR_META, "forestry.Fabricator", MachineFabricator.class, ShapedRecipeCustom.createShapedRecipe( ForestryBlock.factoryPlain.getItemStack(1, Defaults.DEFINITION_FABRICATOR_META), "X#X", @@ -218,7 +217,7 @@ public class PluginFactory extends ForestryPlugin { 'Y', ForestryItem.sturdyCasing)) .setFaces(0, 1, 0, 0, 0, 0)); - definitionWorktable = factoryPlain.addDefinition(new MachineNBTDefinition(Defaults.DEFINITION_WORKTABLE_META, "forestry.Worktable", TileWorktable.class, + definitionWorktable = factoryPlain.addDefinition(new MachineDefinition(Defaults.DEFINITION_WORKTABLE_META, "forestry.Worktable", TileWorktable.class, ShapedRecipeCustom.createShapedRecipe(ForestryBlock.factoryPlain.getItemStack(1, Defaults.DEFINITION_WORKTABLE_META), "B", "W", diff --git a/src/main/java/forestry/plugins/PluginFood.java b/src/main/java/forestry/plugins/PluginFood.java index a8ebbba7c..b51c7bda8 100755 --- a/src/main/java/forestry/plugins/PluginFood.java +++ b/src/main/java/forestry/plugins/PluginFood.java @@ -10,13 +10,14 @@ ******************************************************************************/ package forestry.plugins; +import java.util.Collections; + import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.network.IGuiHandler; import forestry.api.food.BeverageManager; -import forestry.api.food.IBeverageEffect; import forestry.core.config.Defaults; import forestry.core.config.ForestryItem; import forestry.core.fluids.Fluids; @@ -65,7 +66,7 @@ public class PluginFood extends ForestryPlugin { // Mead ItemStack meadBottle = ForestryItem.beverage.getItemStack(); - ((ItemBeverage) ForestryItem.beverage.item()).beverages[0].saveEffects(meadBottle, new IBeverageEffect[]{BeverageEffect.weakAlcoholic}); + BeverageInfo.saveEffects(meadBottle, Collections.singletonList(BeverageEffect.weakAlcoholic)); LiquidHelper.injectLiquidContainer(Fluids.SHORT_MEAD, Defaults.BUCKET_VOLUME, meadBottle, new ItemStack(Items.glass_bottle)); } diff --git a/src/main/java/forestry/plugins/PluginIC2.java b/src/main/java/forestry/plugins/PluginIC2.java index a291acc95..4f05ea7a4 100644 --- a/src/main/java/forestry/plugins/PluginIC2.java +++ b/src/main/java/forestry/plugins/PluginIC2.java @@ -68,26 +68,27 @@ public class PluginIC2 extends ForestryPlugin { public static PluginIC2 instance; // Forestry stuff - public static MachineDefinition definitionGenerator; - public static MachineDefinition definitionEngineTin; + private static MachineDefinition definitionGenerator; + private static MachineDefinition definitionEngineTin; // IC2 stuff - public static ItemStack plantBall; - public static ItemStack compressedPlantBall; - public static ItemStack wrench; - public static ItemStack treetap; + private static ItemStack plantBall; + private static ItemStack compressedPlantBall; + private static ItemStack wrench; + private static ItemStack treetap; + private static ItemStack rubbersapling; + private static ItemStack rubberleaves; + private static ItemStack emptyCell; + private static ItemStack lavaCell; + private static ItemStack waterCell; + private static ItemStack rubber; + private static ItemStack scrap; + private static ItemStack silver; + private static ItemStack brass; + private static ItemStack uuMatter; + public static ItemStack resin; - public static ItemStack rubbersapling; public static ItemStack rubberwood; - public static ItemStack rubberleaves; - public static ItemStack emptyCell; - public static ItemStack lavaCell; - public static ItemStack waterCell; - public static ItemStack rubber; - public static ItemStack scrap; - public static ItemStack silver; - public static ItemStack brass; - public static ItemStack uuMatter; public PluginIC2() { if (PluginIC2.instance == null) { diff --git a/src/main/java/forestry/plugins/PluginLepidopterology.java b/src/main/java/forestry/plugins/PluginLepidopterology.java index 48f6fa74e..7257ec66b 100755 --- a/src/main/java/forestry/plugins/PluginLepidopterology.java +++ b/src/main/java/forestry/plugins/PluginLepidopterology.java @@ -71,18 +71,10 @@ public class PluginLepidopterology extends ForestryPlugin { public static int spawnConstraint = 100; public static int entityConstraint = 1000; private static boolean allowPollination = true; - public static IClassification geometridae; - public static IClassification saturniidae; - public static IClassification pieridae; - public static IClassification nymphalidae; - public static IClassification lycaenidae; - public static IClassification papilionidae; - public static IClassification notchidae; /** * See {@link IButterflyRoot} for details. */ public static IButterflyRoot butterflyInterface; - public static MachineDefinition definitionChest; @Override protected void setupAPI() { @@ -133,7 +125,7 @@ public class PluginLepidopterology extends ForestryPlugin { registerTemplates(); BlockBase lepidopterology = ((BlockBase) ForestryBlock.lepidopterology.block()); - definitionChest = lepidopterology.addDefinition((new MachineDefinition(Defaults.DEFINITION_LEPICHEST_META, "forestry.LepiChest", TileLepidopteristChest.class, + MachineDefinition definitionChest = lepidopterology.addDefinition((new MachineDefinition(Defaults.DEFINITION_LEPICHEST_META, "forestry.LepiChest", TileLepidopteristChest.class, ShapedRecipeCustom.createShapedRecipe( ForestryBlock.lepidopterology.getItemStack(1, Defaults.DEFINITION_LEPICHEST_META), " # ", @@ -199,33 +191,33 @@ public class PluginLepidopterology extends ForestryPlugin { IClassification lepidoptera = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.ORDER, "lepidoptera", "Lepidoptera"); AlleleManager.alleleRegistry.getClassification("class.insecta").addMemberGroup(lepidoptera); - geometridae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "geometridae", "Geometridae"); + IClassification geometridae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "geometridae", "Geometridae"); lepidoptera.addMemberGroup(geometridae); - saturniidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "saturniidae", "Saturniidae"); + IClassification saturniidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "saturniidae", "Saturniidae"); lepidoptera.addMemberGroup(saturniidae); - pieridae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "pieridae", "Pieridae"); + IClassification pieridae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "pieridae", "Pieridae"); lepidoptera.addMemberGroup(pieridae); - nymphalidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "nymphalidae", "Nymphalidae"); + IClassification nymphalidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "nymphalidae", "Nymphalidae"); lepidoptera.addMemberGroup(nymphalidae); - lycaenidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "lycaenidae", "Lycaenidae"); + IClassification lycaenidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "lycaenidae", "Lycaenidae"); lepidoptera.addMemberGroup(lycaenidae); - papilionidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "papilionidae", "Papilionidae"); + IClassification papilionidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "papilionidae", "Papilionidae"); lepidoptera.addMemberGroup(papilionidae); - notchidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "notchidae", "Notchidae"); + IClassification notchidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "notchidae", "Notchidae"); lepidoptera.addMemberGroup(notchidae); /* GEOMETRIDAE */ IClassification opisthograptis = createButterflyBranch(geometridae, "Opisthograptis"); IClassification chiasmia = createButterflyBranch(geometridae, "Chiasmia"); - Allele.mothBrimstone = new AlleleButterflySpecies("mothBrimstone", true, "brimstone", opisthograptis, "luteolata", 0xffea40).setNocturnal(true).setRarity(1.0f); - Allele.mothLatticedHeath = new AlleleButterflySpecies("mothLatticedHeath", true, "latticedHeath", chiasmia, "clathrata", 0xf2f0be).setNocturnal(true).setRarity(0.5f); + Allele.mothBrimstone = new AlleleButterflySpecies("mothBrimstone", true, "brimstone", opisthograptis, "luteolata", 0xffea40).setNocturnal().setRarity(1.0f); + Allele.mothLatticedHeath = new AlleleButterflySpecies("mothLatticedHeath", true, "latticedHeath", chiasmia, "clathrata", 0xf2f0be).setNocturnal().setRarity(0.5f); /* SATURNIIDAE */ IClassification attacus = createButterflyBranch(saturniidae, "Attacus"); - Allele.mothAtlas = new AlleleButterflySpecies("mothAtlas", false, "atlas", attacus, "atlas", 0xd96e3d).setNocturnal(true); + Allele.mothAtlas = new AlleleButterflySpecies("mothAtlas", false, "atlas", attacus, "atlas", 0xd96e3d).setNocturnal(); /* PIERIDAE */ IClassification pieris = createButterflyBranch(pieridae, "Pieris"); diff --git a/src/main/java/forestry/plugins/PluginMagicalCrops.java b/src/main/java/forestry/plugins/PluginMagicalCrops.java index 8dc73c4ac..0db49b5e3 100644 --- a/src/main/java/forestry/plugins/PluginMagicalCrops.java +++ b/src/main/java/forestry/plugins/PluginMagicalCrops.java @@ -171,7 +171,7 @@ public class PluginMagicalCrops extends ForestryPlugin { } } - private void addRecipes(String seedPrefix, String cropPrefix, String name, int fluidAmount) { + private static void addRecipes(String seedPrefix, String cropPrefix, String name, int fluidAmount) { ItemStack seed = GameRegistry.findItemStack(MagCrop, MagCrop + seedPrefix + name, 1); Block crop = GameRegistry.findBlock(MagCrop, MagCrop + cropPrefix + name); if (seed != null) { diff --git a/src/main/java/forestry/plugins/PluginMail.java b/src/main/java/forestry/plugins/PluginMail.java index 0f63ae9d4..b35047d10 100755 --- a/src/main/java/forestry/plugins/PluginMail.java +++ b/src/main/java/forestry/plugins/PluginMail.java @@ -53,10 +53,10 @@ import forestry.mail.triggers.MailTriggers; @Plugin(pluginID = "Mail", name = "Mail", author = "SirSengir", url = Defaults.URL, unlocalizedDescription = "for.plugin.mail.description") public class PluginMail extends ForestryPlugin { - public static MachineDefinition definitionMailbox; - public static MachineDefinition definitionTradestation; - public static MachineDefinition definitionPhilatelist; - public static StampInfo[] stampDefinitions; + private static MachineDefinition definitionMailbox; + private static MachineDefinition definitionTradestation; + private static MachineDefinition definitionPhilatelist; + private static StampInfo[] stampDefinitions; @Override protected void setupAPI() { diff --git a/src/main/java/forestry/plugins/PluginManager.java b/src/main/java/forestry/plugins/PluginManager.java index 09630a1af..41881b926 100644 --- a/src/main/java/forestry/plugins/PluginManager.java +++ b/src/main/java/forestry/plugins/PluginManager.java @@ -47,8 +47,8 @@ import forestry.core.proxy.Proxies; public class PluginManager { - public static final String MODULE_CONFIG_FILE_NAME = "modules.cfg"; - public static final String CATEGORY_MODULES = "modules"; + private static final String MODULE_CONFIG_FILE_NAME = "modules.cfg"; + private static final String CATEGORY_MODULES = "modules"; public static final ArrayList guiHandlers = Lists.newArrayList(); public static final ArrayList packetHandlers = Lists.newArrayList(); diff --git a/src/main/java/forestry/plugins/PluginNatura.java b/src/main/java/forestry/plugins/PluginNatura.java index ea858c6cc..2571d7012 100755 --- a/src/main/java/forestry/plugins/PluginNatura.java +++ b/src/main/java/forestry/plugins/PluginNatura.java @@ -41,21 +41,21 @@ public class PluginNatura extends ForestryPlugin { private static final String NATURA = "Natura"; - public static Block logNatura; - public static Block logWillow; + private static Block logNatura; + private static Block logWillow; - public static Block leavesNatura; - public static Block saplingNatura; - public static Block saplingNaturaRare; - public static ItemStack berryBlight; - public static ItemStack berryDusk; - public static ItemStack berrySky; - public static ItemStack berrySting; - public static ItemStack berryRasp; - public static ItemStack berryBlue; - public static ItemStack berryBlack; - public static ItemStack berryMalo; - public static ItemStack itemBarley; + private static Block leavesNatura; + private static Block saplingNatura; + private static Block saplingNaturaRare; + private static ItemStack berryBlight; + private static ItemStack berryDusk; + private static ItemStack berrySky; + private static ItemStack berrySting; + private static ItemStack berryRasp; + private static ItemStack berryBlue; + private static ItemStack berryBlack; + private static ItemStack berryMalo; + private static ItemStack itemBarley; @Override public boolean isAvailable() { diff --git a/src/main/java/forestry/plugins/PluginPropolisPipe.java b/src/main/java/forestry/plugins/PluginPropolisPipe.java index 18680697b..cf8d4412b 100755 --- a/src/main/java/forestry/plugins/PluginPropolisPipe.java +++ b/src/main/java/forestry/plugins/PluginPropolisPipe.java @@ -63,7 +63,7 @@ public class PluginPropolisPipe extends ForestryPlugin { } proxy.initPropolisPipe(); - proxy.registerCraftingPropolis(ForestryItem.propolis.getItemStack()); + ProxyPipes.registerCraftingPropolis(ForestryItem.propolis.getItemStack()); } @Override diff --git a/src/main/java/forestry/plugins/PluginStorage.java b/src/main/java/forestry/plugins/PluginStorage.java index 3583dae64..ac09baca6 100755 --- a/src/main/java/forestry/plugins/PluginStorage.java +++ b/src/main/java/forestry/plugins/PluginStorage.java @@ -117,12 +117,12 @@ public class PluginStorage extends ForestryPlugin { BackpackDefinition definition; if (PluginManager.Module.APICULTURE.isEnabled()) { - definition = new BackpackDefinitionApiarist("apiarist", new Color(0xc4923d).getRGB()); + definition = new BackpackDefinitionApiarist(new Color(0xc4923d).getRGB()); BackpackManager.definitions.put(definition.getKey(), definition); } if (PluginManager.Module.LEPIDOPTEROLOGY.isEnabled()) { - definition = new BackpackDefinitionLepidopterist("lepidopterist", new Color(0x995b31).getRGB()); + definition = new BackpackDefinitionLepidopterist(new Color(0x995b31).getRGB()); BackpackManager.definitions.put(definition.getKey(), definition); } diff --git a/src/main/java/forestry/storage/GuiHandlerStorage.java b/src/main/java/forestry/storage/GuiHandlerStorage.java index 262458139..1d08037d0 100755 --- a/src/main/java/forestry/storage/GuiHandlerStorage.java +++ b/src/main/java/forestry/storage/GuiHandlerStorage.java @@ -65,7 +65,7 @@ public class GuiHandlerStorage extends GuiHandlerBase { } ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot("rootBees"); PagedBackpackInventory inventory = new PagedBackpackInventory(player, Defaults.SLOTS_BACKPACK_APIARIST, equipped, cleanId); - return new GuiNaturalistInventory(speciesRoot, player, new ContainerNaturalistBackpack(player, inventory, guiData, 25), inventory, guiData, 5); + return new GuiNaturalistInventory(speciesRoot, player, new ContainerNaturalistBackpack(player, inventory, guiData), inventory, guiData, 5); case BackpackGUI: equipped = getBackpackItem(player); @@ -88,7 +88,7 @@ public class GuiHandlerStorage extends GuiHandlerBase { } speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot("rootButterflies"); inventory = new PagedBackpackInventory(player, Defaults.SLOTS_BACKPACK_APIARIST, equipped, id); - return new GuiNaturalistInventory(speciesRoot, player, new ContainerNaturalistBackpack(player, inventory, guiData, 25), inventory, guiData, 5); + return new GuiNaturalistInventory(speciesRoot, player, new ContainerNaturalistBackpack(player, inventory, guiData), inventory, guiData, 5); default: return null; @@ -125,7 +125,7 @@ public class GuiHandlerStorage extends GuiHandlerBase { return null; } - return new ContainerNaturalistBackpack(player, new PagedBackpackInventory(player, Defaults.SLOTS_BACKPACK_APIARIST, equipped, cleanId), guiData, 25); + return new ContainerNaturalistBackpack(player, new PagedBackpackInventory(player, Defaults.SLOTS_BACKPACK_APIARIST, equipped, cleanId), guiData); case BackpackGUI: equipped = getBackpackItem(player); @@ -149,7 +149,7 @@ public class GuiHandlerStorage extends GuiHandlerBase { return null; } - return new ContainerNaturalistBackpack(player, new PagedBackpackInventory(player, Defaults.SLOTS_BACKPACK_APIARIST, equipped, cleanId), guiData, 25); + return new ContainerNaturalistBackpack(player, new PagedBackpackInventory(player, Defaults.SLOTS_BACKPACK_APIARIST, equipped, cleanId), guiData); default: return null; diff --git a/src/main/java/forestry/storage/gui/ContainerNaturalistBackpack.java b/src/main/java/forestry/storage/gui/ContainerNaturalistBackpack.java index 78609638b..e025ecd76 100755 --- a/src/main/java/forestry/storage/gui/ContainerNaturalistBackpack.java +++ b/src/main/java/forestry/storage/gui/ContainerNaturalistBackpack.java @@ -20,13 +20,13 @@ import forestry.storage.GuiHandlerStorage.PagedBackpackInventory; public class ContainerNaturalistBackpack extends ContainerItemInventory implements IGuiSelectable { - public ContainerNaturalistBackpack(EntityPlayer player, PagedBackpackInventory inventory, int page, int pageSize) { + public ContainerNaturalistBackpack(EntityPlayer player, PagedBackpackInventory inventory, int page) { super(inventory, player.inventory, 18, 120); // Inventory for (int x = 0; x < 5; x++) { for (int y = 0; y < 5; y++) { - addSlotToContainer(new SlotFiltered(inventory, y + page * pageSize + x * 5, 100 + y * 18, 21 + x * 18)); + addSlotToContainer(new SlotFiltered(inventory, y + page * 25 + x * 5, 100 + y * 18, 21 + x * 18)); } } } diff --git a/src/main/java/forestry/storage/items/ItemBackpack.java b/src/main/java/forestry/storage/items/ItemBackpack.java index 73bc4cdc0..0360f58eb 100755 --- a/src/main/java/forestry/storage/items/ItemBackpack.java +++ b/src/main/java/forestry/storage/items/ItemBackpack.java @@ -79,7 +79,7 @@ public class ItemBackpack extends ItemInventoried { } if (!player.isSneaking()) { - openGui(player, itemstack); + openGui(player); } else { switchMode(itemstack); } @@ -104,7 +104,7 @@ public class ItemBackpack extends ItemInventoried { return false; } - return evaluateTileHit(itemstack, player, world, x, y, z, side, hitX, hitY, hitZ); + return evaluateTileHit(itemstack, player, world, x, y, z, side); } public static ItemStack tryStowing(EntityPlayer player, ItemStack backpackStack, ItemStack stack) { @@ -145,7 +145,7 @@ public class ItemBackpack extends ItemInventoried { return InvTools.getInventoryFromTile(targeted, ForgeDirection.getOrientation(side)); } - private boolean evaluateTileHit(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { + private boolean evaluateTileHit(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side) { // Shift right-clicking on an inventory tile will attempt to transfer // items contained in the backpack @@ -205,7 +205,7 @@ public class ItemBackpack extends ItemInventoried { } - public void openGui(EntityPlayer entityplayer, ItemStack itemstack) { + protected void openGui(EntityPlayer entityplayer) { if (getBackpackSize() == Defaults.SLOTS_BACKPACK_DEFAULT) { entityplayer.openGui(ForestryAPI.instance, GuiId.BackpackGUI.ordinal(), entityplayer.worldObj, (int) entityplayer.posX, (int) entityplayer.posY, (int) entityplayer.posZ); @@ -305,7 +305,7 @@ public class ItemBackpack extends ItemInventoried { } } - public static int getSlotsForType(EnumBackpackType type) { + private static int getSlotsForType(EnumBackpackType type) { switch (type) { case APIARIST: return Defaults.SLOTS_BACKPACK_APIARIST; diff --git a/src/main/java/forestry/storage/items/ItemNaturalistBackpack.java b/src/main/java/forestry/storage/items/ItemNaturalistBackpack.java index edac736f2..4de119eb1 100755 --- a/src/main/java/forestry/storage/items/ItemNaturalistBackpack.java +++ b/src/main/java/forestry/storage/items/ItemNaturalistBackpack.java @@ -24,8 +24,8 @@ public class ItemNaturalistBackpack extends ItemBackpack { public static class BackpackDefinitionApiarist extends BackpackDefinition { - public BackpackDefinitionApiarist(String name, int primaryColor) { - super(name, primaryColor); + public BackpackDefinitionApiarist(int primaryColor) { + super("apiarist", primaryColor); } @Override @@ -36,8 +36,8 @@ public class ItemNaturalistBackpack extends ItemBackpack { public static class BackpackDefinitionLepidopterist extends BackpackDefinition { - public BackpackDefinitionLepidopterist(String name, int primaryColor) { - super(name, primaryColor); + public BackpackDefinitionLepidopterist(int primaryColor) { + super("lepidopterist", primaryColor); } @Override @@ -54,7 +54,7 @@ public class ItemNaturalistBackpack extends ItemBackpack { } @Override - public void openGui(EntityPlayer player, ItemStack itemstack) { + public void openGui(EntityPlayer player) { player.openGui(ForestryAPI.instance, guiId, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); } }