Merge branch 'dev' of github.com:ForestryMC/ForestryMC into dev

Conflicts:
	src/main/java/forestry/core/utils/BlockUtil.java
This commit is contained in:
CovertJaguar committed 2014-11-30 16:50:09 -08:00
commit 3d765067cf
271 files changed
+1395 -1678

No files matched your search

@@ -12,7 +12,7 @@ import net.minecraftforge.common.util.ForgeDirection;
*/
public class TileEnergyHandler extends TileEntity implements IEnergyHandler {
protected EnergyStorage storage = new EnergyStorage(32000);
protected final EnergyStorage storage = new EnergyStorage(32000);
@Override
public void readFromNBT(NBTTagCompound nbt) {
@@ -32,7 +32,7 @@ import forestry.plugins.PluginApiculture;
public class BeekeepingLogic implements IBeekeepingLogic {
private static final int MAX_POLLINATION_ATTEMPTS = 20;
IBeeHousing housing;
private final IBeeHousing housing;
// Breeding
private int breedingTime;
private final int totalBreedingTime = Defaults.APIARY_BREEDING_TIME;
@@ -106,7 +106,7 @@ public class FlowerProviderVanilla implements IFlowerProvider {
@Override
public ItemStack[] getItemStacks() {
return FlowerManager.plainFlowers.toArray(new ItemStack[0]);
return FlowerManager.plainFlowers.toArray(new ItemStack[FlowerManager.plainFlowers.size()]);
}
}
@@ -59,7 +59,7 @@ public class VillageHandlerApiculture implements IVillageCreationHandler, IVilla
@Override
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int size) {
return new StructureVillagePieces.PieceWeight(ComponentVillageBeeHouse.class, 15, MathHelper.getRandomIntegerInRange(random, 0 + size, 1 + size));
return new StructureVillagePieces.PieceWeight(ComponentVillageBeeHouse.class, 15, MathHelper.getRandomIntegerInRange(random, size, 1 + size));
}
@Override
@@ -31,8 +31,8 @@ import java.util.List;
public class CommandBeekeepingGiveBee extends SubCommand {
private String beeTypeHelpString;
private String[] beeTypeArr;
private final String beeTypeHelpString;
private final String[] beeTypeArr;
public CommandBeekeepingGiveBee() {
super("give");
@@ -25,8 +25,8 @@ import java.util.List;
public class CommandBeekeepingModeInfo extends SubCommand {
private String[] modeStringArr;
private String helpString;
private final String[] modeStringArr;
private final String helpString;
public CommandBeekeepingModeInfo() {
super("info");
@@ -21,7 +21,7 @@ import java.util.ArrayList;
import java.util.List;
public class CommandBeekeepingModeSet extends SubCommand {
private String[] modeStringArr;
private final String[] modeStringArr;
public CommandBeekeepingModeSet() {
super("set");
@@ -10,10 +10,16 @@
******************************************************************************/
package forestry.apiculture.gadgets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IHiveDrop;
import forestry.api.apiculture.hives.HiveManager;
import forestry.api.core.Tabs;
import forestry.apiculture.MaterialBeehive;
import forestry.core.config.Config;
import forestry.core.render.TextureManager;
import forestry.core.utils.StackUtils;
import net.minecraft.block.BlockContainer;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -26,16 +32,9 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IHiveDrop;
import forestry.api.core.Tabs;
import forestry.apiculture.MaterialBeehive;
import forestry.core.config.Config;
import forestry.core.render.TextureManager;
import forestry.core.utils.StackUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class BlockBeehives extends BlockContainer {
@@ -84,7 +83,7 @@ public class BlockBeehives extends BlockContainer {
return ret;
}
ArrayList<IHiveDrop> dropList = BeeManager.hiveDrops[metadata - 1];
List<IHiveDrop> dropList = getDropsForHive(metadata);
Collections.shuffle(dropList);
// Grab a princess
@@ -123,6 +122,29 @@ public class BlockBeehives extends BlockContainer {
return meta;
}
private List<IHiveDrop> getDropsForHive(int meta) {
if (meta == 8) //TODO: make a real hive for swarm
return BeeManager.hiveDrops[meta];
String hiveName = getHiveNameForMeta(meta);
if (hiveName == null)
return Collections.emptyList();
return HiveManager.get(hiveName).getDrops();
}
private String getHiveNameForMeta(int meta) {
switch (meta) {
case 1: return HiveManager.forest;
case 2: return HiveManager.meadows;
case 3: return HiveManager.desert;
case 4: return HiveManager.jungle;
case 5: return HiveManager.end;
case 6: return HiveManager.snow;
case 7: return HiveManager.swamp;
}
return null;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List itemList) {
@@ -40,7 +40,7 @@ public class StructureLogicAlveary extends StructureLogic {
slabBlocks.add(ForestryBlock.slabs1.block());
slabBlocks.add(ForestryBlock.slabs2.block());
slabBlocks.add(ForestryBlock.slabs3.block());
if (ForestryBlock.slabs4 != null)
if (ForestryBlock.slabs4.block() != null)
slabBlocks.add(ForestryBlock.slabs4.block());
}
@@ -36,6 +36,11 @@ import java.util.LinkedList;
public abstract class TileAlveary extends TileForestry implements IAlvearyComponent {
private final IStructureLogic structureLogic;
private boolean isMaster;
protected int masterX, masterZ;
protected int masterY = -99;
protected TileInventoryAdapter inventory;
protected final int componentBlockMeta;
@@ -126,11 +131,6 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
}
/* ITILESTRUCTURE */
IStructureLogic structureLogic;
private boolean isMaster;
protected int masterX, masterZ;
protected int masterY = -99;
@Override
public String getTypeUID() {
@@ -32,8 +32,8 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner
this.boundaryUp = boundaryUp;
}
}
protected EnergyManager energyManager;
ClimateControl climateControl;
protected final EnergyManager energyManager;
private final ClimateControl climateControl;
private int transferTime = 0;
private int animationDelay = 0;
private final int textureOff;
@@ -59,9 +59,9 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
private final HygroregulatorRecipe[] recipes;
/* MEMBERS */
InventoryAdapter canInventory = new InventoryAdapter(1, "CanInv");
private final InventoryAdapter canInventory = new InventoryAdapter(1, "CanInv");
private final TankManager tankManager;
private FilteredTank liquidTank;
private final FilteredTank liquidTank;
private HygroregulatorRecipe currentRecipe;
private int transferTime;
@@ -34,7 +34,7 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe
public static final int SLOTS_POLLEN_COUNT = 4;
public static final int SLOT_SIEVE = 4;
InventoryAdapter inventory = new InventoryAdapter(5, "Items", 1);
private final InventoryAdapter inventory = new InventoryAdapter(5, "Items", 1);
public TileAlvearySieve() {
super(BLOCK_META);
@@ -39,7 +39,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
@@ -47,15 +46,16 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
public static final int SLOT_QUEEN = 0;
public static final int SLOT_DRONE = 1;
public static final int SLOT_INVENTORY_1 = 2;
protected static int SLOT_PRODUCT_1 = 2;
protected static int SLOT_PRODUCT_COUNT = 7;
public static final int SLOT_PRODUCT_1 = 2;
public static final int SLOT_PRODUCT_COUNT = 7;
public static final int SLOT_FRAMES_1 = 9;
public static final int SLOT_FRAMES_2 = 10;
public static final int SLOT_FRAMES_3 = 11;
public static final int SLOT_INVENTORY_COUNT = 7;
public static final int SLOT_FRAMES_COUNT = 3;
// Inventory
protected InventoryAdapter inventory = new InventoryAdapter(12, "Items");
protected final InventoryAdapter inventory = new InventoryAdapter(12, "Items");
private final IBeekeepingLogic logic;
private BiomeGenBase biome;
private int displayHealthMax = 0;
@@ -18,7 +18,7 @@ import forestry.core.utils.InventoryAdapter;
public class TileSwarm extends TileEntity {
public InventoryAdapter contained = new InventoryAdapter(2, "Contained");
public final InventoryAdapter contained = new InventoryAdapter(2, "Contained");
@Override
public boolean canUpdate() {
@@ -62,7 +62,7 @@ public class AIAvoidPlayers extends EntityAIBase {
return false;
pathing = pathNavigator.getPathToXYZ(randomTarget.xCoord, randomTarget.yCoord, randomTarget.zCoord);
return pathing == null ? false : pathing.isDestinationSame(randomTarget);
return pathing != null && pathing.isDestinationSame(randomTarget);
}
@Override
@@ -10,20 +10,9 @@
******************************************************************************/
package forestry.apiculture.genetics;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.mojang.authlib.GameProfile;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IAlleleBeeSpecies;
@@ -40,6 +29,15 @@ import forestry.core.config.Defaults;
import forestry.core.genetics.AlleleSpecies;
import forestry.core.render.TextureManager;
import forestry.core.utils.StackUtils;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies, IIconProvider {
@@ -148,8 +146,7 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
@Override
public ItemStack[] getResearchBounty(World world, GameProfile researcher, IIndividual individual, int bountyLevel) {
ArrayList<ItemStack> bounty = new ArrayList<ItemStack>();
for(ItemStack stack : super.getResearchBounty(world, researcher, individual, bountyLevel))
bounty.add(stack);
Collections.addAll(bounty, super.getResearchBounty(world, researcher, individual, bountyLevel));
if(bountyLevel > 10) {
for(ItemStack stack : specialty.keySet()) {
@@ -159,7 +156,7 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
for(ItemStack stack : products.keySet()) {
bounty.add(StackUtils.copyWithRandomSize(stack, (int)((float)bountyLevel / 2), world.rand));
}
return bounty.toArray(StackUtils.EMPTY_STACK_ARRAY);
return bounty.toArray(new ItemStack[bounty.size()]);
}
/* OTHER */
@@ -211,7 +208,7 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
if(EnumBeeType.values()[i] == EnumBeeType.NONE)
continue;
icons[i][0] = TextureManager.getInstance().registerTex(register, "bees/" + iconType + "/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".outline");;
icons[i][0] = TextureManager.getInstance().registerTex(register, "bees/" + iconType + "/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".outline");
icons[i][1] = (EnumBeeType.values()[i] != EnumBeeType.LARVAE) ? body1
: TextureManager.getInstance().registerTex(register, "bees/" + iconType + "/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".body");
icons[i][2] = TextureManager.getInstance().registerTex(register, "bees/" + iconType + "/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".body2");
@@ -25,7 +25,7 @@ import forestry.core.utils.DamageSourceForestry;
public class AlleleEffectAggressive extends AlleleEffectThrottled {
public static DamageSource damageSourceBeeAggressive = new DamageSourceForestry("bee.aggressive");
public static final DamageSource damageSourceBeeAggressive = new DamageSourceForestry("bee.aggressive");
public AlleleEffectAggressive(String uid) {
super(uid, "aggressive", true, 40, false, false);
@@ -25,9 +25,9 @@ import forestry.core.genetics.EffectData;
public class AlleleEffectCreeper extends AlleleEffectThrottled {
private final int explosionChance = 50;
byte defaultForce = 12;
byte indexExplosionTimer = 1;
byte indexExplosionForce = 2;
private final byte defaultForce = 12;
private final byte indexExplosionTimer = 1;
private final byte indexExplosionForce = 2;
public AlleleEffectCreeper(String uid) {
super(uid, "creeper", true, 20, false, true);
@@ -25,8 +25,8 @@ import forestry.plugins.PluginApiculture;
public class AlleleEffectIgnition extends AlleleEffectThrottled {
int ignitionChance = 50;
int fireDuration = 500;
private final int ignitionChance = 50;
private final int fireDuration = 500;
public AlleleEffectIgnition(String uid) {
super(uid, "ignition", false, 20, false, true);
@@ -24,7 +24,7 @@ import forestry.core.utils.DamageSourceForestry;
public class AlleleEffectMisanthrope extends AlleleEffectThrottled {
public static DamageSource damageSourceBeeEnd = new DamageSourceForestry("bee.end");
public static final DamageSource damageSourceBeeEnd = new DamageSourceForestry("bee.end");
public AlleleEffectMisanthrope(String uid) {
super(uid, "misanthrope", true, 20, false, false);
@@ -32,7 +32,7 @@ import forestry.core.utils.Vect;
public class AlleleEffectRadioactive extends AlleleEffectThrottled {
public static DamageSource damageSourceBeeRadioactive = new DamageSourceForestry("bee.radioactive");
public static final DamageSource damageSourceBeeRadioactive = new DamageSourceForestry("bee.radioactive");
public AlleleEffectRadioactive(String uid) {
super(uid, "radioactive", true, 40, false, true);
@@ -16,7 +16,7 @@ import forestry.core.genetics.Allele;
public class AlleleFlowers extends Allele implements IAlleleFlowers {
IFlowerProvider provider;
private final IFlowerProvider provider;
public AlleleFlowers(String uid, IFlowerProvider provider) {
this(uid, provider, false);
@@ -69,12 +69,6 @@ public class Bee extends IndividualLiving implements IBee {
this.isIrregularMating = mate.isNatural() != this.isNatural;
}
public Bee(IBeeGenome genome, IBee mate) {
this(genome);
this.mate = mate.getGenome();
this.isIrregularMating = mate.isNatural() != this.isNatural;
}
public Bee(World world, IBeeGenome genome) {
this(world, genome, true, 0);
}
@@ -414,12 +408,13 @@ public class Bee extends IndividualLiving implements IBee {
}
return products.toArray(new ItemStack[0]);
return products.toArray(new ItemStack[products.size()]);
}
@Override
public ItemStack[] getSpecialtyList() {
return genome.getPrimary().getSpecialty().keySet().toArray(new ItemStack[0]);
Set<ItemStack> specialties = genome.getPrimary().getSpecialty().keySet();
return specialties.toArray(new ItemStack[specialties.size()]);
}
@Override
@@ -460,7 +455,7 @@ public class Bee extends IndividualLiving implements IBee {
// We are done if the we are not jubilant.
if (!primary.isJubilant(genome, housing) || !secondary.isJubilant(genome, housing))
return products.toArray(StackUtils.EMPTY_STACK_ARRAY);
return products.toArray(new ItemStack[products.size()]);
// / Specialty products
for (Map.Entry<ItemStack, Integer> entry : primary.getSpecialty().entrySet())
@@ -468,7 +463,7 @@ public class Bee extends IndividualLiving implements IBee {
products.add(entry.getKey().copy());
return genome.getFlowerProvider().affectProducts(housing.getWorld(), this, housing.getXCoord(), housing.getYCoord(), housing.getZCoord(),
products.toArray(StackUtils.EMPTY_STACK_ARRAY));
products.toArray(new ItemStack[products.size()]));
}
/* REPRODUCTION */
@@ -512,7 +507,7 @@ public class Bee extends IndividualLiving implements IBee {
}
if (bees.size() > 0)
return bees.toArray(new IBee[0]);
return bees.toArray(new IBee[bees.size()]);
else
return null;
}
@@ -204,7 +204,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
}
/* TEMPLATES */
public static ArrayList<IBee> beeTemplates = new ArrayList<IBee>();
public static final ArrayList<IBee> beeTemplates = new ArrayList<IBee>();
@Override
public ArrayList<IBee> getIndividualTemplates() {
@@ -248,7 +248,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
}
/* BREEDING MODES */
ArrayList<IBeekeepingMode> beekeepingModes = new ArrayList<IBeekeepingMode>();
final ArrayList<IBeekeepingMode> beekeepingModes = new ArrayList<IBeekeepingMode>();
public static IBeekeepingMode activeBeekeepingMode;
@Override
@@ -23,11 +23,11 @@ import forestry.api.apiculture.IBeekeepingMode;
public class BeekeepingMode implements IBeekeepingMode {
public static IBeekeepingMode easy = new BeekeepingMode("EASY", 2.0f, 1.0f, 1.0f, false, false);
public static IBeekeepingMode normal = new BeekeepingMode("NORMAL", 1.0f, 1.0f, 1.0f, false, true);
public static IBeekeepingMode hard = new BeekeepingMode("HARD", 0.75f, 1.5f, 1.0f, false, true);
public static IBeekeepingMode hardcore = new BeekeepingMode("HARDCORE", 0.5f, 5.0f, 0.8f, true, true);
public static IBeekeepingMode insane = new BeekeepingMode("INSANE", 0.2f, 10.0f, 0.6f, true, true);
public static final IBeekeepingMode easy = new BeekeepingMode("EASY", 2.0f, 1.0f, 1.0f, false, false);
public static final IBeekeepingMode normal = new BeekeepingMode("NORMAL", 1.0f, 1.0f, 1.0f, false, true);
public static final IBeekeepingMode hard = new BeekeepingMode("HARD", 0.75f, 1.5f, 1.0f, false, true);
public static final IBeekeepingMode hardcore = new BeekeepingMode("HARDCORE", 0.5f, 5.0f, 0.8f, true, true);
public static final IBeekeepingMode insane = new BeekeepingMode("INSANE", 0.2f, 10.0f, 0.6f, true, true);
final Random rand;
final String name;
@@ -10,30 +10,29 @@
******************************************************************************/
package forestry.apiculture.genetics;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IHiveDrop;
import forestry.api.genetics.IAllele;
import forestry.plugins.PluginApiculture;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.Collections;
public class HiveDrop implements IHiveDrop {
private IAllele[] template;
private ArrayList<ItemStack> additional = new ArrayList<ItemStack>();
private int chance;
private final IAllele[] template;
private final ArrayList<ItemStack> additional = new ArrayList<ItemStack>();
private final int chance;
private float ignobleShare = 0.0f;
public HiveDrop(IAllele[] template, ItemStack[] bonus, int chance) {
this.template = template;
this.chance = chance;
for (ItemStack stack : bonus)
this.additional.add(stack);
Collections.addAll(this.additional, bonus);
}
public HiveDrop setIgnobleShare(float share) {
@@ -24,9 +24,9 @@ import forestry.core.utils.Vect;
public class MutationEMC extends MutationReqRes {
int emcRequired = 0;
Class<?> condenserClass;
Field emcField;
private final int emcRequired;
private final Class<?> condenserClass;
private final Field emcField;
public MutationEMC(IAllele allele0, IAllele allele1, IAllele[] template, int chance, ItemStack blockRequired, Class<?> condenserClass, Field emcField,
int emcRequired) {
@@ -19,12 +19,12 @@ import forestry.api.genetics.IGenome;
public class MutationTimeLimited extends BeeMutation {
/**
* Fed up with Date and Calendar and their shinenigans
* Fed up with Date and Calendar and their shenanigans
*/
public static class DayMonth {
public int day;
public int month;
public final int day;
public final int month;
public DayMonth() {
this.day = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
@@ -93,8 +93,9 @@ public class MutationTimeLimited extends BeeMutation {
return day + "." + month;
}
}
DayMonth start;
DayMonth end;
private final DayMonth start;
private final DayMonth end;
public MutationTimeLimited(IAllele allele0, IAllele allele1, IAllele[] template, int chance, DayMonth start) {
this(allele0, allele1, template, chance, start, null);
@@ -113,7 +114,7 @@ public class MutationTimeLimited extends BeeMutation {
if (chance == 0)
return 0;
if (start == null && end == null)
if (start == null)
return chance;
DayMonth now = new DayMonth();
@@ -22,7 +22,7 @@ import forestry.core.gui.slots.SlotCustom;
public class ContainerAlveary extends ContainerForestry {
private TileAlvearyPlain tile;
private final TileAlvearyPlain tile;
public ContainerAlveary(InventoryPlayer player, TileAlvearyPlain tile) {
super(tile);
@@ -31,10 +31,10 @@ public class ContainerAlveary extends ContainerForestry {
tile.sendNetworkUpdate();
// Queen/Princess
this.addSlot(new SlotCustom(tile, TileAlvearyPlain.SLOT_QUEEN, 29, 39, new Object[] { ForestryItem.beePrincessGE, ForestryItem.beeQueenGE }));
this.addSlot(new SlotCustom(tile, TileAlvearyPlain.SLOT_QUEEN, 29, 39, ForestryItem.beePrincessGE, ForestryItem.beeQueenGE));
// Drone
this.addSlot(new SlotCustom(tile, TileAlvearyPlain.SLOT_DRONE, 29, 65, new Object[] { ForestryItem.beeDroneGE }));
this.addSlot(new SlotCustom(tile, TileAlvearyPlain.SLOT_DRONE, 29, 65, ForestryItem.beeDroneGE));
// Product Inventory
this.addSlot(new SlotClosed(tile, 2, 116, 52));
@@ -62,8 +62,8 @@ public class ContainerAlveary extends ContainerForestry {
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < crafters.size(); i++)
tile.sendGUINetworkData(this, (ICrafting) crafters.get(i));
for (Object crafter : crafters)
tile.sendGUINetworkData(this, (ICrafting) crafter);
}
}
@@ -10,17 +10,15 @@
******************************************************************************/
package forestry.apiculture.gui;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import forestry.apiculture.gadgets.TileAlvearyHygroregulator;
import forestry.core.gui.ContainerLiquidTanks;
import forestry.core.gui.slots.SlotLiquidContainer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
public class ContainerAlvearyHygroregulator extends ContainerLiquidTanks {
TileAlvearyHygroregulator tile;
private final TileAlvearyHygroregulator tile;
public ContainerAlvearyHygroregulator(IInventory inventory, TileAlvearyHygroregulator tile) {
super(inventory, tile);
@@ -22,7 +22,7 @@ import forestry.core.gui.slots.SlotCustom;
public class ContainerAlvearySieve extends ContainerForestry {
TileAlvearySieve tile;
private final TileAlvearySieve tile;
public ContainerAlvearySieve(InventoryPlayer player, TileAlvearySieve tile) {
super(tile.getInternalInventory());
@@ -30,10 +30,10 @@ public class ContainerAlvearySieve extends ContainerForestry {
this.tile = tile;
IInventory inventory = tile.getInternalInventory();
addSlot(new SlotCustom(inventory, 0, 94, 52, new Object[0]).setCrafter(tile));
addSlot(new SlotCustom(inventory, 1, 115, 39, new Object[0]).setCrafter(tile));
addSlot(new SlotCustom(inventory, 2, 73, 39, new Object[0]).setCrafter(tile));
addSlot(new SlotCustom(inventory, 3, 94, 26, new Object[0]).setCrafter(tile));
addSlot(new SlotCustom(inventory, 0, 94, 52).setCrafter(tile));
addSlot(new SlotCustom(inventory, 1, 115, 39).setCrafter(tile));
addSlot(new SlotCustom(inventory, 2, 73, 39).setCrafter(tile));
addSlot(new SlotCustom(inventory, 3, 94, 26).setCrafter(tile));
addSlot(new SlotCustom(inventory, TileAlvearySieve.SLOT_SIEVE, 43, 39, ForestryItem.craftingMaterial.getItemStack(1, 3)).setCrafter(tile));
@@ -10,13 +10,15 @@
******************************************************************************/
package forestry.apiculture.gui;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import forestry.api.apiculture.BeeManager;
import forestry.apiculture.gadgets.TileAlvearySwarmer;
import forestry.core.gui.ContainerForestry;
import forestry.core.gui.slots.SlotCustom;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import java.util.Set;
public class ContainerAlvearySwarmer extends ContainerForestry {
@@ -39,6 +41,7 @@ public class ContainerAlvearySwarmer extends ContainerForestry {
}
private Object[] getInducerItems() {
return BeeManager.inducers.keySet().toArray(new Object[0]);
Set<ItemStack> inducers = BeeManager.inducers.keySet();
return inducers.toArray(new Object[inducers.size()]);
}
}
@@ -77,8 +77,8 @@ public class ContainerApiary extends ContainerForestry {
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < crafters.size(); i++) {
tile.sendGUINetworkData(this, (ICrafting) crafters.get(i));
for (Object crafter : crafters) {
tile.sendGUINetworkData(this, (ICrafting) crafter);
}
}
@@ -24,7 +24,7 @@ import forestry.core.proxy.Proxies;
public class ContainerHabitatLocator extends ContainerItemInventory {
public BiomefinderInventory inventory;
public final BiomefinderInventory inventory;
public ContainerHabitatLocator(InventoryPlayer inventoryplayer, BiomefinderInventory inventory) {
super(inventory, inventoryplayer.player);
@@ -32,12 +32,12 @@ public class ContainerHabitatLocator extends ContainerItemInventory {
this.inventory = inventory;
// Energy
this.addSlot(new SlotCustom(inventory, 2, 152, 8, new Object[] { ForestryItem.honeydew, ForestryItem.honeyDrop }));
this.addSlot(new SlotCustom(inventory, 2, 152, 8, ForestryItem.honeydew, ForestryItem.honeyDrop));
// Bee to analyze
this.addSlot(new SlotCustom(inventory, 0, 152, 32, new Object[] { ItemBeeGE.class }));
this.addSlot(new SlotCustom(inventory, 0, 152, 32, ItemBeeGE.class));
// Analyzed bee
this.addSlot(new SlotCustom(inventory, 1, 152, 75, new Object[] { ItemBeeGE.class }));
this.addSlot(new SlotCustom(inventory, 1, 152, 75, ItemBeeGE.class));
// Player inventory
for (int i1 = 0; i1 < 3; i1++)
@@ -28,17 +28,17 @@ import forestry.core.proxy.Proxies;
public class ContainerImprinter extends ContainerForestry implements IGuiSelectable {
public ImprinterInventory inventory;
private boolean isNetSynched = false;
public final ImprinterInventory inventory;
private boolean isNetSynced = false;
public ContainerImprinter(InventoryPlayer inventoryplayer, ImprinterInventory inventory) {
super(inventory);
this.inventory = inventory;
// Input
this.addSlot(new SlotCustom(inventory, 0, 152, 12, new Object[] { ItemBeeGE.class }));
this.addSlot(new SlotCustom(inventory, 0, 152, 12, ItemBeeGE.class));
// Output
this.addSlot(new SlotCustom(inventory, 1, 152, 72, new Object[] { ItemBeeGE.class }));
this.addSlot(new SlotCustom(inventory, 1, 152, 72, ItemBeeGE.class));
// Player inventory
for (int i1 = 0; i1 < 3; i1++)
@@ -84,7 +84,7 @@ public class ContainerImprinter extends ContainerForestry implements IGuiSelecta
private void sendSelectionChange(PacketPayload payload) {
PacketUpdate packet = new PacketUpdate(PacketIds.GUI_SELECTION_CHANGE, payload);
Proxies.net.sendToServer(packet);
isNetSynched = false;
isNetSynced = false;
}
@Override
@@ -94,8 +94,8 @@ public class ContainerImprinter extends ContainerForestry implements IGuiSelecta
}
public void updateContainer(World world) {
if (!isNetSynched && !Proxies.common.isSimulating(world)) {
isNetSynched = true;
if (!isNetSynced && !Proxies.common.isSimulating(world)) {
isNetSynced = true;
Proxies.net.sendToServer(new PacketUpdate(PacketIds.IMPRINT_SELECTION_GET));
}
}
@@ -140,7 +140,7 @@ public class GuiBeealyzer extends GuiAlyzer {
.getArea().toString(), bee, EnumBeeChromosome.TERRITORY);
drawRow(StringUtil.localize("gui.effect"), bee.getGenome().getEffect().getName(),
((IAlleleBeeEffect) bee.getGenome().getInactiveAllele(EnumBeeChromosome.EFFECT.ordinal())).getName(), bee,
bee.getGenome().getInactiveAllele(EnumBeeChromosome.EFFECT.ordinal()).getName(), bee,
EnumBeeChromosome.EFFECT);
newLine();
@@ -39,7 +39,7 @@ import java.util.List;
public class ItemBeeGE extends ItemGE {
EnumBeeType type;
private final EnumBeeType type;
public ItemBeeGE(EnumBeeType type) {
super();
@@ -141,7 +141,7 @@ public class ItemBeeGE extends ItemGE {
public int getColourFromSpecies(IAlleleSpecies species, int renderPass) {
if (species != null && species instanceof IAlleleBeeSpecies)
return ((IAlleleBeeSpecies) species).getIconColour(renderPass);
return species.getIconColour(renderPass);
else
return 0xffffff;
@@ -27,9 +27,9 @@ public class ItemHoneycomb extends ItemForestryMultiPass {
private static class CombInfo {
public String name;
public int primaryColor;
public int secondaryColor;
public final String name;
public final int primaryColor;
public final int secondaryColor;
public boolean isSecret = false;
public CombInfo(String name, int primaryColor, int secondaryColor) {
@@ -43,7 +43,8 @@ public class ItemHoneycomb extends ItemForestryMultiPass {
return this;
}
}
public CombInfo[] combs = new CombInfo[]{new CombInfo("honey", 0xe8d56a, 0xffa12b), // 0
public final CombInfo[] combs = new CombInfo[]{
new CombInfo("honey", 0xe8d56a, 0xffa12b), // 0
new CombInfo("cocoa", 0x674016, 0xffb62b).setIsSecret(), // 1
new CombInfo("simmering", 0x981919, 0xffb62b), // 2
new CombInfo("stringy", 0xc8be67, 0xbda93e), // 3
@@ -37,7 +37,7 @@ public class ItemImprinter extends ItemForestry {
private int primaryIndex = 0;
private int secondaryIndex = 0;
EntityPlayer player;
private final EntityPlayer player;
public ImprinterInventory(EntityPlayer player) {
this.player = player;
@@ -22,18 +22,18 @@ import forestry.api.apiculture.EnumBeeType;
public class ModelBee extends ModelBase {
//fields
ModelRenderer snout;
ModelRenderer torsoWing;
ModelRenderer rump;
ModelRenderer tail;
ModelRenderer tailEnd;
ModelRenderer bridge;
ModelRenderer eyeRight;
ModelRenderer eyeLeft;
ModelRenderer wingLeft;
ModelRenderer wingRight;
ModelRenderer crownQueen;
ModelRenderer crownPrincess;
private final ModelRenderer snout;
private final ModelRenderer torsoWing;
private final ModelRenderer rump;
private final ModelRenderer tail;
private final ModelRenderer tailEnd;
private final ModelRenderer bridge;
private final ModelRenderer eyeRight;
private final ModelRenderer eyeLeft;
private final ModelRenderer wingLeft;
private final ModelRenderer wingRight;
private final ModelRenderer crownQueen;
private final ModelRenderer crownPrincess;
EnumBeeType type = EnumBeeType.DRONE;
@@ -18,7 +18,7 @@ import forestry.apiculture.entities.EntityBee;
public class RenderBee extends RenderLiving {
ModelBee beeModel;
private final ModelBee beeModel;
public RenderBee() {
super(new ModelBee(), 0.15f);
@@ -42,7 +42,7 @@ public class TextureBiomefinder extends TextureAtlasSprite {
if (minecraft.theWorld != null && minecraft.thePlayer != null)
updateCompass(minecraft.theWorld, minecraft.thePlayer.posX, minecraft.thePlayer.posZ, minecraft.thePlayer.rotationYaw, false, true);
else
updateCompass((World)null, 0.0d, 0.0d, 0.0d, true, true);
updateCompass(null, 0.0d, 0.0d, 0.0d, true, true);
}
public void updateCompass(World world, double playerX, double playerZ, double playerYaw, boolean par8, boolean hasSpin) {
@@ -45,7 +45,7 @@ import forestry.plugins.PluginApiculture;
public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
protected ItemStack[] buildingBlocks = new ItemStack[]{ForestryBlock.planks1.getItemStack(1, 15), new ItemStack(Blocks.log, 1, 0),};
protected final ItemStack[] buildingBlocks = new ItemStack[]{ForestryBlock.planks1.getItemStack(1, 15), new ItemStack(Blocks.log, 1, 0),};
protected int averageGroundLevel = -1;
protected boolean isInDesert = false;
protected boolean hasChest = false;
@@ -45,7 +45,7 @@ import forestry.plugins.PluginArboriculture;
public class CommandTreekeepingMode extends CommandMC {
String[] modeStrings;
private final String[] modeStrings;
public CommandTreekeepingMode() {
modeStrings = new String[PluginArboriculture.treeInterface.getTreekeepingModes().size()];
@@ -209,7 +209,6 @@ public class CommandTreekeepingMode extends CommandMC {
help += mode.getName();
}
sendChatMessage(sender, "Available modes: " + help);
return;
}
private void listModeInfo(ICommandSender sender, String[] arguments) {
@@ -10,17 +10,14 @@
******************************************************************************/
package forestry.arboriculture;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.event.entity.player.BonemealEvent;
import forestry.api.genetics.IFruitBearer;
import forestry.arboriculture.gadgets.TileFruitPod;
import forestry.arboriculture.gadgets.TileSapling;
import forestry.core.proxy.Proxies;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.event.entity.player.BonemealEvent;
public class EventHandlerArboriculture {
@@ -35,17 +32,17 @@ public class EventHandlerArboriculture {
int result = ((TileSapling) tile).tryGrow(true);
if (result == 1 || result == 2)
event.setResult(Result.ALLOW);
} else if(tile instanceof TileFruitPod) {
if(((TileFruitPod)tile).canMature()) {
((TileFruitPod)tile).mature();
event.setResult(Result.ALLOW);
}
} else if (tile instanceof IFruitBearer) {
IFruitBearer bearer = (IFruitBearer) tile;
if (bearer.getRipeness() <= 1.0f) {
bearer.addRipeness(1.0f);
event.setResult(Result.ALLOW);
}
} else if(tile instanceof TileFruitPod) {
if(((TileFruitPod)tile).canMature()) {
((TileFruitPod)tile).mature();
event.setResult(Result.ALLOW);
}
}
}
@@ -10,17 +10,17 @@
******************************************************************************/
package forestry.arboriculture;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import forestry.api.arboriculture.ITreeGenome;
import forestry.api.genetics.IFruitFamily;
import forestry.plugins.PluginArboriculture;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import forestry.api.arboriculture.ITreeGenome;
import forestry.api.genetics.IFruitFamily;
import forestry.plugins.PluginArboriculture;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* Simple fruit provider which drops from any leaf block according to yield and either marks all leave blocks as fruit leaves or none.
@@ -55,12 +55,13 @@ public class FruitProviderRandom extends FruitProviderNone {
if (world.rand.nextFloat() <= genome.getYield() * modeYieldMod * entry.getValue())
product.add(entry.getKey().copy());
return product.toArray(new ItemStack[0]);
return product.toArray(new ItemStack[product.size()]);
}
@Override
public ItemStack[] getProducts() {
return products.keySet().toArray(new ItemStack[0]);
Set<ItemStack> products = this.products.keySet();
return products.toArray(new ItemStack[products.size()]);
}
@Override
@@ -10,17 +10,17 @@
******************************************************************************/
package forestry.arboriculture;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import forestry.api.arboriculture.ITreeGenome;
import forestry.api.genetics.IFruitFamily;
import forestry.plugins.PluginArboriculture;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import forestry.api.arboriculture.ITreeGenome;
import forestry.api.genetics.IFruitFamily;
import forestry.plugins.PluginArboriculture;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class FruitProviderRipening extends FruitProviderNone {
@@ -73,12 +73,13 @@ public class FruitProviderRipening extends FruitProviderNone {
if (world.rand.nextFloat() <= genome.getYield() * entry.getValue() * modeYieldMod * 5.0f * stage)
product.add(entry.getKey().copy());
return product.toArray(new ItemStack[0]);
return product.toArray(new ItemStack[product.size()]);
}
@Override
public ItemStack[] getProducts() {
return products.keySet().toArray(new ItemStack[0]);
Set<ItemStack> products = this.products.keySet();
return products.toArray(new ItemStack[products.size()]);
}
@Override
@@ -43,7 +43,7 @@ public class PacketHandlerArboriculture implements IPacketHandler {
private void onLeafUpdate(PacketLeafUpdate packet) {
TileEntity tile = ((ILocatedPacket) packet).getTarget(Proxies.common.getRenderWorld());
TileEntity tile = packet.getTarget(Proxies.common.getRenderWorld());
if (tile instanceof TileLeaves)
((TileLeaves) tile).fromPacket(packet);
@@ -1,37 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.arboriculture;
import java.util.ArrayList;
import net.minecraft.world.gen.feature.WorldGenerator;
import forestry.api.arboriculture.ITree;
import forestry.api.genetics.IIndividual;
import forestry.api.world.IWorldGenInterface;
import forestry.plugins.PluginArboriculture;
public class WorldGenHelper implements IWorldGenInterface {
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public Class<? extends WorldGenerator>[] getTreeGenerators(String ident) {
ArrayList<Class<? extends WorldGenerator>> generators = new ArrayList<Class<? extends WorldGenerator>>();
for (IIndividual tree : PluginArboriculture.treeInterface.getIndividualTemplates())
if (tree.getIdent().equals(ident))
for (Class<? extends WorldGenerator> generator : ((ITree)tree).getGenome().getPrimary().getGeneratorClasses())
generators.add(generator);
return generators.toArray(new Class[0]);
}
}
@@ -10,8 +10,12 @@
******************************************************************************/
package forestry.arboriculture.gadgets;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodType;
import forestry.plugins.PluginArboriculture;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.material.Material;
@@ -22,16 +26,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodType;
import forestry.plugins.PluginArboriculture;
import java.util.List;
public class BlockArbFence extends BlockFence implements IWoodTyped {
@@ -72,7 +69,7 @@ public class BlockArbFence extends BlockFence implements IWoodTyped {
public boolean canConnectFenceTo(IBlockAccess world, int x, int y, int z) {
if (!isFence(world, x, y, z)) {
Block block = world.getBlock(x, y, z);
return block != null && block.getMaterial().isOpaque() && block.renderAsNormalBlock() ? block.getMaterial() != Material.gourd : false;
return block != null && block.getMaterial().isOpaque() && block.renderAsNormalBlock() && block.getMaterial() != Material.gourd;
} else
return true;
}
@@ -19,7 +19,7 @@ import net.minecraftforge.common.util.ForgeDirection;
public class BlockFireproofLog extends BlockLog implements IWoodFireproof {
public static Material fireproofWood = new Material(MapColor.woodColor);
private static final Material fireproofWood = new Material(MapColor.woodColor);
public BlockFireproofLog(LogCat cat) {
super(cat, fireproofWood);
@@ -19,7 +19,7 @@ import net.minecraftforge.common.util.ForgeDirection;
public class BlockFireproofPlanks extends BlockPlanks implements IWoodFireproof {
public static Material fireproofWood = new Material(MapColor.woodColor);
private static final Material fireproofWood = new Material(MapColor.woodColor);
public BlockFireproofPlanks(PlankCat cat) {
super(cat, fireproofWood);
@@ -10,10 +10,20 @@
******************************************************************************/
package forestry.arboriculture.gadgets;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.arboriculture.EnumGermlingType;
import forestry.api.arboriculture.IToolGrafter;
import forestry.api.arboriculture.ITree;
import forestry.api.core.IToolScoop;
import forestry.api.core.Tabs;
import forestry.api.lepidopterology.EnumFlutterType;
import forestry.api.lepidopterology.IButterfly;
import forestry.core.proxy.Proxies;
import forestry.core.render.TextureManager;
import forestry.core.utils.StackUtils;
import forestry.plugins.PluginArboriculture;
import forestry.plugins.PluginLepidopterology;
import net.minecraft.block.BlockNewLeaf;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -28,24 +38,12 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
import forestry.api.arboriculture.EnumGermlingType;
import forestry.api.arboriculture.IToolGrafter;
import forestry.api.arboriculture.ITree;
import forestry.api.core.IToolScoop;
import forestry.api.core.Tabs;
import forestry.api.lepidopterology.EnumFlutterType;
import forestry.api.lepidopterology.IButterfly;
import forestry.core.proxy.Proxies;
import forestry.core.render.TextureManager;
import forestry.core.utils.StackUtils;
import forestry.plugins.PluginArboriculture;
import forestry.plugins.PluginLepidopterology;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class ForestryBlockLeaves extends BlockNewLeaf implements ITileEntityProvider {
@@ -149,8 +147,7 @@ public class ForestryBlockLeaves extends BlockNewLeaf implements ITileEntityProv
// Add fruits
if (tile.hasFruit())
for (ItemStack stack : tile.getTree().produceStacks(world, x, y, z, tile.getRipeningTime()))
prod.add(stack);
Collections.addAll(prod, tile.getTree().produceStacks(world, x, y, z, tile.getRipeningTime()));
return prod;
}
@@ -10,14 +10,7 @@
******************************************************************************/
package forestry.arboriculture.gadgets;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import com.mojang.authlib.GameProfile;
import forestry.api.arboriculture.ITree;
import forestry.arboriculture.genetics.Tree;
import forestry.core.interfaces.IOwnable;
@@ -27,6 +20,12 @@ import forestry.core.network.PacketIds;
import forestry.core.network.PacketTileNBT;
import forestry.core.proxy.Proxies;
import forestry.core.utils.EnumAccess;
import forestry.core.utils.PlayerUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
/**
* This is the base TE class for any block that needs to contain tree genome information.
@@ -156,10 +155,7 @@ public abstract class TileTreeContainer extends TileEntity implements INetworked
@Override
public boolean isOwner(EntityPlayer player) {
if (owner != null)
return owner.equals(player.getGameProfile());
else
return false;
return PlayerUtil.isSameGameProfile(owner, player.getGameProfile());
}
@Override
@@ -16,7 +16,7 @@ import forestry.core.genetics.Allele;
public class AlleleFruit extends Allele implements IAlleleFruit {
private IFruitProvider provider;
private final IFruitProvider provider;
public AlleleFruit(String uid, IFruitProvider provider) {
this(uid, provider, false);
@@ -16,7 +16,7 @@ import forestry.core.genetics.Allele;
public class AlleleGrowth extends Allele implements IAlleleGrowth {
IGrowthProvider provider;
private final IGrowthProvider provider;
public AlleleGrowth(String uid, IGrowthProvider provider) {
this(uid, provider, false);
@@ -21,7 +21,7 @@ import forestry.core.utils.Vect;
public class AlleleLeafEffectNone extends Allele implements IAlleleLeafEffect {
int[] DEFAULT_EFFECT_AREA = new int[] { 12, 12, 12 };
private static final int[] DEFAULT_EFFECT_AREA = new int[] { 12, 12, 12 };
public AlleleLeafEffectNone(String uid) {
super(uid, true);
@@ -60,7 +60,7 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci
}
}
private static HashMap<String, LeafType> leafTypes = new HashMap<String, LeafType>();
private static final HashMap<String, LeafType> leafTypes = new HashMap<String, LeafType>();
static {
leafTypes.put("deciduous", new LeafType("deciduous", (short) 10, (short) 11, (short) 12));
leafTypes.put("conifers", new LeafType("conifers", (short) 15, (short) 16, (short) 17));
@@ -175,7 +175,7 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci
@SuppressWarnings("rawtypes")
public WorldGenerator getGenerator(ITree tree, World world, int x, int y, int z) {
try {
return generatorClass.getConstructor(new Class[] { ITreeGenData.class }).newInstance(new Object[] { tree });
return generatorClass.getConstructor(new Class[] { ITreeGenData.class }).newInstance(tree);
} catch (Exception ex) {
throw new RuntimeException("Failed to instantiate generator of class " + generatorClass.getName());
}
@@ -226,7 +226,7 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci
}
@SideOnly(Side.CLIENT)
IIcon icon;
private IIcon icon;
@Override
@SideOnly(Side.CLIENT)
@@ -311,7 +311,7 @@ public class Tree extends Individual implements ITree, ITreeGenData, IPlantable
else
prod.add(createOffspring(world, x, y, z));
return prod.toArray(new ITree[0]);
return prod.toArray(new ITree[prod.size()]);
}
private ITree createOffspring(World world, int x, int y, int z) {
@@ -60,16 +60,20 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
public static final String UID = "rootTrees";
public static int treeSpeciesCount = -1;
public static ITreekeepingMode activeTreekeepingMode;
public static final ArrayList<ITree> treeTemplates = new ArrayList<ITree>();
private final ArrayList<ITreekeepingMode> treekeepingModes = new ArrayList<ITreekeepingMode>();
public TreeHelper() {
setResearchSuitability(new ItemStack(Blocks.sapling, 1, Defaults.WILDCARD), 1.0f);
}
@Override
public String getUID() {
return UID;
}
public TreeHelper() {
setResearchSuitability(new ItemStack(Blocks.sapling, 1, Defaults.WILDCARD), 1.0f);
}
@Override
public Class<? extends IIndividual> getMemberClass() {
return ITree.class;
@@ -290,8 +294,6 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
}
/* BREEDING MODES */
ArrayList<ITreekeepingMode> treekeepingModes = new ArrayList<ITreekeepingMode>();
public static ITreekeepingMode activeTreekeepingMode;
@Override
public ArrayList<ITreekeepingMode> getTreekeepingModes() {
@@ -337,7 +339,6 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
}
/* TEMPLATES */
public static ArrayList<ITree> treeTemplates = new ArrayList<ITree>();
@Override
public ArrayList<ITree> getIndividualTemplates() {
@@ -356,7 +357,7 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
}
/* MUTATIONS */
private static ArrayList<ITreeMutation> treeMutations = new ArrayList<ITreeMutation>();
private static final ArrayList<ITreeMutation> treeMutations = new ArrayList<ITreeMutation>();
@Override
public ArrayList<ITreeMutation> getMutations(boolean shuffle) {
@@ -24,7 +24,7 @@ import forestry.plugins.PluginArboriculture;
public class TreeMutation extends Mutation implements ITreeMutation {
private ITreeRoot root;
private final ITreeRoot root;
public TreeMutation(IAllele allele0, IAllele allele1, IAllele[] template, int chance) {
super(allele0, allele1, template, chance);
@@ -12,28 +12,25 @@ package forestry.arboriculture.genetics;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Random;
import forestry.api.arboriculture.ITreeGenome;
import forestry.api.arboriculture.ITreekeepingMode;
public class TreekeepingMode implements ITreekeepingMode {
public static ITreekeepingMode easy = new TreekeepingMode("EASY", 1.4f, 1.3f, 1.2f, 1.2f);
public static ITreekeepingMode normal = new TreekeepingMode("NORMAL", 1f, 1f, 1f, 1f);
public static ITreekeepingMode hard = new TreekeepingMode("HARD", 0.9f, 0.9f, 0.9f, 0.9f);
public static ITreekeepingMode hardcore = new TreekeepingMode("HARDCORE", 0.7f, 0.7f, 0.5f, 0.5f);
public static ITreekeepingMode insane = new TreekeepingMode("INSANE", 0.5f, 0.5f, 0.2f, 0.1f);
public static final ITreekeepingMode easy = new TreekeepingMode("EASY", 1.4f, 1.3f, 1.2f, 1.2f);
public static final ITreekeepingMode normal = new TreekeepingMode("NORMAL", 1f, 1f, 1f, 1f);
public static final ITreekeepingMode hard = new TreekeepingMode("HARD", 0.9f, 0.9f, 0.9f, 0.9f);
public static final ITreekeepingMode hardcore = new TreekeepingMode("HARDCORE", 0.7f, 0.7f, 0.5f, 0.5f);
public static final ITreekeepingMode insane = new TreekeepingMode("INSANE", 0.5f, 0.5f, 0.2f, 0.1f);
final Random rand;
final String name;
private float yieldModifier;
private float sappinessModifier;
private float maturationModifier;
private float mutationModifier;
private final String name;
private final float yieldModifier;
private final float sappinessModifier;
private final float maturationModifier;
private final float mutationModifier;
public TreekeepingMode(String name, float yieldModifier, float sappinessModifier, float maturationModifier, float mutationModifier) {
this.rand = new Random();
this.name = name;
this.yieldModifier = yieldModifier;
this.sappinessModifier = sappinessModifier;
@@ -17,7 +17,6 @@ import forestry.api.arboriculture.IAlleleGrowth;
import forestry.api.arboriculture.ITree;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleEffect;
import forestry.api.genetics.IAlleleFloat;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IFruitFamily;
@@ -36,12 +35,12 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.common.EnumPlantType;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
public class GuiTreealyzer extends GuiAlyzer {
private ItemStack[] tempProductList;
public GuiTreealyzer(EntityPlayer player, TreealyzerInventory inventory) {
super(AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees"), player,
new ContainerTreealyzer(player.inventory, inventory), inventory, 1, inventory.getSizeInventory());
@@ -187,7 +186,7 @@ public class GuiTreealyzer extends GuiAlyzer {
newLine();
drawRow(StringUtil.localize("gui.effect"), tree.getGenome().getEffect().getName(),
((IAlleleEffect) tree.getGenome().getInactiveAllele(EnumTreeChromosome.EFFECT.ordinal())).getName(), tree,
tree.getGenome().getInactiveAllele(EnumTreeChromosome.EFFECT.ordinal()).getName(), tree,
EnumTreeChromosome.EFFECT);
newLine();
@@ -226,37 +225,39 @@ public class GuiTreealyzer extends GuiAlyzer {
drawLine(StringUtil.localize("gui.tolerated"), COLUMN_0);
EnumPlantType[] tolerated0 = tree.getGenome().getPlantTypes().toArray(new EnumPlantType[0]);
EnumPlantType[] tolerated1 = new EnumPlantType[0];
IAllele allele1 = tree.getGenome().getInactiveAllele(EnumTreeChromosome.PLANT.ordinal());
if (allele1 instanceof AllelePlantType)
tolerated1 = ((AllelePlantType) allele1).getPlantTypes().toArray(new EnumPlantType[0]);
List<EnumPlantType> tolerated0 = new ArrayList<EnumPlantType>(tree.getGenome().getPlantTypes());
List<EnumPlantType> tolerated1 = Collections.emptyList();
int max = tolerated0.length > tolerated1.length ? tolerated0.length : tolerated1.length;
IAllele allele1 = tree.getGenome().getInactiveAllele(EnumTreeChromosome.PLANT.ordinal());
if (allele1 instanceof AllelePlantType) {
tolerated1 = new ArrayList<EnumPlantType>(((AllelePlantType) allele1).getPlantTypes());
}
int max = Math.max(tolerated0.size(), tolerated1.size());
for (int i = 0; i < max; i++) {
if (i > 0)
newLine();
if(tolerated0.length > i)
drawLine(StringUtil.localize("gui." + tolerated0[i].toString().toLowerCase(Locale.ENGLISH)), COLUMN_1, tree, EnumTreeChromosome.PLANT, false);
if(tolerated1.length > i)
drawLine(StringUtil.localize("gui." + tolerated1[i].toString().toLowerCase(Locale.ENGLISH)), COLUMN_2, tree, EnumTreeChromosome.PLANT, true);
if(tolerated0.size() > i)
drawLine(StringUtil.localize("gui." + tolerated0.get(i).toString().toLowerCase(Locale.ENGLISH)), COLUMN_1, tree, EnumTreeChromosome.PLANT, false);
if(tolerated1.size() > i)
drawLine(StringUtil.localize("gui." + tolerated1.get(i).toString().toLowerCase(Locale.ENGLISH)), COLUMN_2, tree, EnumTreeChromosome.PLANT, true);
}
newLine();
// FRUITS
drawLine(StringUtil.localize("gui.supports"), COLUMN_0);
IFruitFamily[] families0 = tree.getGenome().getPrimary().getSuitableFruit().toArray(new IFruitFamily[0]);
IFruitFamily[] families1 = tree.getGenome().getPrimary().getSuitableFruit().toArray(new IFruitFamily[0]);
List<IFruitFamily> families0 = new ArrayList<IFruitFamily>(tree.getGenome().getPrimary().getSuitableFruit());
List<IFruitFamily> families1 = new ArrayList<IFruitFamily>(tree.getGenome().getSecondary().getSuitableFruit());
max = families0.length > families1.length ? families0.length : families1.length;
max = Math.max(families0.size(), families1.size());
for (int i = 0; i < max; i++) {
if (i > 0)
newLine();
if (families0.length > i)
drawLine(families0[i].getName(), COLUMN_1, speciesDominance0);
if (families1.length > i)
drawLine(families1[i].getName(), COLUMN_2, speciesDominance1);
if (families0.size() > i)
drawLine(families0.get(i).getName(), COLUMN_1, speciesDominance0);
if (families1.size() > i)
drawLine(families1.get(i).getName(), COLUMN_2, speciesDominance1);
}
@@ -295,15 +296,13 @@ public class GuiTreealyzer extends GuiAlyzer {
private void drawAnalyticsPage3(ITree tree) {
tempProductList = tree.getProduceList();
startPage(COLUMN_0, COLUMN_1, COLUMN_2);
drawLine(StringUtil.localize("gui.beealyzer.produce") + ":", COLUMN_0);
newLine();
int x = COLUMN_0;
for (ItemStack stack : tempProductList) {
for (ItemStack stack : tree.getProduceList()) {
itemRender.renderItemIntoGUI(fontRendererObj, mc.renderEngine, stack, (int) ((guiLeft + x) * (1 / factor)),
(int) ((guiTop + getLineY()) * (1 / factor)));
x += 18;
@@ -52,10 +52,8 @@ public class LeavesRenderingHandler extends OverlayRenderingHandler implements I
// Render overlay for fruit leaves.
IIcon fruitIcon = null;
int fruitColor = 0xffffff;
if (tile != null) {
fruitIcon = tile.getFruitTexture();
fruitColor = tile.getFruitColour();
}
fruitIcon = tile.getFruitTexture();
fruitColor = tile.getFruitColour();
if (fruitIcon != null)
renderFruitOverlay(world, block, x, y, z, renderer, fruitIcon, fruitColor);
@@ -20,7 +20,7 @@ import forestry.core.worldgen.BlockType;
public class BlockTypeLeaf extends BlockType {
private GameProfile owner;
private final GameProfile owner;
public BlockTypeLeaf(GameProfile owner) {
super(ForestryBlock.leaves, 0);
@@ -24,11 +24,17 @@ import forestry.core.worldgen.WorldGenBase;
public abstract class WorldGenArboriculture extends WorldGenBase {
private static final BlockType vine = new BlockType(Blocks.vine, 0);
private static final BlockType air = new BlockTypeVoid();
protected final ITreeGenData tree;
protected int startX;
protected int startY;
protected int startZ;
protected BlockType leaf;
protected BlockType wood;
protected boolean spawnPods = false;
protected int minPodHeight = 3;
@@ -74,11 +80,6 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
public abstract BlockType getWood();
BlockType leaf;
BlockType wood;
BlockType vine = new BlockType(Blocks.vine, 0);
BlockType air = new BlockTypeVoid();
public final Vect getStartVector() {
return new Vect(startX, startY, startZ);
}
@@ -26,17 +26,18 @@ import forestry.core.proxy.Proxies;
import forestry.core.utils.Utils;
public class TickHandlerCoreClient {
private static final ConcurrentLinkedQueue<String> messages = new ConcurrentLinkedQueue<String>();
private boolean naggedVersion, naggedVerify;
private boolean hasNaturalistView;
public TickHandlerCoreClient() {
FMLCommonHandler.instance().bus().register(this);
}
private static ConcurrentLinkedQueue<String> messages = new ConcurrentLinkedQueue<String>();
public void queueChatMessage(String message) {
messages.add(message);
}
private boolean naggedVersion, naggedVerify;
private boolean hasNaturalistView;
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event) {
@@ -18,9 +18,9 @@ import forestry.core.utils.StringUtil;
public abstract class Circuit implements ICircuit {
String uid;
int limit = 1;
boolean requiresDiscovery;
private final String uid;
private final boolean requiresDiscovery;
private int limit = 1;
public Circuit(String uid, boolean requiresDiscovery) {
this.uid = uid;
@@ -10,17 +10,16 @@
******************************************************************************/
package forestry.core.circuits;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import forestry.api.circuits.ChipsetManager;
import forestry.api.circuits.ICircuit;
import forestry.api.circuits.ICircuitBoard;
import forestry.api.circuits.ICircuitLayout;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import java.util.ArrayList;
import java.util.List;
public class CircuitBoard implements ICircuitBoard {
@@ -80,7 +79,7 @@ public class CircuitBoard implements ICircuitBoard {
readcircuits.add(ChipsetManager.circuitRegistry.getFromLegacyMap(nbttagcompound1.getInteger("I")));
}
circuits = readcircuits.toArray(new ICircuit[0]);
circuits = readcircuits.toArray(new ICircuit[readcircuits.size()]);
return;
}
@@ -93,7 +92,7 @@ public class CircuitBoard implements ICircuitBoard {
readcircuits.add(ChipsetManager.circuitRegistry.getCircuit(nbttagcompound1.getString("I")));
}
circuits = readcircuits.toArray(new ICircuit[0]);
circuits = readcircuits.toArray(new ICircuit[readcircuits.size()]);
return;
}
@@ -15,7 +15,7 @@ import forestry.core.utils.StringUtil;
public class CircuitLayout implements ICircuitLayout {
String uid;
private final String uid;
public CircuitLayout(String uid) {
this.uid = uid;
@@ -26,9 +26,9 @@ import forestry.core.config.ForestryItem;
public class CircuitRegistry implements ICircuitRegistry {
private LinkedHashMap<String, ICircuitLayout> layoutMap = new LinkedHashMap<String, ICircuitLayout>();
private LinkedHashMap<String, ICircuit> circuitMap = new LinkedHashMap<String, ICircuit>();
private HashMap<Integer, String> legacyMap = new HashMap<Integer, String>();
private final LinkedHashMap<String, ICircuitLayout> layoutMap = new LinkedHashMap<String, ICircuitLayout>();
private final LinkedHashMap<String, ICircuit> circuitMap = new LinkedHashMap<String, ICircuit>();
private final HashMap<Integer, String> legacyMap = new HashMap<Integer, String>();
@Override
public ICircuitLibrary getCircuitLibrary(World world, String playername) {
@@ -35,10 +35,10 @@ public class ContainerSolderingIron extends ContainerItemInventory implements IG
this.inventory = inventory;
// Input
this.addSlot(new SlotCustom(inventory, 0, 152, 12, new Object[] { ItemCircuitBoard.class }));
this.addSlot(new SlotCustom(inventory, 0, 152, 12, ItemCircuitBoard.class));
// Output
this.addSlot(new SlotCustom(inventory, 1, 152, 92, new Object[] { ItemCircuitBoard.class }));
this.addSlot(new SlotCustom(inventory, 1, 152, 92, ItemCircuitBoard.class));
// Ingredients
this.addSlot(new Slot(inventory, 2, 12, 32));
@@ -35,9 +35,9 @@ import forestry.core.utils.ItemInventory;
public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
public static class CircuitRecipe {
ICircuitLayout layout;
ItemStack resource;
ICircuit circuit;
private final ICircuitLayout layout;
private final ItemStack resource;
public final ICircuit circuit;
public CircuitRecipe(ICircuitLayout layout, ItemStack resource, ICircuit circuit) {
this.resource = resource;
@@ -54,7 +54,7 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
}
public static class SolderManager implements ISolderManager {
public static ArrayList<CircuitRecipe> recipes = new ArrayList<CircuitRecipe>();
public static final ArrayList<CircuitRecipe> recipes = new ArrayList<CircuitRecipe>();
@Override
public void addRecipe(ICircuitLayout layout, ItemStack resource, ICircuit circuit) {
@@ -82,12 +82,12 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
// / INVENTORY MANAGMENT
public static class SolderingInventory extends ItemInventory implements IErrorSource {
ICircuitLayout layout;
EnumErrorCode errorState;
private ICircuitLayout layout;
private EnumErrorCode errorState;
short blankSlot = 0;
short finishedSlot = 1;
short ingredientSlot1 = 2;
private final short blankSlot = 0;
private final short finishedSlot = 1;
private final short ingredientSlot1 = 2;
public SolderingInventory() {
super(ItemSolderingIron.class, 6);
@@ -199,7 +199,7 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
}
circuits = getCircuits(type, true);
inventoryStacks[finishedSlot] = ItemCircuitBoard.createCircuitboard(type, layout, circuits.toArray(new ICircuit[0]));
inventoryStacks[finishedSlot] = ItemCircuitBoard.createCircuitboard(type, layout, circuits.toArray(new ICircuit[circuits.size()]));
inventoryStacks[blankSlot] = null;
}
@@ -27,7 +27,7 @@ public abstract class SubCommand implements IForestryCommand {
public enum PermLevel {
EVERYONE(0), ADMIN(2);
int permLevel;
public final int permLevel;
private PermLevel(int permLevel) {
this.permLevel = permLevel;
@@ -32,7 +32,7 @@ public class Config {
public static String gameMode;
public static HashSet<String> disabledStructures = new HashSet<String>();
public static final HashSet<String> disabledStructures = new HashSet<String>();
public static boolean isDebug = false;
@@ -80,7 +80,7 @@ public class Config {
}
public static boolean craftingStampsEnabled = true;
public static ArrayList<String> collectorStamps = new ArrayList<String>();
public static final ArrayList<String> collectorStamps = new ArrayList<String>();
public static boolean applePickup = true;
public static boolean squareFarms = false;
@@ -90,7 +90,7 @@ public class Config {
// Hints
public static boolean disableHints = false;
public static HashMap<String, String[]> hints = new HashMap<String, String[]>();
public static final HashMap<String, String[]> hints = new HashMap<String, String[]>();
public static boolean disableEnergyStat = false;
public static void load() {
@@ -10,6 +10,9 @@
******************************************************************************/
package forestry.core.config;
import forestry.core.proxy.Proxies;
import net.minecraftforge.common.config.Configuration.UnicodeInputStreamReader;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
@@ -22,15 +25,11 @@ import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
import net.minecraftforge.common.config.Configuration.UnicodeInputStreamReader;
import forestry.core.proxy.Proxies;
public class Configuration {
private String newLine;
private ArrayList<String> purge = new ArrayList<String>();
private TreeMap<String, ArrayList<Property>> categorized = new TreeMap<String, ArrayList<Property>>();
private final String newLine;
private final ArrayList<String> purge = new ArrayList<String>();
private final TreeMap<String, ArrayList<Property>> categorized = new TreeMap<String, ArrayList<Property>>();
public Configuration() {
newLine = System.getProperty("line.separator");
@@ -47,7 +46,7 @@ public class Configuration {
return existing;
// Create new property since none exists yet.
Property property = new Property(key, new Boolean(defaultVal).toString());
Property property = new Property(key, Boolean.toString(defaultVal));
categorized.get(category).add(property);
return property;
}
@@ -59,7 +58,7 @@ public class Configuration {
return existing;
// Create new property since none exists yet.
Property property = new Property(key, new Integer(defaultVal).toString());
Property property = new Property(key, Integer.toString(defaultVal));
categorized.get(category).add(property);
return property;
}
@@ -71,7 +70,7 @@ public class Configuration {
return existing;
// Create new property since none exists yet.
Property property = new Property(key, new Float(defaultVal).toString());
Property property = new Property(key, Float.toString(defaultVal));
categorized.get(category).add(property);
return property;
}
@@ -91,12 +90,12 @@ public class Configuration {
public void set(String key, String category, boolean val) {
Property existing = getExisting(key, category);
if (existing != null) {
existing.Value = new Boolean(val).toString();
existing.Value = Boolean.toString(val);
return;
}
// Create new property since none exists yet.
Property property = new Property(key, new Boolean(val).toString());
Property property = new Property(key, Boolean.toString(val));
categorized.get(category).add(property);
}
@@ -117,12 +116,12 @@ public class Configuration {
public void set(String key, String category, int val) {
Property existing = getExisting(key, category);
if (existing != null) {
existing.Value = new Integer(val).toString();
existing.Value = Integer.toString(val);
return;
}
// Create new property since none exists yet.
Property property = new Property(key, new Integer(val).toString());
Property property = new Property(key, Integer.toString(val));
categorized.get(category).add(property);
}
@@ -130,12 +129,12 @@ public class Configuration {
public void set(String key, String category, float val) {
Property existing = getExisting(key, category);
if (existing != null) {
existing.Value = new Float(val).toString();
existing.Value = Float.toString(val);
return;
}
// Create new property since none exists yet.
Property property = new Property(key, new Float(val).toString());
Property property = new Property(key, Float.toString(val));
categorized.get(category).add(property);
}
@@ -216,7 +216,6 @@ public enum ForestryItem {
cratedMulch,
cratedSilver,
cratedBrass,
cratedNikolite,
cratedCookies,
cratedHoneycombs,
cratedBeeswax,
@@ -14,7 +14,7 @@ import java.util.HashMap;
public class SessionVars {
private static HashMap<String, String> stringVars = new HashMap<String, String>();
private static final HashMap<String, String> stringVars = new HashMap<String, String>();
private static Class<?> openedLedger;
@@ -89,19 +89,19 @@ public class Version {
public static String retrieveRemoteString(String location, String defaultValue) {
try {
HttpURLConnection conn = null;
while (location != null && !location.isEmpty()) {
HttpURLConnection conn;
do {
URL url = new URL(location);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("User-Agent",
"Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)");
conn.connect();
location = conn.getHeaderField("Location");
}
} while (location != null && !location.isEmpty());
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = null;
String line;
if ((line = reader.readLine()) != null)
return line;
@@ -174,17 +174,16 @@ public class Version {
public static String[] grabChangelog(String version) {
try {
String location = REMOTE_CHANGELOG_ROOT + version;
HttpURLConnection conn = null;
while (location != null && !location.isEmpty()) {
do {
URL url = new URL(location);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("User-Agent",
"Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)");
conn.connect();
location = conn.getHeaderField("Location");
}
} while (location != null && !location.isEmpty());
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
@@ -199,7 +198,7 @@ public class Version {
changelog.add(line);
}
return changelog.toArray(new String[0]);
return changelog.toArray(new String[changelog.size()]);
} catch (Exception ex) {
// ex.printStackTrace();
@@ -167,7 +167,7 @@ public class TankManager extends ForwardingList<StandardTank> implements IFluidH
fluidAmount = fluidStack.amount;
}
player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidId);
player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA, fluidId);
PacketGuiInteger packet = new PacketGuiInteger(container.windowId, tankIndex * NETWORK_DATA + 1, fluidAmount);
Proxies.net.sendToPlayer(packet, (EntityPlayerMP)player);
}
@@ -192,12 +192,12 @@ public class TankManager extends ForwardingList<StandardTank> implements IFluidH
fluidId = fluidStack.fluidID;
fluidAmount = fluidStack.amount;
}
player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidId);
player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA, fluidId);
PacketGuiInteger packet = new PacketGuiInteger(container.windowId, tankIndex * NETWORK_DATA + 1, fluidAmount);
Proxies.net.sendToPlayer(packet, player);
} else if (fluidStack != null && prev != null) {
if (fluidStack.getFluid() != prev.getFluid())
player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidStack.fluidID);
player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA, fluidStack.fluidID);
if (fluidStack.amount != prev.amount) {
PacketGuiInteger packet = new PacketGuiInteger(container.windowId, tankIndex * NETWORK_DATA + 1, fluidStack.amount);
Proxies.net.sendToPlayer(packet, player);
@@ -78,8 +78,7 @@ public class FilteredTank extends StandardTank {
if (rarity == null)
rarity = EnumRarity.common;
FluidStack filterFluidStack = FluidRegistry.getFluidStack(filter.getName(), 0);
ToolTipLine name = new ToolTipLine(filter.getLocalizedName(filterFluidStack), rarity.rarityColor);
name.setSpacing(2);
ToolTipLine name = new ToolTipLine(filter.getLocalizedName(filterFluidStack), rarity.rarityColor, 2);
toolTip.add(name);
if (getFluid() != null)
amount = getFluid().amount;
@@ -154,8 +154,7 @@ public class StandardTank extends FluidTank {
EnumRarity rarity = fluidType.getRarity();
if (rarity == null)
rarity = EnumRarity.common;
ToolTipLine fluidName = new ToolTipLine(fluidType.getLocalizedName(getFluid()), rarity.rarityColor);
fluidName.setSpacing(2);
ToolTipLine fluidName = new ToolTipLine(fluidType.getLocalizedName(getFluid()), rarity.rarityColor, 2);
toolTip.add(fluidName);
amount = getFluid().amount;
}
@@ -28,13 +28,9 @@ import forestry.core.utils.Utils;
public abstract class BlockForestry extends BlockContainer {
protected static boolean keepInventory = false;
protected Random furnaceRand;
public BlockForestry(Material material) {
super(material);
setHardness(1.5f);
furnaceRand = new Random();
setCreativeTab(CreativeTabForestry.tabForestry);
}
@@ -42,14 +42,11 @@ import forestry.core.render.TextureManager;
/**
* Humus, bog earth, peat
*
* @author
*
*/
public class BlockSoil extends Block implements IItemTyped {
public enum SoilType {
HUMUS, BOG_EARTH, PEAT;
HUMUS, BOG_EARTH, PEAT
}
private static final int degradeDelimiter = 3;
@@ -164,7 +161,7 @@ public class BlockSoil extends Block implements IItemTyped {
// Repackage in format TTGG
meta = (grade << 2 | type);
if (grade >= this.degradeDelimiter)
if (grade >= degradeDelimiter)
world.setBlock(i, j, k, Blocks.sand, 0, Defaults.FLAG_BLOCK_SYNCH);
else
world.setBlockMetadataWithNotify(i, j, k, meta, Defaults.FLAG_BLOCK_SYNCH);
@@ -73,7 +73,7 @@ public class BlockStainedGlass extends BlockBreakable {
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int meta) {
Block block = world.getBlock(x, y, z);
return block == this ? false : super.shouldSideBeRendered(world, x, y, z, meta);
return block != this && super.shouldSideBeRendered(world, x, y, z, meta);
}
@Override
@@ -10,10 +10,12 @@
******************************************************************************/
package forestry.core.gadgets;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.core.interfaces.IBlockRenderer;
import forestry.core.proxy.Proxies;
import forestry.core.render.TextureManager;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -26,16 +28,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
import forestry.core.interfaces.IBlockRenderer;
import forestry.core.proxy.Proxies;
import forestry.core.render.TextureManager;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/**
* This will replace the whole {@link Gadget}-nonsense at some point, using the proper Forge hook. Will hopefully sort out any issues with interfaces.
@@ -148,11 +145,9 @@ public class MachineDefinition {
public MachineDefinition setFaces(int... faces) {
if (faces.length > 6)
for (int i = 0; i < faces.length; i++)
faceMap[i] = faces[i];
System.arraycopy(faces, 0, faceMap, 0, faces.length);
else {
for (int i = 0; i < 6; i++)
faceMap[i] = faces[i];
System.arraycopy(faces, 0, faceMap, 0, 6);
faceMap[6] = faces[0];
faceMap[7] = faces[1];
}
@@ -25,10 +25,10 @@ import forestry.core.utils.Vect;
public abstract class StructureLogic implements IStructureLogic {
protected ITileStructure structure;
protected TileEntity structureTile;
protected final ITileStructure structure;
protected final TileEntity structureTile;
protected String uid;
protected final String uid;
protected Schemata[] schematas;
protected short activeSchemata = -1;
protected boolean isRotated = false;
@@ -62,7 +62,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
private int analyzeTime;
@EntityNetData
public FilteredTank resourceTank;
public final FilteredTank resourceTank;
private final TankManager tankManager;
@@ -10,15 +10,15 @@
******************************************************************************/
package forestry.core.gadgets;
import net.minecraft.entity.player.EntityPlayer;
import forestry.core.interfaces.IHintSource;
import forestry.core.network.ClassMap;
import forestry.core.network.IndexInPayload;
import forestry.core.network.PacketPayload;
import forestry.core.proxy.Proxies;
import forestry.core.utils.Utils;
import forestry.core.utils.EnumAccess;
import forestry.core.utils.PlayerUtil;
import forestry.core.utils.Utils;
import net.minecraft.entity.player.EntityPlayer;
public abstract class TileBase extends TileForestry implements IHintSource {
@@ -94,7 +94,7 @@ public abstract class TileBase extends TileForestry implements IHintSource {
if (!Utils.isUseableByPlayer(player, this, worldObj, xCoord, yCoord, zCoord))
return false;
if (getAccess() == EnumAccess.PRIVATE)
return owner.equals(player.getGameProfile());
return PlayerUtil.isSameGameProfile(owner, player.getGameProfile());
return true;
}
@@ -126,8 +126,7 @@ public abstract class TileMachine extends TileForestry implements ISpecialInvent
super.readFromNBT(nbttagcompound);
int kind = nbttagcompound.getInteger("Kind");
oldkind = kind;
oldkind = nbttagcompound.getInteger("Kind");
olddata = nbttagcompound;
}
@@ -360,10 +359,7 @@ public abstract class TileMachine extends TileForestry implements ISpecialInvent
// INETWORKEDTILE IMPLEMENTATION
@Override
public PacketPayload getPacketPayload() {
PacketPayload payload = null;
return payload;
return null;
}
@Override
@@ -29,7 +29,7 @@ import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
@Optional.Interface(iface = "buildcraft.api.tiles.IHasWork", modid = "BuildCraftAPI|tiles")
public abstract class TilePowered extends TileBase implements IRenderableMachine, IPowerHandler, IHasWork {
public static int WORK_CYCLES = 4;
public static final int WORK_CYCLES = 4;
@Override
public PacketPayload getPacketPayload() {
@@ -23,8 +23,8 @@ import forestry.core.utils.StringUtil;
public class Allele implements IAllele {
protected String uid;
boolean isDominant;
protected final String uid;
protected final boolean isDominant;
protected String name;
public Allele(String uid, boolean isDominant) {
@@ -16,7 +16,7 @@ import forestry.core.utils.Vect;
public class AlleleArea extends Allele implements IAlleleArea {
private int[] area;
private final int[] area;
public AlleleArea(String uid, int[] value) {
this(uid, value, false);
@@ -14,8 +14,7 @@ import forestry.api.genetics.IAlleleBoolean;
public class AlleleBoolean extends Allele implements IAlleleBoolean {
boolean value;
boolean isDominant;
final boolean value;
public AlleleBoolean(String uid, boolean value) {
this(uid, value, false);
@@ -15,7 +15,7 @@ import forestry.core.utils.StringUtil;
public class AlleleFloat extends Allele implements IAlleleFloat {
float value;
private final float value;
public AlleleFloat(String uid, float value) {
this(uid, value, false);
@@ -15,7 +15,7 @@ import forestry.core.utils.StringUtil;
public class AlleleInteger extends Allele implements IAlleleInteger {
int value;
private final int value;
public AlleleInteger(String uid, int value) {
this(uid, value, false);
@@ -18,7 +18,7 @@ import forestry.api.genetics.IAllelePlantType;
public class AllelePlantType extends Allele implements IAllelePlantType {
private EnumSet<EnumPlantType> types;
private final EnumSet<EnumPlantType> types;
protected AllelePlantType(String uid, EnumPlantType type) {
this(uid, type, false);
@@ -38,7 +38,7 @@ import forestry.core.genetics.ItemResearchNote.EnumNoteType;
public class AlleleRegistry implements IAlleleRegistry, ILegacyHandler {
public static final int ALLELE_ARRAY_SIZE = 2048;
private static final int ALLELE_ARRAY_SIZE = 2048;
/* SPECIES ROOT */
private final LinkedHashMap<String, ISpeciesRoot> rootMap = new LinkedHashMap<String, ISpeciesRoot>(16);
@@ -10,17 +10,9 @@
******************************************************************************/
package forestry.core.genetics;
import java.util.Collection;
import java.util.Map;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.mojang.authlib.GameProfile;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.core.IIconProvider;
@@ -32,6 +24,11 @@ import forestry.api.genetics.IMutation;
import forestry.core.config.ForestryItem;
import forestry.core.utils.StackUtils;
import forestry.core.utils.StringUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.Collection;
import java.util.Map;
public abstract class AlleleSpecies extends Allele implements IAlleleSpecies {
@@ -95,7 +92,7 @@ public abstract class AlleleSpecies extends Allele implements IAlleleSpecies {
if (world.rand.nextFloat() < ((float) 10 / bountyLevel)) {
Collection<? extends IMutation> combinations = getRoot().getCombinations(this);
if (combinations.size() > 0) {
IMutation[] candidates = combinations.toArray(new IMutation[0]);
IMutation[] candidates = combinations.toArray(new IMutation[combinations.size()]);
research = AlleleManager.alleleRegistry.getMutationNoteStack(researcher, candidates[world.rand.nextInt(candidates.length)]);
}
}
Loaded 100 of 271 files, more files were not shown because too many files have changed in this diff. Show more