Semi-automatic minor cleanup

This commit is contained in:
mezz committed 2014-11-28 18:09:51 -08:00
1 parent 1d2c4e438d
commit cc187d6b8b
48 files changed
+176 -198

No files matched your search

@@ -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()]);
}
}
@@ -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");
@@ -414,12 +414,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 +461,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 +469,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 +513,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;
}
@@ -10,16 +10,16 @@
******************************************************************************/
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 {
@@ -32,8 +32,7 @@ public class HiveDrop implements IHiveDrop {
this.template = template;
this.chance = chance;
for (ItemStack stack : bonus)
this.additional.add(stack);
Collections.addAll(this.additional, bonus);
}
public HiveDrop setIgnobleShare(float share) {
@@ -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()]);
}
}
@@ -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,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
@@ -10,14 +10,14 @@
******************************************************************************/
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;
import net.minecraft.world.gen.feature.WorldGenerator;
import java.util.ArrayList;
import java.util.Collections;
public class WorldGenHelper implements IWorldGenInterface {
@@ -28,10 +28,9 @@ public class WorldGenHelper implements IWorldGenInterface {
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);
Collections.addAll(generators, ((ITree) tree).getGenome().getPrimary().getGeneratorClasses());
return generators.toArray(new Class[0]);
return generators.toArray(new Class[generators.size()]);
}
}
@@ -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;
}
@@ -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;
}
@@ -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) {
@@ -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;
}
@@ -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;
}
@@ -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,10 +25,6 @@ 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;
@@ -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);
}
@@ -199,7 +199,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();
@@ -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
@@ -120,7 +120,6 @@ public abstract class Engine extends TileBase implements IEnergyHandler {
}
} else if (this.isActive)
stagePiston = 1;
return;
}
@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];
}
@@ -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
@@ -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)]);
}
}
@@ -73,7 +73,7 @@ public class Classification implements IClassification {
@Override
public IClassification[] getMemberGroups() {
return groups.toArray(new IClassification[0]);
return groups.toArray(new IClassification[groups.size()]);
}
@Override
@@ -84,7 +84,7 @@ public class Classification implements IClassification {
@Override
public IAlleleSpecies[] getMemberSpecies() {
return members.toArray(new IAlleleSpecies[0]);
return members.toArray(new IAlleleSpecies[members.size()]);
}
@Override
@@ -708,7 +708,7 @@ public abstract class InvTools {
if (stack != null)
list.add(stack);
}
return list.toArray(new ItemStack[0]);
return list.toArray(new ItemStack[list.size()]);
}
/**
@@ -25,5 +25,5 @@ public enum InventorySorter implements Comparator<IInventory> {
return inv2.getSizeInventory() - inv1.getSizeInventory();
}
};
}
}
@@ -24,7 +24,7 @@ public class PacketFXSignal extends ForestryPacket {
public static enum VisualFXType {
NONE, BLOCK_DESTROY, SAPLING_PLACE
};
}
public static enum SoundFXType {
NONE(""), BLOCK_DESTROY(""), BLOCK_PLACE(""), LEAF("step.grass"), LOG("dig.wood"), DIRT("dig.gravel");
@@ -36,7 +36,7 @@ public class PacketFXSignal extends ForestryPacket {
private SoundFXType(String soundFile) {
this.soundFile = soundFile;
}
};
}
private VisualFXType visualFX;
private SoundFXType soundFX;
@@ -43,7 +43,7 @@ public class RenderAnalyzer extends TileEntitySpecialRenderer implements IBlockR
@Override
public boolean shouldSpreadItems() {
return false;
};
}
};
customRenderItem.setRenderManager(RenderManager.instance);
}
@@ -46,7 +46,7 @@ public class RenderEscritoire extends TileEntitySpecialRenderer implements IBloc
@Override
public boolean shouldSpreadItems() {
return false;
};
}
};
customRenderItem.setRenderManager(RenderManager.instance);
@@ -40,7 +40,8 @@ public class RenderMachine extends TileEntitySpecialRenderer implements IBlockRe
BASE,
TANK_R_EMPTY, TANK_R_LOW, TANK_R_MEDIUM, TANK_R_HIGH, TANK_R_MAXIMUM,
TANK_P_EMPTY, TANK_P_LOW, TANK_P_MEDIUM, TANK_P_HIGH, TANK_P_MAXIMUM
};
}
private ResourceLocation[] textures;
public RenderMachine() {
@@ -30,7 +30,8 @@ public class RenderMill extends TileEntitySpecialRenderer implements IBlockRende
private final ModelBase model = new ModelBase() {
};
private static enum Textures { PEDESTAL, EXTENSION, BLADE_1, BLADE_2, CHARGE };
private static enum Textures { PEDESTAL, EXTENSION, BLADE_1, BLADE_2, CHARGE }
private ResourceLocation[] textures;
private final ModelRenderer pedestal;
@@ -100,7 +100,7 @@ public class BlockUtil {
}
}
return possiblePipes.toArray(new ForgeDirection[0]);
return possiblePipes.toArray(new ForgeDirection[possiblePipes.size()]);
}
@@ -77,8 +77,7 @@ public class LiquidHelper {
}
public static Fluid getFluid(String ident) {
Fluid fluid = FluidRegistry.getFluid(ident);
return fluid;
return FluidRegistry.getFluid(ident);
}
public static Fluid getOrCreateLiquid(String ident) {
@@ -10,12 +10,11 @@
******************************************************************************/
package forestry.core.utils;
import net.minecraft.item.ItemStack;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Defaults;
import forestry.core.interfaces.IDescriptiveRecipe;
import forestry.core.proxy.Proxies;
import net.minecraft.item.ItemStack;
public class RecipeUtil {
@@ -62,9 +61,7 @@ public class RecipeUtil {
Object[] result = new Object[10];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
result[y * 3 + x] = ingredients[y * width + x];
}
System.arraycopy(ingredients, y * width, result, y * 3, width);
}
result[9] = output;
@@ -35,7 +35,6 @@ import forestry.core.gadgets.TileForestry;
public class StackUtils {
public static final ItemStack[] EMPTY_STACK_ARRAY = new ItemStack[0];
public static final ArrayList<ItemStack> EMPTY_STACK_LIST = new ArrayList<ItemStack>();
/**
* Compares item id, damage and NBT. Accepts wildcard damage.
@@ -176,7 +175,6 @@ public class StackUtils {
ItemStack temp = giver.splitStack(receptor.getMaxStackSize() - receptor.stackSize);
receptor.stackSize += temp.stackSize;
temp.stackSize = 0;
return;
}
public static boolean freeSpaceInStack(ItemStack stack, int maxSize) {
@@ -244,7 +242,7 @@ public class StackUtils {
}
return condensed.toArray(EMPTY_STACK_ARRAY);
return condensed.toArray(new ItemStack[condensed.size()]);
}
/**
@@ -10,7 +10,7 @@ import net.minecraftforge.common.util.ForgeDirection;
public class EnergyManager implements IEnergyHandler {
private enum EnergyTransferMode {
EXTRACT, RECEIVE, BOTH;
EXTRACT, RECEIVE, BOTH
}
private int energyPerWork;
@@ -39,7 +39,8 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IBlockRen
private static enum Textures {
BASE, PISTON, EXTENSION, TRUNK_HIGHEST, TRUNK_HIGHER, TRUNK_HIGH, TRUNK_MEDIUM, TRUNK_LOW
};
}
private ResourceLocation[] textures;
private static final float[] angleMap = new float[6];
@@ -39,6 +39,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
public class MachineCentrifuge extends TilePowered implements ISidedInventory, ISpecialInventory {
@@ -124,8 +125,10 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory, I
public Map<Object[], Object[]> getRecipes() {
HashMap<Object[], Object[]> recipeList = new HashMap<Object[], Object[]>();
for (Recipe recipe : recipes)
recipeList.put(new Object[] { recipe.resource }, recipe.products.keySet().toArray(StackUtils.EMPTY_STACK_ARRAY));
for (Recipe recipe : recipes) {
Set<ItemStack> productsKeys = recipe.products.keySet();
recipeList.put(new Object[]{recipe.resource}, productsKeys.toArray(new ItemStack[productsKeys.size()]));
}
return recipeList;
}
@@ -36,7 +36,7 @@ import forestry.farming.worldgen.WorldGenBigMushroom;
public class BlockMushroom extends BlockSapling implements IItemTyped {
public enum MushroomType {
BROWN, RED;
BROWN, RED
}
private final WorldGenerator[] generators;
@@ -279,7 +279,7 @@ public class TileFarmPlain extends TileFarm implements IFarmHousing, ISocketable
int size = potential.size() * 3;
if (size > allowedExtent)
allowedExtent = size;
targets.put(direction, potential.toArray(new FarmTarget[0]));
targets.put(direction, potential.toArray(new FarmTarget[potential.size()]));
}
// Fill out the corners
@@ -327,7 +327,7 @@ public class TileFarmPlain extends TileFarm implements IFarmHousing, ISocketable
targ.add(corner);
}
cache.put(entry.getKey(), targ.toArray(new FarmTarget[0]));
cache.put(entry.getKey(), targ.toArray(new FarmTarget[targ.size()]));
}
targets = cache;
@@ -28,6 +28,7 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
public class TileHatch extends TileFarm implements ISidedInventory {
@@ -59,9 +60,7 @@ public class TileHatch extends TileFarm implements ISidedInventory {
ArrayList<ForgeDirection> pipes = new ArrayList<ForgeDirection>();
ForgeDirection[] tmp = BlockUtil.getPipeDirections(worldObj, Coords(), ForgeDirection.UP);
for (int i = 0; i < tmp.length; ++i) {
pipes.add(tmp[i]);
}
Collections.addAll(pipes, tmp);
if (pipes.size() > 0)
dumpToPipe(pipes);
@@ -35,7 +35,8 @@ public class FarmLogicGourd extends FarmLogic {
public FarmLogicGourd(IFarmHousing housing) {
super(housing);
seeds = Farmables.farmables.get("farmGourd").toArray(new IFarmable[0]);
Collection<IFarmable> farmables = Farmables.farmables.get("farmGourd");
seeds = farmables.toArray(new IFarmable[farmables.size()]);
}
@Override
@@ -37,7 +37,8 @@ public class FarmLogicPoale extends FarmLogic {
public FarmLogicPoale(IFarmHousing housing) {
super(housing);
germlings = Farmables.farmables.get("farmPoales").toArray(new IFarmable[0]);
Collection<IFarmable> farmables = Farmables.farmables.get("farmPoales");
germlings = farmables.toArray(new IFarmable[farmables.size()]);
}
@Override
@@ -37,7 +37,8 @@ public class FarmLogicSucculent extends FarmLogic {
public FarmLogicSucculent(IFarmHousing housing) {
super(housing);
germlings = Farmables.farmables.get("farmSucculentes").toArray(new IFarmable[0]);
Collection<IFarmable> farmables = Farmables.farmables.get("farmSucculentes");
germlings = farmables.toArray(new IFarmable[farmables.size()]);
}
@Override
@@ -149,7 +149,7 @@ public class ItemInfuser extends ItemForestry {
matches.add(mixture);
}
return matches.toArray(new Mixture[0]);
return matches.toArray(new Mixture[matches.size()]);
}
@Override
@@ -166,7 +166,7 @@ public class ItemInfuser extends ItemForestry {
required.addAll(Arrays.asList(mixture.getIngredients()));
}
return required.toArray(new ItemStack[0]);
return required.toArray(new ItemStack[required.size()]);
}
@Override
@@ -187,7 +187,7 @@ public class ItemInfuser extends ItemForestry {
ItemStack seasoned = base.copy();
seasoned.setItemDamage(meta);
((ItemBeverage) base.getItem()).beverages[meta].saveEffects(seasoned, effects.toArray(new IBeverageEffect[0]));
((ItemBeverage) base.getItem()).beverages[meta].saveEffects(seasoned, effects.toArray(new IBeverageEffect[effects.size()]));
return seasoned;
}
}
@@ -274,7 +274,7 @@ public class Butterfly extends IndividualLiving implements IButterfly {
if (creature.worldObj.rand.nextFloat() < entry.getValue() * metabolism)
drop.add(entry.getKey().copy());
return drop.toArray(StackUtils.EMPTY_STACK_ARRAY);
return drop.toArray(new ItemStack[drop.size()]);
}
@Override
@@ -286,7 +286,7 @@ public class Butterfly extends IndividualLiving implements IButterfly {
if (nursery.getWorld().rand.nextFloat() < entry.getValue() * metabolism)
drop.add(entry.getKey().copy());
return drop.toArray(StackUtils.EMPTY_STACK_ARRAY);
return drop.toArray(new ItemStack[drop.size()]);
}
}
@@ -481,7 +481,7 @@ public class TradeStation extends WorldSavedData implements ITradeStation, ISide
surplus.add(stack);
}
return surplus.toArray(new ItemStack[0]);
return surplus.toArray(new ItemStack[surplus.size()]);
}
/* IINVENTORY */
@@ -59,7 +59,7 @@ public class PluginManager {
public enum Stage {
SETUP, PRE_INIT, INIT, POST_INIT, INIT_DISABLED, FINISHED;
SETUP, PRE_INIT, INIT, POST_INIT, INIT_DISABLED, FINISHED
}
public enum Module {