Code cleanup and remove some unused code

This commit is contained in:
mezz committed 2015-08-02 22:53:19 -07:00
1 parent f0f8c9a984
commit fdf3493ed0
295 files changed
+899 -2840

No files matched your search

@@ -150,7 +150,7 @@ public class CommandBeeGive extends SubCommand {
return null;
}
String[] getSpecies() {
private static String[] getSpecies() {
List<String> species = new ArrayList<String>();
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;
@@ -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;
@@ -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)
@@ -132,7 +132,7 @@ public class BlockBeehives extends BlockContainer {
return meta;
}
private List<IHiveDrop> getDropsForHive(int meta) {
private static List<IHiveDrop> 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;
@@ -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<String, Integer> 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<ItemStack> drop = new ThreadLocal<ItemStack>();
private final ThreadLocal<ItemStack> drop = new ThreadLocal<ItemStack>();
@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();
@@ -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);
}
@@ -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));
}
}
}
@@ -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);
}
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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;
@@ -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);
@@ -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);
@@ -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;
}
@@ -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<NBTTagCompound, Bee> 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;
}
@@ -951,7 +951,7 @@ public enum BeeDefinition implements IBeeDefinition {
}
};
public static final EnumSet<BeeDefinition> overworldHiveBees = EnumSet.of(FOREST, MARSHY, MEADOWS, MODEST, TROPICAL, WINTRY);
private static final EnumSet<BeeDefinition> overworldHiveBees = EnumSet.of(FOREST, MARSHY, MEADOWS, MODEST, TROPICAL, WINTRY);
private final BeeBranchDefinition branch;
private final IAlleleBeeSpeciesCustom species;
@@ -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<IBee> beeTemplates = new ArrayList<IBee>();
private static final ArrayList<IBee> beeTemplates = new ArrayList<IBee>();
@Override
public ArrayList<IBee> getIndividualTemplates() {
@@ -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);
@@ -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);
@@ -80,7 +80,7 @@ public class GuiImprinter extends GuiForestry<ContainerImprinter, ImprinterInven
RenderHelper.disableStandardItemLighting();
}
private int getHabitatSlotAtPosition(int i, int j) {
private static int getHabitatSlotAtPosition(int i, int j) {
int[] xPos = new int[]{12, 12};
int[] yPos = new int[]{32, 52};
@@ -13,6 +13,7 @@ package forestry.apiculture.items;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@@ -82,44 +83,26 @@ public class ItemArmorApiarist extends ItemArmor implements IArmorApiarist, IArm
return armorType == 0;
}
public static boolean wearsHelmet(EntityPlayer player, String cause, boolean protect) {
ItemStack armorItem = player.inventory.armorInventory[3];
return armorItem != null && armorItem.getItem() instanceof IArmorApiarist
&& ((IArmorApiarist) armorItem.getItem()).protectPlayer(player, armorItem, cause, protect);
}
private static boolean isArmorApiarist(ItemStack itemStack, EntityPlayer player, String cause, boolean protect) {
if (itemStack == null) {
return false;
}
public static boolean wearsChest(EntityPlayer player, String cause, boolean protect) {
ItemStack armorItem = player.inventory.armorInventory[2];
return armorItem != null && armorItem.getItem() instanceof IArmorApiarist
&& ((IArmorApiarist) armorItem.getItem()).protectPlayer(player, armorItem, cause, protect);
}
Item item = itemStack.getItem();
if (!(item instanceof IArmorApiarist)) {
return false;
}
public static boolean wearsLegs(EntityPlayer player, String cause, boolean protect) {
ItemStack armorItem = player.inventory.armorInventory[1];
return armorItem != null && armorItem.getItem() instanceof IArmorApiarist
&& ((IArmorApiarist) armorItem.getItem()).protectPlayer(player, armorItem, cause, protect);
}
public static boolean wearsBoots(EntityPlayer player, String cause, boolean protect) {
ItemStack armorItem = player.inventory.armorInventory[0];
return armorItem != null && armorItem.getItem() instanceof IArmorApiarist
&& ((IArmorApiarist) armorItem.getItem()).protectPlayer(player, armorItem, cause, protect);
return ((IArmorApiarist) item).protectPlayer(player, itemStack, cause, protect);
}
public static int wearsItems(EntityPlayer player, String cause, boolean protect) {
int count = 0;
if (wearsHelmet(player, cause, protect)) {
count++;
}
if (wearsChest(player, cause, protect)) {
count++;
}
if (wearsLegs(player, cause, protect)) {
count++;
}
if (wearsBoots(player, cause, protect)) {
count++;
for (ItemStack armorItem : player.inventory.armorInventory) {
if (isArmorApiarist(armorItem, player, cause, protect)) {
count++;
}
}
return count;
@@ -106,7 +106,7 @@ public class ItemHabitatLocator extends ItemInventoried {
list.add(StringUtil.localize("gui.humidity") + ": " + AlleleManager.climateHelper.toDisplay(humidity));
}
public void startBiomeSearch(IBee bee, EntityPlayer player) {
private void startBiomeSearch(IBee bee, EntityPlayer player) {
this.targetBiomes = new HashSet<BiomeGenBase>(bee.getSuitableBiomes());
this.searchAngleIteration = 0;
@@ -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<Integer> validCombs = new ArrayList<Integer>(getCombTypeCount());
private int getRandomCombType(Random random, boolean includeSecret) {
List<Integer> validCombs = new ArrayList<Integer>(combs.length);
for (int i = 0; i < combs.length; i++) {
if (!combs[i].isSecret || includeSecret) {
validCombs.add(i);
@@ -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));
}
}
}
@@ -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;
}
@@ -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 {
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
@@ -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));
@@ -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) {
@@ -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;
}
@@ -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;
@@ -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;
@@ -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);
}
@@ -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;
@@ -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);
@@ -29,26 +29,12 @@ import forestry.core.config.Config;
import forestry.core.config.Defaults;
import forestry.plugins.PluginApiculture;
/**
* @author CovertJaguar <http://www.railcraft.info/>
*/
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<Hive> 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<Hive> hives) {
private static void decorateHivesDebug(World world, int chunkX, int chunkZ, List<Hive> 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) {
@@ -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;
@@ -28,8 +28,8 @@ import forestry.api.genetics.IFruitFamily;
*/
public class FruitProviderRandom extends FruitProviderNone {
HashMap<ItemStack, Float> products = new HashMap<ItemStack, Float>();
int colour = 0xffffff;
private final Map<ItemStack, Float> products = new HashMap<ItemStack, Float>();
private int colour = 0xffffff;
public FruitProviderRandom(String key, IFruitFamily family, ItemStack product, float modifier) {
super(key, family);
@@ -25,12 +25,13 @@ import forestry.api.genetics.IFruitFamily;
public class FruitProviderRipening extends FruitProviderNone {
HashMap<ItemStack, Float> products = new HashMap<ItemStack, Float>();
private final Map<ItemStack, Float> products = new HashMap<ItemStack, Float>();
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);
@@ -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);
}
@@ -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);
}
@@ -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;
@@ -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;
}
@@ -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);
}
@@ -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<ArrayList<ItemStack>> drops = new ThreadLocal<ArrayList<ItemStack>>();
private final ThreadLocal<ArrayList<ItemStack>> drops = new ThreadLocal<ArrayList<ItemStack>>();
@Override
public void onBlockHarvested(World world, int x, int y, int z, int metadata, EntityPlayer player) {
@@ -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 {
@@ -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);
}
@@ -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);
}
@@ -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;
@@ -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;
@@ -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;
}
@@ -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;
}
@@ -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<ITree> treeTemplates = new ArrayList<ITree>();
private final ArrayList<ITreekeepingMode> treekeepingModes = new ArrayList<ITreekeepingMode>();
@@ -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;
}
@@ -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);
}
@@ -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();
}
}
@@ -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);
@@ -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);
@@ -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
@@ -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);
@@ -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;
@@ -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);
}
}
@@ -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));
@@ -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);
}
}
@@ -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;
}
@@ -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);
@@ -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";
}
}
@@ -28,7 +28,7 @@ import forestry.core.utils.Utils;
public abstract class GuiHandlerBase implements IGuiHandler {
public static <T extends TileEntity> T getTile(World world, int x, int y, int z, EntityPlayer player, Class<T> tileClass) {
protected static <T extends TileEntity> T getTile(World world, int x, int y, int z, EntityPlayer player, Class<T> 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;
}
}
@@ -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;
@@ -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<String, ICircuitLayout> DUMMY_MAP = new LinkedHashMap<String, ICircuitLayout>();
private static final Map<String, ICircuitLayout> DUMMY_MAP = new LinkedHashMap<String, ICircuitLayout>();
private final Map<String, ICircuitLayout> layoutMap = new LinkedHashMap<String, ICircuitLayout>();
private final Map<String, ICircuit> circuitMap = new LinkedHashMap<String, ICircuit>();
@@ -72,7 +72,7 @@ public class ContainerSolderingIron extends ContainerItemInventory<SolderingInve
sendSelection(player);
}
public void sendSelection(EntityPlayer player) {
private void sendSelection(EntityPlayer player) {
PacketString packet = new PacketString(PacketId.GUI_LAYOUT_SELECT, inventory.getLayout().getUID());
Proxies.net.sendToPlayer(packet, player);
}
@@ -81,7 +81,7 @@ public class ItemCircuitBoard extends ItemForestryMultiPass {
return chipset;
}
public static void saveChipset(ItemStack itemstack, ICircuitBoard circuitboard) {
private static void saveChipset(ItemStack itemstack, ICircuitBoard circuitboard) {
if (circuitboard == null) {
itemstack.setTagCompound(null);
return;
@@ -40,18 +40,18 @@ public class CommandPlugins extends SubCommand {
}
}
private void listPluginsForSender(ICommandSender sender) {
String pluginList = "";
private static void listPluginsForSender(ICommandSender sender) {
StringBuilder pluginList = new StringBuilder();
for (PluginManager.Module pluginModule : PluginManager.getLoadedModules()) {
if (!pluginList.isEmpty()) {
pluginList += ", ";
if (pluginList.length() > 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);
@@ -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);
}
}
@@ -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);
}
@@ -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.";
@@ -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
@@ -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);
}
}
@@ -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<String> changelog = new ArrayList<String>();
while ((line = reader.readLine()) != null) {
if (line.startsWith("#")) {
@@ -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);
}
@@ -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;
}
}
@@ -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<StandardTank> implements ITankMa
}
@Override
public final boolean addAll(Collection<? extends StandardTank> collection) {
public final boolean addAll(@Nonnull Collection<? extends StandardTank> 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<StandardTank> 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<StandardTank> 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<StandardTank> 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;
}
@@ -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;
}
@@ -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;
@@ -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<ItemStack> 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
@@ -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);
}
@@ -52,12 +52,12 @@ public class BlockResource extends Block {
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
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));
}
@@ -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;
@@ -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);
}
+15 -18
View File
@@ -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;
@@ -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<? extends TileEntity> 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<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return new ArrayList<ItemStack>();
}
/* 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);
}
}
@@ -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<? extends TileEntity> teClass, IRecipe... recipes) {
super(meta, teIdent, teClass, recipes);
}
public MachineNBTDefinition(int meta, String teIdent, Class<? extends TileEntity> 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);
}
}
@@ -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;
}
@@ -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);
}
@@ -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;
}
Loaded 100 of 295 files, more files were not shown because too many files have changed in this diff. Show more