Simple Cleanup

This commit is contained in:
mezz committed 2014-12-20 03:59:31 -08:00
1 parent 09df969bcf
commit e2fff11ea8
141 files changed
+545 -859

No files matched your search

@@ -40,10 +40,7 @@ public class FlowerProviderCacti implements IFlowerProvider {
}
private boolean checkFlowerPot(int meta) {
if (meta == 9)
return true;
else
return false;
return meta == 9;
}
@Override
@@ -43,10 +43,7 @@ public class FlowerProviderJungle implements IFlowerProvider {
}
private boolean checkFlowerPot(int meta) {
if (meta == 11)
return true;
else
return false;
return meta == 11;
}
@Override
@@ -42,10 +42,7 @@ public class FlowerProviderMushroom implements IFlowerProvider {
}
private boolean checkFlowerPot(int meta) {
if (meta == 7 || meta == 8)
return true;
else
return false;
return meta == 7 || meta == 8;
}
@Override
@@ -53,10 +53,7 @@ public class FlowerProviderVanilla implements IFlowerProvider {
}
private boolean checkFlowerPot(int meta) {
if (meta == 1 || meta == 2)
return true;
else
return false;
return meta == 1 || meta == 2;
}
@Override
@@ -107,7 +107,7 @@ public class BlockCandle extends BlockTorch {
@SideOnly(Side.CLIENT)
public IIcon getTextureFromPassAndMeta(int meta, int pass) {
IIcon i = this.unlitStump;
IIcon i;
if (pass == 0) {
if (isLit(meta)) {
i = this.litTip;
@@ -221,9 +221,6 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised,
/**
* Returns scaled queen health or breeding progress
*
* @param i
* @return
*/
public int getHealthScaled(int i) {
if (getMaxHealthDisplay() == 0)
@@ -51,7 +51,7 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
private final int primaryColour;
private final int secondaryColour;
private final String iconType = "default";
private static final String iconType = "default";
public AlleleBeeSpecies(String uid, boolean dominant, String name, IClassification branch, int primaryColor, int secondaryColor) {
this(uid, dominant, name, branch, null, primaryColor, secondaryColor);
@@ -22,8 +22,8 @@ import net.minecraft.world.World;
public class AlleleEffectCreeper extends AlleleEffectThrottled {
private final int explosionChance = 50;
private final byte defaultForce = 12;
private static final int explosionChance = 50;
private static final byte defaultForce = 12;
private final byte indexExplosionTimer = 1;
private final byte indexExplosionForce = 2;
@@ -114,7 +114,7 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
}
private void doMushroomGrowth(Block block, World world, int blockX, int blockY, int blockZ) {
WorldGenBigMushroom giantMushroomGenerator = null;
WorldGenBigMushroom giantMushroomGenerator;
if (block == Blocks.brown_mushroom) {
giantMushroomGenerator = new WorldGenBigMushroom(0);
@@ -23,8 +23,8 @@ import net.minecraft.world.World;
public class AlleleEffectIgnition extends AlleleEffectThrottled {
private final int ignitionChance = 50;
private final int fireDuration = 500;
private static final int ignitionChance = 50;
private static final int fireDuration = 500;
public AlleleEffectIgnition(String uid) {
super(uid, "ignition", false, 20, false, true);
@@ -24,7 +24,7 @@ import net.minecraft.world.World;
public class AlleleEffectMiasmic extends AlleleEffectThrottled {
private final int infectionChance = 50;
private static final int infectionChance = 50;
public AlleleEffectMiasmic(String uid) {
super(uid, "misasmic", false, 50, false, false);
@@ -10,8 +10,21 @@
******************************************************************************/
package forestry.apiculture.genetics;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Locale;
import java.util.Map.Entry;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.common.FMLCommonHandler;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IAlleleBeeSpecies;
@@ -35,16 +48,6 @@ import forestry.apiculture.gadgets.StructureLogicAlveary;
import forestry.core.config.ForestryItem;
import forestry.core.genetics.SpeciesRoot;
import forestry.plugins.PluginApiculture;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map.Entry;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class BeeHelper extends SpeciesRoot implements IBeeRoot {
@@ -65,9 +68,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
public int getSpeciesCount() {
if (beeSpeciesCount < 0) {
beeSpeciesCount = 0;
Iterator<Entry<String, IAllele> > it = AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet().iterator();
while (it.hasNext()) {
Entry<String, IAllele> entry = it.next();
for (Entry<String, IAllele> entry : AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) {
if (entry.getValue() instanceof IAlleleBeeSpecies)
if (((IAlleleBeeSpecies) entry.getValue()).isCounted())
beeSpeciesCount++;
@@ -97,7 +98,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
if (!isMember(bee))
return null;
Item beeItem = null;
Item beeItem;
switch (EnumBeeType.VALUES[type]) {
case QUEEN:
beeItem = ForestryItem.beeQueenGE.item();
@@ -113,7 +114,6 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
break;
default:
throw new RuntimeException("Cannot instantiate a bee of type " + type);
}
NBTTagCompound nbttagcompound = new NBTTagCompound();
@@ -141,10 +141,7 @@ public class BeekeepingMode implements IBeekeepingMode {
@Override
public boolean isNaturalOffspring(IBee queen) {
if (!queen.isNatural())
return false;
return true;
return queen.isNatural();
}
@Override
@@ -28,10 +28,7 @@ public class JubilanceProviderHermit extends JubilanceDefault {
@SuppressWarnings("rawtypes")
List list = housing.getWorld().getEntitiesWithinAABB(EntityLiving.class, bounding);
if (list.size() > 0)
return false;
return true;
return list.size() <= 0;
}
}
@@ -16,6 +16,7 @@ import forestry.api.apiculture.IBeeHousing;
import forestry.core.utils.StackUtils;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class JubilanceReqRes implements IJubilanceProvider {
@@ -31,12 +32,11 @@ public class JubilanceReqRes implements IJubilanceProvider {
if (blockRequired == null)
return true;
Block block = housing.getWorld().getBlock(housing.getXCoord(), housing.getYCoord() - 1, housing.getZCoord());
int meta = housing.getWorld().getBlockMetadata(housing.getXCoord(), housing.getYCoord() - 1, housing.getZCoord());
if (StackUtils.equals(block, blockRequired) && meta == blockRequired.getItemDamage())
return true;
else
return false;
World world = housing.getWorld();
Block block = world.getBlock(housing.getXCoord(), housing.getYCoord() - 1, housing.getZCoord());
int meta = world.getBlockMetadata(housing.getXCoord(), housing.getYCoord() - 1, housing.getZCoord());
return StackUtils.equals(block, meta, blockRequired);
}
}
@@ -30,27 +30,27 @@ public class ContainerAlveary extends ContainerForestry {
tile.sendNetworkUpdate();
// Queen/Princess
this.addSlot(new SlotCustom(tile, TileAlvearyPlain.SLOT_QUEEN, 29, 39, ForestryItem.beePrincessGE, ForestryItem.beeQueenGE));
this.addSlotToContainer(new SlotCustom(tile, TileAlvearyPlain.SLOT_QUEEN, 29, 39, ForestryItem.beePrincessGE, ForestryItem.beeQueenGE));
// Drone
this.addSlot(new SlotCustom(tile, TileAlvearyPlain.SLOT_DRONE, 29, 65, ForestryItem.beeDroneGE));
this.addSlotToContainer(new SlotCustom(tile, TileAlvearyPlain.SLOT_DRONE, 29, 65, ForestryItem.beeDroneGE));
// Product Inventory
this.addSlot(new SlotClosed(tile, 2, 116, 52));
this.addSlot(new SlotClosed(tile, 3, 137, 39));
this.addSlot(new SlotClosed(tile, 4, 137, 65));
this.addSlot(new SlotClosed(tile, 5, 116, 78));
this.addSlot(new SlotClosed(tile, 6, 95, 65));
this.addSlot(new SlotClosed(tile, 7, 95, 39));
this.addSlot(new SlotClosed(tile, 8, 116, 26));
this.addSlotToContainer(new SlotClosed(tile, 2, 116, 52));
this.addSlotToContainer(new SlotClosed(tile, 3, 137, 39));
this.addSlotToContainer(new SlotClosed(tile, 4, 137, 65));
this.addSlotToContainer(new SlotClosed(tile, 5, 116, 78));
this.addSlotToContainer(new SlotClosed(tile, 6, 95, 65));
this.addSlotToContainer(new SlotClosed(tile, 7, 95, 39));
this.addSlotToContainer(new SlotClosed(tile, 8, 116, 26));
// Player inventory
for (int i = 0; i < 3; i++)
for (int j = 0; j < 9; j++)
addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 108 + i * 18));
addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 108 + i * 18));
// Player hotbar
for (int i = 0; i < 9; i++)
addSlot(new Slot(player, i, 8 + i * 18, 166));
addSlotToContainer(new Slot(player, i, 8 + i * 18, 166));
}
@Override
@@ -18,20 +18,17 @@ import net.minecraft.inventory.Slot;
public class ContainerAlvearyHygroregulator extends ContainerLiquidTanks {
private final TileAlvearyHygroregulator tile;
public ContainerAlvearyHygroregulator(IInventory inventory, TileAlvearyHygroregulator tile) {
super(inventory, tile);
this.tile = tile;
this.addSlot(new SlotLiquidContainer(tile, 0, 56, 38));
this.addSlotToContainer(new SlotLiquidContainer(tile, 0, 56, 38));
for (int i = 0; i < 3; ++i)
for (int var4 = 0; var4 < 9; ++var4)
this.addSlot(new Slot(inventory, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
this.addSlotToContainer(new Slot(inventory, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
for (int i = 0; i < 9; ++i)
this.addSlot(new Slot(inventory, i, 8 + i * 18, 142));
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142));
}
@@ -10,40 +10,38 @@
******************************************************************************/
package forestry.apiculture.gui;
import forestry.apiculture.gadgets.TileAlvearySieve;
import forestry.core.config.ForestryItem;
import forestry.core.gui.ContainerForestry;
import forestry.core.gui.slots.SlotCustom;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
public class ContainerAlvearySieve extends ContainerForestry {
import forestry.apiculture.gadgets.TileAlvearySieve;
import forestry.core.config.ForestryItem;
import forestry.core.gui.ContainerForestry;
import forestry.core.gui.slots.SlotCustom;
private final TileAlvearySieve tile;
public class ContainerAlvearySieve extends ContainerForestry {
public ContainerAlvearySieve(InventoryPlayer player, TileAlvearySieve tile) {
super(tile.getInternalInventory());
this.tile = tile;
IInventory inventory = tile.getInternalInventory();
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));
addSlotToContainer(new SlotCustom(inventory, 0, 94, 52).setCrafter(tile));
addSlotToContainer(new SlotCustom(inventory, 1, 115, 39).setCrafter(tile));
addSlotToContainer(new SlotCustom(inventory, 2, 73, 39).setCrafter(tile));
addSlotToContainer(new SlotCustom(inventory, 3, 94, 26).setCrafter(tile));
addSlot(new SlotCustom(inventory, TileAlvearySieve.SLOT_SIEVE, 43, 39, ForestryItem.craftingMaterial.getItemStack(1, 3)).setCrafter(tile));
addSlotToContainer(new SlotCustom(inventory, TileAlvearySieve.SLOT_SIEVE, 43, 39, ForestryItem.craftingMaterial.getItemStack(1, 3)).setCrafter(tile));
// Player inventory
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 87 + i * 18));
addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 87 + i * 18));
}
}
// Player hotbar
for (int i = 0; i < 9; i++) {
addSlot(new Slot(player, i, 8 + i * 18, 145));
addSlotToContainer(new Slot(player, i, 8 + i * 18, 145));
}
}
@@ -24,18 +24,18 @@ public class ContainerAlvearySwarmer extends ContainerForestry {
public ContainerAlvearySwarmer(InventoryPlayer player, TileAlvearySwarmer tile) {
super(tile);
this.addSlot(new SlotCustom(tile, 0, 79, 52, getInducerItems()));
this.addSlot(new SlotCustom(tile, 1, 100, 39, getInducerItems()));
this.addSlot(new SlotCustom(tile, 2, 58, 39, getInducerItems()));
this.addSlot(new SlotCustom(tile, 3, 79, 26, getInducerItems()));
this.addSlotToContainer(new SlotCustom(tile, 0, 79, 52, getInducerItems()));
this.addSlotToContainer(new SlotCustom(tile, 1, 100, 39, getInducerItems()));
this.addSlotToContainer(new SlotCustom(tile, 2, 58, 39, getInducerItems()));
this.addSlotToContainer(new SlotCustom(tile, 3, 79, 26, getInducerItems()));
// Player inventory
for (int i = 0; i < 3; i++)
for (int j = 0; j < 9; j++)
addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 87 + i * 18));
addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 87 + i * 18));
// Player hotbar
for (int i = 0; i < 9; i++)
addSlot(new Slot(player, i, 8 + i * 18, 145));
addSlotToContainer(new Slot(player, i, 8 + i * 18, 145));
}
@@ -33,36 +33,36 @@ public class ContainerApiary extends ContainerForestry {
IInventory inv = tile.getInternalInventory();
// Queen/Princess
this.addSlot(new SlotCustom(inv, TileBeehouse.SLOT_QUEEN, 29, 39, ForestryItem.beePrincessGE, ForestryItem.beeQueenGE));
this.addSlotToContainer(new SlotCustom(inv, TileBeehouse.SLOT_QUEEN, 29, 39, ForestryItem.beePrincessGE, ForestryItem.beeQueenGE));
// Drone
this.addSlot(new SlotCustom(inv, TileBeehouse.SLOT_DRONE, 29, 65, ForestryItem.beeDroneGE));
this.addSlotToContainer(new SlotCustom(inv, TileBeehouse.SLOT_DRONE, 29, 65, ForestryItem.beeDroneGE));
// Frames
if (hasFrames) {
this.addSlot(new SlotCustom(inv, TileBeehouse.SLOT_FRAMES_1, 66, 23, IHiveFrame.class));
this.addSlot(new SlotCustom(inv, TileBeehouse.SLOT_FRAMES_1 + 1, 66, 52, IHiveFrame.class));
this.addSlot(new SlotCustom(inv, TileBeehouse.SLOT_FRAMES_1 + 2, 66, 81, IHiveFrame.class));
this.addSlotToContainer(new SlotCustom(inv, TileBeehouse.SLOT_FRAMES_1, 66, 23, IHiveFrame.class));
this.addSlotToContainer(new SlotCustom(inv, TileBeehouse.SLOT_FRAMES_1 + 1, 66, 52, IHiveFrame.class));
this.addSlotToContainer(new SlotCustom(inv, TileBeehouse.SLOT_FRAMES_1 + 2, 66, 81, IHiveFrame.class));
}
// Product Inventory
this.addSlot(new SlotClosed(inv, 2, 116, 52));
this.addSlot(new SlotClosed(inv, 3, 137, 39));
this.addSlot(new SlotClosed(inv, 4, 137, 65));
this.addSlot(new SlotClosed(inv, 5, 116, 78));
this.addSlot(new SlotClosed(inv, 6, 95, 65));
this.addSlot(new SlotClosed(inv, 7, 95, 39));
this.addSlot(new SlotClosed(inv, 8, 116, 26));
this.addSlotToContainer(new SlotClosed(inv, 2, 116, 52));
this.addSlotToContainer(new SlotClosed(inv, 3, 137, 39));
this.addSlotToContainer(new SlotClosed(inv, 4, 137, 65));
this.addSlotToContainer(new SlotClosed(inv, 5, 116, 78));
this.addSlotToContainer(new SlotClosed(inv, 6, 95, 65));
this.addSlotToContainer(new SlotClosed(inv, 7, 95, 39));
this.addSlotToContainer(new SlotClosed(inv, 8, 116, 26));
// Player inventory
for (int i1 = 0; i1 < 3; i1++) {
for (int l1 = 0; l1 < 9; l1++) {
addSlot(new Slot(player, l1 + i1 * 9 + 9, 8 + l1 * 18, 108 + i1 * 18));
addSlotToContainer(new Slot(player, l1 + i1 * 9 + 9, 8 + l1 * 18, 108 + i1 * 18));
}
}
// Player hotbar
for (int j1 = 0; j1 < 9; j1++) {
addSlot(new Slot(player, j1, 8 + j1 * 18, 166));
addSlotToContainer(new Slot(player, j1, 8 + j1 * 18, 166));
}
}
@@ -31,12 +31,12 @@ public class ContainerHabitatLocator extends ContainerItemInventory {
this.inventory = inventory;
// Energy
this.addSlot(new SlotCustom(inventory, 2, 152, 8, ForestryItem.honeydew, ForestryItem.honeyDrop));
this.addSlotToContainer(new SlotCustom(inventory, 2, 152, 8, ForestryItem.honeydew, ForestryItem.honeyDrop));
// Bee to analyze
this.addSlot(new SlotCustom(inventory, 0, 152, 32, ItemBeeGE.class));
this.addSlotToContainer(new SlotCustom(inventory, 0, 152, 32, ItemBeeGE.class));
// Analyzed bee
this.addSlot(new SlotCustom(inventory, 1, 152, 75, ItemBeeGE.class));
this.addSlotToContainer(new SlotCustom(inventory, 1, 152, 75, ItemBeeGE.class));
// Player inventory
for (int i1 = 0; i1 < 3; i1++)
@@ -35,17 +35,17 @@ public class ContainerImprinter extends ContainerForestry implements IGuiSelecta
this.inventory = inventory;
// Input
this.addSlot(new SlotCustom(inventory, 0, 152, 12, ItemBeeGE.class));
this.addSlotToContainer(new SlotCustom(inventory, 0, 152, 12, ItemBeeGE.class));
// Output
this.addSlot(new SlotCustom(inventory, 1, 152, 72, ItemBeeGE.class));
this.addSlotToContainer(new SlotCustom(inventory, 1, 152, 72, ItemBeeGE.class));
// Player inventory
for (int i1 = 0; i1 < 3; i1++)
for (int l1 = 0; l1 < 9; l1++)
addSlot(new Slot(inventoryplayer, l1 + i1 * 9 + 9, 8 + l1 * 18, 103 + i1 * 18));
addSlotToContainer(new Slot(inventoryplayer, l1 + i1 * 9 + 9, 8 + l1 * 18, 103 + i1 * 18));
// Player hotbar
for (int j1 = 0; j1 < 9; j1++)
addSlot(new Slot(inventoryplayer, j1, 8 + j1 * 18, 161));
addSlotToContainer(new Slot(inventoryplayer, j1, 8 + j1 * 18, 161));
}
@Override
@@ -40,8 +40,6 @@ public class GuiBeealyzer extends GuiAlyzer {
((ItemBeeGE) ForestryItem.beeDroneGE.item()).addCreativeItems(beeList, false);
for (ItemStack beeStack : beeList)
iconStacks.put(BeeGenome.getSpecies(beeStack).getUID(), beeStack);
breedingTracker = PluginApiculture.beeInterface.getBreedingTracker(player.worldObj, player.getGameProfile());
}
@Override
@@ -102,8 +102,8 @@ public class GuiImprinter extends GuiForestry<TileForestry> {
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
int slot = 0;
if ((slot = getHabitatSlotAtPosition(i - cornerX, j - cornerY)) < 0)
int slot = getHabitatSlotAtPosition(i - cornerX, j - cornerY);
if (slot < 0)
return;
if (k == 0)
@@ -44,7 +44,7 @@ public class BeeItemRenderer implements IItemRenderer {
public static float getIrregularWingYaw(long flapping, float flap) {
long irregular = flapping / 1000;
float wingYaw = 1f;
float wingYaw;
if(irregular % 11 == 0) {
wingYaw = 0.75f;
@@ -47,7 +47,7 @@ public class TextureBiomefinder extends TextureAtlasSprite {
public void updateCompass(World world, double playerX, double playerZ, double playerYaw, boolean par8, boolean hasSpin) {
double targetAngle = 0.0d;
double targetAngle;
if(world == null || targetBiome == null) {
// No target has the locator spinning wildly.
@@ -322,11 +322,8 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
EnumTolerance temperatureTolerance = genome.getToleranceTemp();
Collection<EnumTemperature> toleratedTemperatures = AlleleManager.climateHelper.getToleratedTemperature(beeTemperature, temperatureTolerance);
boolean validTemp = false;
validTemp = toleratedTemperatures.contains(EnumTemperature.getFromValue(temperature));
if (!validTemp)
if (!toleratedTemperatures.contains(EnumTemperature.getFromValue(temperature)))
return false;
EnumHumidity beeHumidity = genome.getPrimary().getHumidity();
@@ -334,11 +331,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
Collection<EnumHumidity> toleratedHumidity = AlleleManager.climateHelper.getToleratedHumidity(beeHumidity, humidityTolerance);
boolean validHumidity = false;
validHumidity = toleratedHumidity.contains(EnumHumidity.getFromValue(humidity));
return validHumidity;
return toleratedHumidity.contains(EnumHumidity.getFromValue(humidity));
}
protected void fillBoxWith(World world, StructureBoundingBox box, int par3, int par4, int par5, int par6, int par7, int par8, ItemStack buildingBlock,
@@ -43,8 +43,8 @@ public class FruitProviderNone implements IFruitProvider {
overlayTypes.put("plums", new OverlayType("plums", (short) 1004));
}
String key;
IFruitFamily family = null;
private final String key;
private final IFruitFamily family;
int ripeningPeriod = 10;
@@ -39,7 +39,7 @@ public class FruitProviderPod extends FruitProviderNone {
}
}
private static ItemStack[] DUMMY = new ItemStack[0];
private static final ItemStack[] DUMMY = new ItemStack[0];
private final EnumPodType type;
private final ItemStack[] drop;
@@ -93,10 +93,7 @@ public class BlockArbFence extends BlockFence implements IWoodTyped {
public boolean isFence(IBlockAccess world, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
if (PluginArboriculture.validFences.contains(block))
return true;
return false;
return PluginArboriculture.validFences.contains(block);
}
/* PROPERTIES */
@@ -341,9 +341,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
**/
@Override
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z) {
if (!Block.isEqualTo(oldBlock, newBlock))
return true;
return false;
return !Block.isEqualTo(oldBlock, newBlock);
}
/* IFRUITBEARER */
@@ -218,10 +218,7 @@ public class Tree extends Individual implements ITree, ITreeGenData, IPlantable
return false;
Collection<IFruitFamily> suitable = genome.getPrimary().getSuitableFruit();
if (!suitable.contains(provider.getFamily()))
return false;
return true;
return suitable.contains(provider.getFamily());
}
@Override
@@ -360,18 +357,17 @@ public class Tree extends Individual implements ITree, ITreeGenData, IPlantable
}
for (ITreeMutation mutation : PluginArboriculture.treeInterface.getMutations(true)) {
float chance = 0;
// Stop blacklisted species.
// if (BeeManager.breedingManager.isBlacklisted(mutation.getTemplate()[0].getUID())) {
// continue;
// }
if ((chance = mutation.getChance(world, x, y, z, allele0, allele1, genome0, genome1)) > 0)
if (world.rand.nextFloat()*100 < chance)
// IApiaristTracker breedingTracker = BeeManager.breedingManager.getApiaristTracker(world);
// breedingTracker.registerMutation(mutation);
return PluginArboriculture.treeInterface.templateAsChromosomes(mutation.getTemplate());
float chance = mutation.getChance(world, x, y, z, allele0, allele1, genome0, genome1);
if (chance > world.rand.nextFloat() * 100) {
// IApiaristTracker breedingTracker = BeeManager.breedingManager.getApiaristTracker(world);
// breedingTracker.registerMutation(mutation);
return PluginArboriculture.treeInterface.templateAsChromosomes(mutation.getTemplate());
}
}
return null;
@@ -10,8 +10,24 @@
******************************************************************************/
package forestry.arboriculture.genetics;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Map.Entry;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.common.FMLCommonHandler;
import forestry.api.arboriculture.EnumGermlingType;
import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.arboriculture.IAlleleFruit;
@@ -38,19 +54,6 @@ import forestry.core.config.ForestryItem;
import forestry.core.genetics.SpeciesRoot;
import forestry.core.utils.BlockUtil;
import forestry.plugins.PluginArboriculture;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Map.Entry;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class TreeHelper extends SpeciesRoot implements ITreeRoot {
@@ -79,9 +82,7 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
public int getSpeciesCount() {
if (treeSpeciesCount < 0) {
treeSpeciesCount = 0;
Iterator<Entry<String, IAllele>> it = AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet().iterator();
while (it.hasNext()) {
Entry<String, IAllele> entry = it.next();
for (Entry<String, IAllele> entry : AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) {
if (entry.getValue() instanceof IAlleleTreeSpecies)
if (((IAlleleTreeSpecies) entry.getValue()).isCounted())
treeSpeciesCount++;
@@ -10,19 +10,20 @@
******************************************************************************/
package forestry.arboriculture.gui;
import net.minecraft.entity.player.InventoryPlayer;
import org.apache.commons.lang3.ArrayUtils;
import forestry.api.genetics.AlleleManager;
import forestry.arboriculture.items.ItemGermlingGE;
import forestry.arboriculture.items.ItemTreealyzer.TreealyzerInventory;
import forestry.core.config.ForestryItem;
import forestry.core.gui.ContainerAlyzer;
import net.minecraft.entity.player.InventoryPlayer;
import org.apache.commons.lang3.ArrayUtils;
public class ContainerTreealyzer extends ContainerAlyzer {
TreealyzerInventory inventory;
private static Object[] acceptedEnergy = new Object[] {ForestryItem.honeydew, ForestryItem.honeyDrop};
private static Object[] acceptedSpecimens = ArrayUtils.addAll(AlleleManager.ersatzSaplings.keySet().toArray(), ItemGermlingGE.class);
private static final Object[] acceptedEnergy = new Object[] {ForestryItem.honeydew, ForestryItem.honeyDrop};
private static final Object[] acceptedSpecimens = ArrayUtils.addAll(AlleleManager.ersatzSaplings.keySet().toArray(), ItemGermlingGE.class);
public ContainerTreealyzer(InventoryPlayer inventoryplayer, TreealyzerInventory inventory) {
super(inventoryplayer, inventory, acceptedEnergy, acceptedSpecimens);
@@ -50,10 +50,8 @@ public class LeavesRenderingHandler extends OverlayRenderingHandler implements I
renderer.renderStandardBlock(block, x, y, z);
// Render overlay for fruit leaves.
IIcon fruitIcon = null;
int fruitColor = 0xffffff;
fruitIcon = tile.getFruitTexture();
fruitColor = tile.getFruitColour();
IIcon fruitIcon = tile.getFruitTexture();
int fruitColor = tile.getFruitColour();
if (fruitIcon != null)
renderFruitOverlay(world, block, x, y, z, renderer, fruitIcon, fruitColor);
@@ -39,10 +39,10 @@ public class SaplingRenderHandler implements ISimpleBlockRenderingHandler {
TileSapling tile = BlockSapling.getSaplingTile(world, x, y, z);
IAlleleTreeSpecies species = (IAlleleTreeSpecies) PluginArboriculture.treeInterface.getDefaultTemplate()[0];
if (tile == null || tile.getTree() == null)
return true;
species = tile.getTree().getGenome().getPrimary();
IAlleleTreeSpecies species = tile.getTree().getGenome().getPrimary();
renderCrossedSquares(species, world, block, x, y, z);
renderLayer = 1;
@@ -56,8 +56,8 @@ public enum EnumErrorCode implements IErrorState {
NOTRADE("noTrade", "noResource"),
NOPOWER("noPower");
private String name;
private String iconName;
private final String name;
private final String iconName;
@SideOnly(Side.CLIENT)
private IIcon icon;
+12 -12
View File
@@ -127,20 +127,20 @@ public class GameMode implements IGameMode {
private void initSetting(String ident, ItemStack def, String comment) {
Property property = Config.config.get(ident, category, def.stackSize);
property.Comment = comment;
property.comment = comment;
ItemStack changed = def.copy();
changed.stackSize = Integer.parseInt(property.Value);
changed.stackSize = Integer.parseInt(property.value);
stackSettings.put(ident, changed);
}
private void initSetting(String ident, int def, int max, String comment) {
Property property = Config.config.get(ident, category, def);
if (max < 0) {
property.Comment = comment;
integerSettings.put(ident, Integer.parseInt(property.Value));
property.comment = comment;
integerSettings.put(ident, Integer.parseInt(property.value));
} else {
property.Comment = comment + " (max: " + max + ")";
integerSettings.put(ident, Math.min(Integer.parseInt(property.Value), max));
property.comment = comment + " (max: " + max + ")";
integerSettings.put(ident, Math.min(Integer.parseInt(property.value), max));
}
Config.config.set(ident, category, integerSettings.get(ident));
@@ -149,19 +149,19 @@ public class GameMode implements IGameMode {
private void initSetting(String ident, float def, float max, String comment) {
Property property = Config.config.get(ident, category, def);
if (max < 0) {
property.Comment = comment;
floatSettings.put(ident, Float.parseFloat(property.Value));
property.comment = comment;
floatSettings.put(ident, Float.parseFloat(property.value));
} else {
property.Comment = comment + " (max: " + max + ")";
floatSettings.put(ident, Math.min(Float.parseFloat(property.Value), max));
property.comment = comment + " (max: " + max + ")";
floatSettings.put(ident, Math.min(Float.parseFloat(property.value), max));
}
Config.config.set(ident, category, floatSettings.get(ident));
}
private void initSetting(String ident, boolean def, String comment) {
Property property = Config.config.get(ident, category, def);
property.Comment = comment;
booleanSettings.put(ident, Boolean.parseBoolean(property.Value));
property.comment = comment;
booleanSettings.put(ident, Boolean.parseBoolean(property.value));
Config.config.set(ident, category, booleanSettings.get(ident));
}
@@ -27,23 +27,23 @@ import net.minecraft.world.World;
public class ContainerSolderingIron extends ContainerItemInventory implements IGuiSelectable {
SolderingInventory inventory;
private final SolderingInventory inventory;
public ContainerSolderingIron(InventoryPlayer inventoryplayer, SolderingInventory inventory) {
super(inventory, inventoryplayer.player);
this.inventory = inventory;
// Input
this.addSlot(new SlotCustom(inventory, 0, 152, 12, ItemCircuitBoard.class));
this.addSlotToContainer(new SlotCustom(inventory, 0, 152, 12, ItemCircuitBoard.class));
// Output
this.addSlot(new SlotCustom(inventory, 1, 152, 92, ItemCircuitBoard.class));
this.addSlotToContainer(new SlotCustom(inventory, 1, 152, 92, ItemCircuitBoard.class));
// Ingredients
this.addSlot(new Slot(inventory, 2, 12, 32));
this.addSlot(new Slot(inventory, 3, 12, 52));
this.addSlot(new Slot(inventory, 4, 12, 72));
this.addSlot(new Slot(inventory, 5, 12, 92));
this.addSlotToContainer(new Slot(inventory, 2, 12, 32));
this.addSlotToContainer(new Slot(inventory, 3, 12, 52));
this.addSlotToContainer(new Slot(inventory, 4, 12, 72));
this.addSlotToContainer(new Slot(inventory, 5, 12, 92));
// Player inventory
for (int i1 = 0; i1 < 3; i1++)
@@ -69,14 +69,11 @@ public class CommandHelpers {
}
/**
Avoid using this function if at all possible. Commands are processed on the server,
which has no localization information.
StringUtil.localize() is NOT a valid alternative for sendLocalizedChatMessage().
Messages will not be localized properly if you use StringUtil.localize().
@param sender
@param message
* Avoid using this function if at all possible. Commands are processed on the server,
* which has no localization information.
*
* StringUtil.localize() is NOT a valid alternative for sendLocalizedChatMessage().
* Messages will not be localized properly if you use StringUtil.localize().
*/
public static void sendChatMessage(ICommandSender sender, String message) {
sender.addChatMessage(new ChatComponentText(message));
+45 -45
View File
@@ -97,12 +97,12 @@ public class Config {
config.addPurge("power.framework");
Property property = config.get("difficulty.gamemode", CATEGORY_COMMON, "EASY");
property.Comment = "set to your preferred game mode. available modes are OP, EASY, NORMAL, HARD. mismatch with the server may cause visual glitches with recipes. setting an unavailable mode will create a new mode definition file.";
gameMode = property.Value;
property.comment = "set to your preferred game mode. available modes are OP, EASY, NORMAL, HARD. mismatch with the server may cause visual glitches with recipes. setting an unavailable mode will create a new mode definition file.";
gameMode = property.value;
property = config.get("difficulty.recreate.definitions", CATEGORY_COMMON, true);
property.Comment = "set to true to force recreation of the game mode definitions in config/forestry/gamemodes";
boolean recreate = Boolean.parseBoolean(property.Value);
property.comment = "set to true to force recreation of the game mode definitions in config/forestry/gamemodes";
boolean recreate = Boolean.parseBoolean(property.value);
if (recreate)
Proxies.log.info("Recreating all gamemode definitions from the defaults. This may be caused by an upgrade");
@@ -127,88 +127,88 @@ public class Config {
config.set("difficulty.recreate.definitions", CATEGORY_COMMON, false);
Property particleFX = config.get("performance.particleFX.enabled", CATEGORY_COMMON, true);
particleFX.Comment = "set to false to disable particle fx on slower machines";
enableParticleFX = Boolean.parseBoolean(particleFX.Value);
particleFX.comment = "set to false to disable particle fx on slower machines";
enableParticleFX = Boolean.parseBoolean(particleFX.value);
Property genApatiteOre = config.get("world.generate.apatite", CATEGORY_COMMON, true);
genApatiteOre.Comment = "set to false to force forestry to skip generating own apatite ore blocks in the world";
generateApatiteOre = Boolean.parseBoolean(genApatiteOre.Value);
genApatiteOre.comment = "set to false to force forestry to skip generating own apatite ore blocks in the world";
generateApatiteOre = Boolean.parseBoolean(genApatiteOre.value);
Property genBeehives = config.get("world.generate.beehives", CATEGORY_COMMON, true);
genBeehives.Comment = "set to false to force forestry to skip generating beehives in the world";
generateBeehives = Boolean.parseBoolean(genBeehives.Value);
genBeehives.comment = "set to false to force forestry to skip generating beehives in the world";
generateBeehives = Boolean.parseBoolean(genBeehives.value);
Property genDebugBeehives = config.get("world.generate.beehives.debug", CATEGORY_DEBUG, false);
genDebugBeehives.Comment = "Set to true to force Forestry to try to generate a beehive at every possible location.";
generateBeehivesDebug = Boolean.parseBoolean(genDebugBeehives.Value);
genDebugBeehives.comment = "Set to true to force Forestry to try to generate a beehive at every possible location.";
generateBeehivesDebug = Boolean.parseBoolean(genDebugBeehives.value);
Property genCopperOre = config.get("world.generate.copper", CATEGORY_COMMON, true);
genCopperOre.Comment = "set to false to force forestry to skip generating own copper ore blocks in the world";
generateCopperOre = Boolean.parseBoolean(genCopperOre.Value);
genCopperOre.comment = "set to false to force forestry to skip generating own copper ore blocks in the world";
generateCopperOre = Boolean.parseBoolean(genCopperOre.value);
Property genTinOre = config.get("world.generate.tin", CATEGORY_COMMON, true);
genTinOre.Comment = "set to false to force forestry to skip generating own tin ore blocks in the world";
generateTinOre = Boolean.parseBoolean(genTinOre.Value);
genTinOre.comment = "set to false to force forestry to skip generating own tin ore blocks in the world";
generateTinOre = Boolean.parseBoolean(genTinOre.value);
Property bronzeRecipe = config.get("crafting.bronze.enabled", CATEGORY_COMMON, true);
bronzeRecipe.Comment = "set to false to disable crafting recipe for bronze";
craftingBronzeEnabled = Boolean.parseBoolean(bronzeRecipe.Value);
bronzeRecipe.comment = "set to false to disable crafting recipe for bronze";
craftingBronzeEnabled = Boolean.parseBoolean(bronzeRecipe.value);
property = config.get("crafting.stamps.enabled", CATEGORY_COMMON, true);
property.Comment = "set to false to disable crafting recipes for all types of stamps.";
craftingStampsEnabled = Boolean.parseBoolean(property.Value);
property.comment = "set to false to disable crafting recipes for all types of stamps.";
craftingStampsEnabled = Boolean.parseBoolean(property.value);
String defaultCollectors = "20n;50n;100n;200n";
property = config.get("crafting.stamps.collector", CATEGORY_COMMON, defaultCollectors);
property.Comment = "if crafting of stamps is generally allowed, these stamps are still excluded from crafting.";
property.comment = "if crafting of stamps is generally allowed, these stamps are still excluded from crafting.";
try {
collectorStamps.addAll(Arrays.asList(parseStamps(property.Value)));
collectorStamps.addAll(Arrays.asList(parseStamps(property.value)));
} catch(Exception ex) {
config.set("crafting.stamps.collector", CATEGORY_COMMON, defaultCollectors);
collectorStamps.addAll(Arrays.asList(parseStamps(defaultCollectors)));
}
Property indicatorEnable = config.get("tweaks.mailalert.enabled", CATEGORY_COMMON, true);
indicatorEnable.Comment = "set to false to disable the mail alert box";
mailAlertEnabled = Boolean.parseBoolean(indicatorEnable.Value);
indicatorEnable.comment = "set to false to disable the mail alert box";
mailAlertEnabled = Boolean.parseBoolean(indicatorEnable.value);
Property clearGenome = config.get("genetics.clear.invalid.chromosomes", CATEGORY_COMMON, clearInvalidChromosomes);
clearGenome.Comment = "set to true to clear chromosomes which contain invalid alleles. might rescue your save if it is crashing after the removal of a bee addon.";
clearInvalidChromosomes = Boolean.parseBoolean(clearGenome.Value);
clearGenome.comment = "set to true to clear chromosomes which contain invalid alleles. might rescue your save if it is crashing after the removal of a bee addon.";
clearInvalidChromosomes = Boolean.parseBoolean(clearGenome.value);
Property dungeonLootRarity = config.get("difficulty.dungeonloot.rare", CATEGORY_COMMON, false);
dungeonLootRarity.Comment = "set to true to make dungeon loot generated by forestry rarer";
dungeonLootRare = Boolean.parseBoolean(dungeonLootRarity.Value);
dungeonLootRarity.comment = "set to true to make dungeon loot generated by forestry rarer";
dungeonLootRare = Boolean.parseBoolean(dungeonLootRarity.value);
Property resupplyEnable = config.get("performance.backpacks.resupply", CATEGORY_COMMON, true);
resupplyEnable.Comment = "leaving this enabled will cycle the list of active players PER INGAME TICK to check for resupply via backpack. you want to set this to false on busy servers.";
Config.enableBackpackResupply = Boolean.parseBoolean(resupplyEnable.Value);
resupplyEnable.comment = "leaving this enabled will cycle the list of active players PER INGAME TICK to check for resupply via backpack. you want to set this to false on busy servers.";
Config.enableBackpackResupply = Boolean.parseBoolean(resupplyEnable.value);
property = config.get("tweaks.hints.disabled", CATEGORY_COMMON, false);
property.Comment = "set to true to disable hints on machine and engine guis.";
Config.disableHints = Boolean.parseBoolean(property.Value);
property.comment = "set to true to disable hints on machine and engine guis.";
Config.disableHints = Boolean.parseBoolean(property.value);
property = config.get("tweaks.energystat.disabled", CATEGORY_COMMON, true);
property.Comment = "set to true to disable energy statistics on energy consumers.";
Config.disableEnergyStat = !isDebug && Boolean.parseBoolean(property.Value);
property.comment = "set to true to disable energy statistics on energy consumers.";
Config.disableEnergyStat = !isDebug && Boolean.parseBoolean(property.value);
property = config.get("tweaks.tooltip.liquidamount.disabled", CATEGORY_COMMON, false);
property.Comment = "set to true to disable displaying liquid amounts in tank tooltips.";
Config.tooltipLiquidAmount = isDebug || !Boolean.parseBoolean(property.Value);
property.comment = "set to true to disable displaying liquid amounts in tank tooltips.";
Config.tooltipLiquidAmount = isDebug || !Boolean.parseBoolean(property.value);
property = config.get("tweaks.permissions.disabled", CATEGORY_COMMON, false);
property.Comment = "set to true to disable access restrictions on forestry machines.";
Config.disablePermissions = Boolean.parseBoolean(property.Value);
property.comment = "set to true to disable access restrictions on forestry machines.";
Config.disablePermissions = Boolean.parseBoolean(property.value);
property = config.get("tweaks.upgradenotice.disabled", CATEGORY_COMMON, false);
property.Comment = "set to true to disable update and version check notice.";
Config.disableVersionCheck = isDebug || Boolean.parseBoolean(property.Value);
property.comment = "set to true to disable update and version check notice.";
Config.disableVersionCheck = isDebug || Boolean.parseBoolean(property.value);
property = config.get("tweaks.farms.squared", CATEGORY_COMMON, false);
property.Comment = "set to true to have farms use a square layout instead of a diamond one.";
Config.squareFarms = Boolean.parseBoolean(property.Value);
property.comment = "set to true to have farms use a square layout instead of a diamond one.";
Config.squareFarms = Boolean.parseBoolean(property.value);
property = config.get("structures.schemata.disabled", CATEGORY_COMMON, "");
property.Comment = "add schemata keys to disable them. current keys: alveary3x3;farm3x3;farm3x4;farm3x5;farm4x4;farm5x5";
disabledStructures.addAll(Arrays.asList(parseStructureKeys(property.Value)));
property.comment = "add schemata keys to disable them. current keys: alveary3x3;farm3x3;farm3x4;farm3x5;farm4x4;farm5x5";
disabledStructures.addAll(Arrays.asList(parseStructureKeys(property.value)));
for (String str : disabledStructures)
Proxies.log.finer("Disabled structure '%s'.", str);
@@ -281,7 +281,7 @@ public class Config {
}
public static boolean getOrCreateBooleanProperty(String key, String kind, boolean defaults) {
return Boolean.parseBoolean(config.get(key, kind, defaults).Value);
return Boolean.parseBoolean(config.get(key, kind, defaults).value);
}
}
@@ -18,7 +18,6 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
@@ -89,7 +88,7 @@ public class Configuration {
public void set(String key, String category, boolean val) {
Property existing = getExisting(key, category);
if (existing != null) {
existing.Value = Boolean.toString(val);
existing.value = Boolean.toString(val);
return;
}
@@ -102,7 +101,7 @@ public class Configuration {
public void set(String key, String category, String val) {
Property existing = getExisting(key, category);
if (existing != null) {
existing.Value = val;
existing.value = val;
return;
}
@@ -115,7 +114,7 @@ public class Configuration {
public void set(String key, String category, int val) {
Property existing = getExisting(key, category);
if (existing != null) {
existing.Value = Integer.toString(val);
existing.value = Integer.toString(val);
return;
}
@@ -128,7 +127,7 @@ public class Configuration {
public void set(String key, String category, float val) {
Property existing = getExisting(key, category);
if (existing != null) {
existing.Value = Float.toString(val);
existing.value = Float.toString(val);
return;
}
@@ -143,7 +142,7 @@ public class Configuration {
loadCategory(category);
for (Property property : categorized.get(category))
if (property.Key.equals(key))
if (property.key.equals(key))
return property;
return null;
@@ -200,7 +199,7 @@ public class Configuration {
property = new Property(tokens[0], "");
if (lastComment != null) {
property.Comment = lastComment;
property.comment = lastComment;
lastComment = null;
}
categorized.get(category).add(property);
@@ -214,9 +213,7 @@ public class Configuration {
}
public void save() {
Iterator<Map.Entry<String, ArrayList<Property>>> it = categorized.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, ArrayList<Property>> entry = it.next();
for (Map.Entry<String, ArrayList<Property>> entry : categorized.entrySet()) {
saveFile(getCategoryFile(entry.getKey()), entry.getValue());
}
}
@@ -248,18 +245,16 @@ public class Configuration {
writer.write("# gamemodes/\t\t-\t Configures available gamemodes");
TreeMap<String, ArrayList<Property>> subsectioned = getSubsectioned(properties);
Iterator<Map.Entry<String, ArrayList<Property>>> it = subsectioned.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, ArrayList<Property>> entry = it.next();
for (Map.Entry<String, ArrayList<Property>> entry : subsectioned.entrySet()) {
writer.write(newLine + newLine + "#####################" + newLine + "# " + entry.getKey().toUpperCase() + newLine + "#####################"
+ newLine);
for (Property property : entry.getValue()) {
if(purge.contains(property.Key))
if (purge.contains(property.key))
continue;
if (property.Comment != null)
writer.write("# " + property.Comment + newLine);
writer.write(property.Key + "=" + property.Value + newLine);
if (property.comment != null)
writer.write("# " + property.comment + newLine);
writer.write(property.key + "=" + property.value + newLine);
}
}
@@ -275,7 +270,7 @@ public class Configuration {
TreeMap<String, ArrayList<Property>> subsectioned = new TreeMap<String, ArrayList<Property>>();
for (Property property : properties) {
String subsection = property.Key.split("\\.")[0];
String subsection = property.key.split("\\.")[0];
if (!subsectioned.containsKey(subsection))
subsectioned.put(subsection, new ArrayList<Property>());
subsectioned.get(subsection).add(property);
@@ -11,12 +11,12 @@
package forestry.core.config;
public class Property {
public String Key;
public String Value;
public String Comment;
public final String key;
public String value;
public String comment;
public Property(String key, String value) {
Key = key;
Value = value;
this.key = key;
this.value = value;
}
}
@@ -62,13 +62,13 @@ public class Version {
return false;
Property property = Config.config.get("vars.version.seen", Config.CATEGORY_COMMON, VERSION);
property.Comment = "indicates the last version the user has been informed about and will suppress further notices on it.";
String seenVersion = property.Value;
property.comment = "indicates the last version the user has been informed about and will suppress further notices on it.";
String seenVersion = property.value;
if (recommendedVersion == null || recommendedVersion.equals(seenVersion))
return false;
property.Value = recommendedVersion;
property.value = recommendedVersion;
Config.config.save();
return true;
}
@@ -10,23 +10,26 @@
******************************************************************************/
package forestry.core.fluids.tanks;
import forestry.core.gui.tooltips.ToolTipLine;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import net.minecraft.item.EnumRarity;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import forestry.core.gui.tooltips.ToolTipLine;
/**
*
* @author CovertJaguar <http://www.railcraft.info>
*/
public class FilteredTank extends StandardTank {
private HashSet<Fluid> filters;
private final HashSet<Fluid> filters;
public FilteredTank(int capacity, Fluid... filters) {
this(capacity, Arrays.asList(filters), null);
@@ -52,7 +52,7 @@ public class BlockResourceStorageBlock extends Block {
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int i, int meta) {
IIcon icon = null;
IIcon icon;
if (meta == 0) {
icon = iconApatite;
} else if (meta == 1) {
@@ -107,14 +107,6 @@ public class BlockSoil extends Block implements IItemTyped {
matureBog(world, i, j, k);
}
/**
*
* @param world
* @param x
* @param y
* @param z
* @return
*/
private boolean isEnrooted(World world, int x, int y, int z) {
for (int i = -1; i < 2; i++)
@@ -123,10 +115,7 @@ public class BlockSoil extends Block implements IItemTyped {
if (block == Blocks.log || block == Blocks.sapling || block == ForestryBlock.saplingGE.block())
// We are not returning true if we are the base of a
// sapling.
if (i == 0 && j == 0)
return false;
else
return true;
return !(i == 0 && j == 0);
}
return false;
@@ -134,18 +123,13 @@ public class BlockSoil extends Block implements IItemTyped {
/**
* If a tree or sapling is in the vicinity, there is a chance, that the soil will degrade.
*
* @param world
* @param i
* @param j
* @param k
*/
private void degradeSoil(World world, int i, int j, int k) {
private void degradeSoil(World world, int x, int y, int z) {
if (world.rand.nextInt(140) != 0)
return;
int meta = world.getBlockMetadata(i, j, k);
int meta = world.getBlockMetadata(x, y, z);
// Unpack first
int type = meta & 0x03;
@@ -158,10 +142,10 @@ public class BlockSoil extends Block implements IItemTyped {
meta = (grade << 2 | type);
if (grade >= degradeDelimiter)
world.setBlock(i, j, k, Blocks.sand, 0, Defaults.FLAG_BLOCK_SYNCH);
world.setBlock(x, y, z, Blocks.sand, 0, Defaults.FLAG_BLOCK_SYNCH);
else
world.setBlockMetadataWithNotify(i, j, k, meta, Defaults.FLAG_BLOCK_SYNCH);
world.markBlockForUpdate(i, j, k);
world.setBlockMetadataWithNotify(x, y, z, meta, Defaults.FLAG_BLOCK_SYNCH);
world.markBlockForUpdate(x, y, z);
}
public static boolean isMoistened(World world, int x, int y, int z) {
@@ -188,7 +172,7 @@ public class BlockSoil extends Block implements IItemTyped {
int type = meta & 0x03;
int maturity = meta >> 2;
if (maturity >= this.degradeDelimiter)
if (maturity >= degradeDelimiter)
return;
// Increment (de)gradation
@@ -68,7 +68,7 @@ public abstract class Engine extends TileBase implements IEnergyConnection {
protected final int maxHeat;
protected boolean forceCooldown = false;
public float progress;
protected EnergyManager energyManager;
protected final EnergyManager energyManager;
public Engine(int maxHeat, int maxEnergy, int maxEnergyExtracted) {
this.maxHeat = maxHeat;
@@ -85,11 +85,6 @@ public abstract class Engine extends TileBase implements IEnergyConnection {
rotateEngine();
}
/**
* Adds heat
*
* @param i
*/
protected void addHeat(int i) {
heat += i;
@@ -227,8 +222,6 @@ public abstract class Engine extends TileBase implements IEnergyConnection {
/**
* Returns the current energy state of the engine
*
* @return
*/
public TemperatureState getTemperatureState() {
// double scaledStorage = (double)storedEnergy / (double)maxEnergy;
@@ -248,11 +241,6 @@ public abstract class Engine extends TileBase implements IEnergyConnection {
return TemperatureState.MELTING;
}
/**
* Piston speed
*
* @return
*/
public float getPistonSpeed() {
switch (getTemperatureState()) {
case COOL:
@@ -33,9 +33,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
/**
* This will replace the whole {@link Gadget}-nonsense at some point, using the proper Forge hook. Will hopefully sort out any issues with interfaces.
*/
public class MachineDefinition {
public final Class<? extends TileEntity> teClass;
@@ -19,17 +19,17 @@ public class ContainerAlyzer extends ContainerItemInventory {
final int xPosLeftSlots = 223;
// Energy
this.addSlot(new SlotCustom(inventory, AlyzerInventory.SLOT_ENERGY, xPosLeftSlots, 8, acceptedEnergy));
this.addSlotToContainer(new SlotCustom(inventory, AlyzerInventory.SLOT_ENERGY, xPosLeftSlots, 8, acceptedEnergy));
// Bee to analyze
this.addSlot(new SlotCustom(inventory, AlyzerInventory.SLOT_SPECIMEN, xPosLeftSlots, 26, acceptedSpecimens));
this.addSlotToContainer(new SlotCustom(inventory, AlyzerInventory.SLOT_SPECIMEN, xPosLeftSlots, 26, acceptedSpecimens));
// Analyzed bee
this.addSlot(new SlotCustom(inventory, AlyzerInventory.SLOT_ANALYZE_1, xPosLeftSlots, 57, acceptedSpecimens));
this.addSlot(new SlotCustom(inventory, AlyzerInventory.SLOT_ANALYZE_2, xPosLeftSlots, 75, acceptedSpecimens));
this.addSlot(new SlotCustom(inventory, AlyzerInventory.SLOT_ANALYZE_3, xPosLeftSlots, 93, acceptedSpecimens));
this.addSlot(new SlotCustom(inventory, AlyzerInventory.SLOT_ANALYZE_4, xPosLeftSlots, 111, acceptedSpecimens));
this.addSlot(new SlotCustom(inventory, AlyzerInventory.SLOT_ANALYZE_5, xPosLeftSlots, 129, acceptedSpecimens));
this.addSlotToContainer(new SlotCustom(inventory, AlyzerInventory.SLOT_ANALYZE_1, xPosLeftSlots, 57, acceptedSpecimens));
this.addSlotToContainer(new SlotCustom(inventory, AlyzerInventory.SLOT_ANALYZE_2, xPosLeftSlots, 75, acceptedSpecimens));
this.addSlotToContainer(new SlotCustom(inventory, AlyzerInventory.SLOT_ANALYZE_3, xPosLeftSlots, 93, acceptedSpecimens));
this.addSlotToContainer(new SlotCustom(inventory, AlyzerInventory.SLOT_ANALYZE_4, xPosLeftSlots, 111, acceptedSpecimens));
this.addSlotToContainer(new SlotCustom(inventory, AlyzerInventory.SLOT_ANALYZE_5, xPosLeftSlots, 129, acceptedSpecimens));
final int xPosPlayerInv = 43;
final int xSpacePlayerInv = 18;
@@ -10,6 +10,10 @@
******************************************************************************/
package forestry.core.gui;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import forestry.core.config.ForestryItem;
import forestry.core.fluids.Fluids;
import forestry.core.gadgets.TileAnalyzer;
@@ -17,29 +21,22 @@ import forestry.core.genetics.ItemGE;
import forestry.core.gui.slots.SlotCustom;
import forestry.core.gui.slots.SlotLiquidContainer;
import forestry.core.gui.slots.SlotOutput;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerAnalyzer extends ContainerLiquidTanks {
private final TileAnalyzer tile;
public ContainerAnalyzer(InventoryPlayer player, TileAnalyzer tile) {
super(tile, tile);
this.tile = tile;
// Input buffer
for (int i = 0; i < 3; i++)
for (int k = 0; k < 2; k++)
addSlot(new SlotCustom(tile, TileAnalyzer.SLOT_INPUT_1 + i * 2 + k, 8 + k * 18, 28 + i * 18, ItemGE.class));
addSlotToContainer(new SlotCustom(tile, TileAnalyzer.SLOT_INPUT_1 + i * 2 + k, 8 + k * 18, 28 + i * 18, ItemGE.class));
// Analyze slot
addSlot(new SlotCustom(tile, TileAnalyzer.SLOT_ANALYZE, 73, 59));
addSlotToContainer(new SlotCustom(tile, TileAnalyzer.SLOT_ANALYZE, 73, 59));
// Can slot
addSlot(new SlotLiquidContainer(tile, TileAnalyzer.SLOT_CAN, 143, 24, false, Fluids.HONEY.get()) {
addSlotToContainer(new SlotLiquidContainer(tile, TileAnalyzer.SLOT_CAN, 143, 24, false, Fluids.HONEY.get()) {
@Override
public boolean isItemValid(ItemStack stack) {
@@ -53,15 +50,15 @@ public class ContainerAnalyzer extends ContainerLiquidTanks {
// Output buffer
for (int i = 0; i < 2; i++)
for (int k = 0; k < 2; k++)
addSlot(new SlotOutput(tile, TileAnalyzer.SLOT_OUTPUT_1 + i * 2 + k, 134 + k * 18, 48 + i * 18));
addSlotToContainer(new SlotOutput(tile, TileAnalyzer.SLOT_OUTPUT_1 + i * 2 + k, 134 + k * 18, 48 + i * 18));
// Player inventory
for (int i1 = 0; i1 < 3; i1++)
for (int l1 = 0; l1 < 9; l1++)
addSlot(new Slot(player, l1 + i1 * 9 + 9, 8 + l1 * 18, 94 + i1 * 18));
addSlotToContainer(new Slot(player, l1 + i1 * 9 + 9, 8 + l1 * 18, 94 + i1 * 18));
// Player hotbar
for (int j1 = 0; j1 < 9; j1++)
addSlot(new Slot(player, j1, 8 + j1 * 18, 152));
addSlotToContainer(new Slot(player, j1, 8 + j1 * 18, 152));
}
@@ -41,24 +41,24 @@ public class ContainerEscritoire extends ContainerForestry implements IGuiSelect
filters.add(Blocks.sapling);
filters.addAll(AlleleManager.alleleRegistry.getSpeciesRoot().values());
// Analyze slot
addSlot(new SlotCustom(tile, TileEscritoire.SLOT_ANALYZE, 97, 67, filters.toArray()).setCrafter(tile));
addSlotToContainer(new SlotCustom(tile, TileEscritoire.SLOT_ANALYZE, 97, 67, filters.toArray()).setCrafter(tile));
for (int i = 0; i < TileEscritoire.SLOTS_INPUT_COUNT; i++) {
addSlot(new SlotCustom(tile, TileEscritoire.SLOT_INPUT_1 + i, 17, 49 + i * 18).setExclusion(true).setBlockedTexture("slots/blocked_2"));
addSlotToContainer(new SlotCustom(tile, TileEscritoire.SLOT_INPUT_1 + i, 17, 49 + i * 18).setExclusion(true).setBlockedTexture("slots/blocked_2"));
}
for(int i = 0; i < 3; i++)
for(int j = 0; j < 2; j++) {
addSlot(new SlotClosed(tile, TileEscritoire.SLOT_RESULTS_1 + (i*2) + j, 177 + j*18, 85 + i*18));
addSlotToContainer(new SlotClosed(tile, TileEscritoire.SLOT_RESULTS_1 + (i * 2) + j, 177 + j * 18, 85 + i * 18));
}
// Player inventory
for (int i = 0; i < 3; i++)
for (int j = 0; j < 9; j++)
addSlot(new Slot(player.inventory, j + i * 9 + 9, 34 + j * 18, 153 + i * 18));
addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 34 + j * 18, 153 + i * 18));
// Player hotbar
for (int k = 0; k < 9; k++)
addSlot(new Slot(player.inventory, k, 34 + k * 18, 211));
addSlotToContainer(new Slot(player.inventory, k, 34 + k * 18, 211));
}
@Override
@@ -34,16 +34,6 @@ public class ContainerForestry extends Container {
this.inventoryForestry = null;
}
/**
* Adds a slot to the container, shortcut for addSlotToContainer(slot).
*
* @param slot
* @return
*/
protected Slot addSlot(Slot slot) {
return addSlotToContainer(slot);
}
@Override
public ItemStack slotClick(int slotIndex, int button, int modifier, EntityPlayer player) {
if (player == null)
@@ -35,9 +35,9 @@ public abstract class ContainerItemInventory extends ContainerForestry {
protected void addSecuredSlot(IInventory other, int slot, int x, int y) {
if (other.getStackInSlot(slot) != null && inventory.itemClass.isAssignableFrom(other.getStackInSlot(slot).getItem().getClass()))
addSlot(new SlotLocked(other, slot, x, y));
addSlotToContainer(new SlotLocked(other, slot, x, y));
else
addSlot(new SlotItemInventory(this, other, player, slot, x, y));
addSlotToContainer(new SlotItemInventory(this, other, player, slot, x, y));
}
protected abstract boolean isAcceptedItem(EntityPlayer player, ItemStack stack);
@@ -22,7 +22,7 @@ import net.minecraft.item.ItemStack;
public class ContainerNaturalistInventory extends ContainerForestry implements IGuiSelectable {
private final IPagedInventory inv;
private ISpeciesRoot speciesRoot;
private final ISpeciesRoot speciesRoot;
public ContainerNaturalistInventory(ISpeciesRoot speciesRoot, InventoryPlayer player, IPagedInventory inventory, int page, int pageSize) {
super(inventory);
@@ -32,19 +32,19 @@ public class ContainerNaturalistInventory extends ContainerForestry implements I
// Inventory
for (int x = 0; x < 5; x++) {
for (int y = 0; y < 5; y++) {
addSlot(new SlotCustom(inventory, y + page * pageSize + x * 5, 100 + y * 18, 21 + x * 18, speciesRoot));
addSlotToContainer(new SlotCustom(inventory, y + page * pageSize + x * 5, 100 + y * 18, 21 + x * 18, speciesRoot));
}
}
// Player inventory
for (int i1 = 0; i1 < 3; i1++) {
for (int l1 = 0; l1 < 9; l1++) {
addSlot(new Slot(player, l1 + i1 * 9 + 9, 18 + l1 * 18, 120 + i1 * 18));
addSlotToContainer(new Slot(player, l1 + i1 * 9 + 9, 18 + l1 * 18, 120 + i1 * 18));
}
}
// Player hotbar
for (int j1 = 0; j1 < 9; j1++) {
addSlot(new Slot(player, j1, 18 + j1 * 18, 178));
addSlotToContainer(new Slot(player, j1, 18 + j1 * 18, 178));
}
}
@@ -24,7 +24,7 @@ import net.minecraft.tileentity.TileEntity;
public class ContainerSocketed extends ContainerForestry {
ISocketable tile;
private final ISocketable tile;
public ContainerSocketed(IInventory inventory, ISocketable tile) {
super(inventory);
@@ -20,7 +20,7 @@ import forestry.core.utils.StringUtil;
*/
public class ErrorLedger extends Ledger {
IErrorSource tile;
private final IErrorSource tile;
public ErrorLedger(LedgerManager manager, IErrorSource tile) {
super(manager);
@@ -45,9 +45,9 @@ public abstract class GuiAlyzer extends GuiForestry<TileForestry> {
protected static final int COLUMN_1 = 85;
protected static final int COLUMN_2 = 150;
protected IInventory inventory;
protected ISpeciesRoot speciesRoot;
protected IBreedingTracker breedingTracker;
protected final IInventory inventory;
protected final ISpeciesRoot speciesRoot;
protected final IBreedingTracker breedingTracker;
protected final String guiName;
@@ -406,53 +406,7 @@ public abstract class GuiForestry<T extends TileForestry> extends GuiContainer i
public void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) {
super.drawGradientRect(par1, par2, par3, par4, par5, par6);
}
//
// protected void drawGuiContainerForegroundLayer() {
// }
/**
* Draws the basic background texture centered on the screen.
*/
// protected void drawBackground() {
// drawBackground((this.width - this.xSize) / 2, (this.height - this.ySize) / 2, this.xSize, this.ySize);
// }
// protected void drawBackground(int x, int y, int w, int h) {
// bindTexture();
// this.drawTexturedModalRect(x, y, 0, 0, w, h);
// }
// protected void bindTexture() {
// bindTexture(textureFile);
// }
//
// protected void drawSlotInventory(Slot slot) {
//
// int xPos = slot.xDisplayPosition;
// int yPos = slot.yDisplayPosition;
// ItemStack slotStack = slot.getStack();
// boolean backgroundDrawn = false;
//
// this.zLevel = 100.0F;
// itemRenderer.zLevel = 100.0F;
//
// if (slotStack == null) {
// IIcon icon = slot.getBackgroundIconIndex();
//
// if (icon != null) {
// GL11.glDisable(GL11.GL_LIGHTING);
// GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0F);
// Proxies.common.bindTexture(SpriteSheet.ITEMS);
// this.drawTexturedModelRectFromIcon(xPos, yPos, icon, 16, 16);
// GL11.glEnable(GL11.GL_LIGHTING);
// backgroundDrawn = true;
// }
// }
//
// if (!backgroundDrawn && slotStack != null)
// drawItemStack(slotStack, xPos, yPos);
//
// this.zLevel = 0.0F;
// itemRenderer.zLevel = 0.0F;
// }
public void drawItemStack(ItemStack stack, int xPos, int yPos) {
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
this.zLevel = 100.0F;
@@ -469,7 +423,7 @@ public abstract class GuiForestry<T extends TileForestry> extends GuiContainer i
}
protected class ItemStackWidget extends Widget {
ItemStack itemStack;
private final ItemStack itemStack;
public ItemStackWidget(int xPos, int yPos, ItemStack itemStack) {
super(widgetManager, xPos, yPos);
@@ -192,7 +192,7 @@ public class GuiNaturalistInventory extends GuiForestry<TileForestry> {
RenderHelper.disableStandardItemLighting();
int line = 48;
int column = 0;
int column;
EnumMutateChance chance = EnumMutateChance.rateChance(combination.getBaseChance());
if (chance == EnumMutateChance.HIGHEST) {
line += 16;
@@ -223,8 +223,8 @@ public class GuiNaturalistInventory extends GuiForestry<TileForestry> {
float chance = mutation.getBaseChance();
int line = 0;
int column = 0;
int line;
int column;
if (chance >= 20) {
line = 16;
column = 228;
@@ -15,12 +15,11 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
public class GuiTextBox extends GuiTextField {
private static final int enabledColor = 14737632;
private static final int disabledColor = 7368816;
private final FontRenderer fontRendererObj;
private final int startX, startY, width, height;
private final int enabledColor = 14737632;
private final int disabledColor = 7368816;
private int lineScroll = 0;
private int maxLines = 0;
+1 -5
View File
@@ -79,11 +79,7 @@ public abstract class Ledger {
}
public boolean intersectsWith(int mouseX, int mouseY, int shiftX, int shiftY) {
if (mouseX >= shiftX && mouseX <= shiftX + currentWidth && mouseY >= shiftY && mouseY <= shiftY + getHeight())
return true;
return false;
return mouseX >= shiftX && mouseX <= shiftX + currentWidth && mouseY >= shiftY && mouseY <= shiftY + getHeight();
}
public void setFullyOpen() {
@@ -38,9 +38,7 @@ public class OwnerLedger extends Ledger {
int shiftX = currentShiftX;
int shiftY = currentShiftY + 44;
if (mouseX >= shiftX && mouseX <= currentShiftX + currentWidth && mouseY >= shiftY && mouseY <= shiftY + 12)
return true;
return false;
return mouseX >= shiftX && mouseX <= currentShiftX + currentWidth && mouseY >= shiftY && mouseY <= shiftY + 12;
}
public boolean isOwnerChangeButton(int mouseX, int mouseY) {
@@ -43,7 +43,7 @@ public class ReservoirWidget extends TankWidget {
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0F);
while (true) {
int x = 0;
int x;
if (squaled > 16) {
x = 16;
@@ -76,7 +76,7 @@ public class TankWidget extends Widget {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0F);
while (true) {
int x = 0;
int x;
if (squaled > 16) {
x = 16;
@@ -810,7 +810,7 @@ public abstract class InvTools {
if (tile instanceof IPipeTile) {
IPipeTile pipe = (IPipeTile) tile;
if (pipe.getPipeType() == IPipeTile.PipeType.ITEM && pipe.isPipeConnected(side.getOpposite())) {
pipes.add(new AbstractMap.SimpleEntry(side, pipe));
pipes.add(new AbstractMap.SimpleEntry<ForgeDirection, IPipeTile>(side, pipe));
foundPipe = true;
}
}
@@ -92,7 +92,7 @@ public class ItemPipette extends ItemForestry implements IToolPipette {
PipetteContents contained = new PipetteContents(itemstack.getTagCompound());
int limit = getCapacity(itemstack);
int filled = 0;
int filled;
if (contained.contents == null) {
@@ -26,8 +26,8 @@ import net.minecraft.nbt.NBTTagCompound;
public class ForestryPacket {
protected static final String channel = "FOR";
protected int id;
protected static String channel = "FOR";
public ForestryPacket() {
}
@@ -157,14 +157,6 @@ public class ClientProxyCommon extends ProxyCommon {
/**
* Renders a EntityBiodustFX on client.
*
* @param world
* @param d1
* @param d2
* @param d3
* @param f1
* @param f2
* @param f3
*/
// FIXME: This is causing crashes.
@Override
@@ -19,7 +19,7 @@ import net.minecraft.world.World;
public class EntitySnowFX extends EntityFX {
public static IIcon icons[];
private Random spreadRand = new Random();
private static final Random spreadRand = new Random();
public EntitySnowFX(World world, double x, double y, double z, float motionScaleX, float motionScaleY, float motionScaleZ) {
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
@@ -10,29 +10,30 @@
******************************************************************************/
package forestry.core.utils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCocoa;
import net.minecraft.block.BlockLog;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import forestry.core.config.Defaults;
import forestry.core.vect.Vect;
import buildcraft.api.core.Position;
import buildcraft.api.transport.IPipeConnection;
import buildcraft.api.transport.IPipeConnection.ConnectOverride;
import buildcraft.api.transport.IPipeTile;
import buildcraft.api.transport.IPipeTile.PipeType;
import cofh.api.energy.IEnergyHandler;
import forestry.core.config.Defaults;
import forestry.core.vect.Vect;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCocoa;
import net.minecraft.block.BlockLog;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.util.Direction;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockUtil {
@@ -44,41 +45,8 @@ public class BlockUtil {
}
/**
* Searches for inventories adjacent to block, excludes IPowerReceptor
*
* @param world
* @param blockPos
* @param from
* @return
* @deprecated Use AdjacentInventoryCache instead
*/
@Deprecated
public static IInventory[] getAdjacentInventories(World world, Vect blockPos, ForgeDirection from) {
ArrayList<IInventory> inventories = new ArrayList<IInventory>();
// WTF is this? A loop that only picks the opposite direction? -CovertJaguar
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if (from != ForgeDirection.UNKNOWN && from != dir.getOpposite())
continue;
TileEntity entity = world.getTileEntity(blockPos.x + dir.offsetX, blockPos.y + dir.offsetY, blockPos.z + dir.offsetZ);
if (entity != null)
if (entity instanceof IInventory)
if (!(entity instanceof TileEntityHopper))
inventories.add((IInventory) entity);
}
return inventories.toArray(new IInventory[inventories.size()]);
}
/**
* Returns a list of adjacent pipes.
*
* @param world
* @param blockPos
* @param from
* @return
*/
public static ForgeDirection[] getPipeDirections(World world, Vect blockPos, ForgeDirection from) {
LinkedList<ForgeDirection> possiblePipes = new LinkedList<ForgeDirection>();
@@ -185,10 +185,6 @@ public class StackUtils {
/**
* Creates a split stack of the specified amount, preserving NBT data,
* without decreasing the source stack.
*
* @param stack
* @param amount
* @return
*/
public static ItemStack createSplitStack(ItemStack stack, int amount) {
ItemStack split = new ItemStack(stack.getItem(), amount, stack.getItemDamage());
@@ -14,12 +14,12 @@ public class EnergyManager implements IEnergyHandler {
}
private final int energyPerWork;
protected EnergyStorage energyStorage;
private final EnergyStorage energyStorage;
private EnergyTransferMode mode = EnergyTransferMode.BOTH;
public EnergyManager(int maxTransfer, int energyPerWork, int capacity) {
this.energyPerWork = scaleForDifficulty(energyPerWork);
energyStorage = new EnergyStorage(scaleForDifficulty(capacity), scaleForDifficulty(maxTransfer), scaleForDifficulty(maxTransfer));
this.energyStorage = new EnergyStorage(scaleForDifficulty(capacity), scaleForDifficulty(maxTransfer), scaleForDifficulty(maxTransfer));
}
private static int scaleForDifficulty(int energyPerUse) {
@@ -143,8 +143,6 @@ public class EnergyManager implements IEnergyHandler {
/**
* Sends as much energy as it can to the tile at orientation.
* For power sources. Ignores canExtract()
* @param orientation
* @param tile
* @return amount sent
*/
public int sendEnergy(ForgeDirection orientation, TileEntity tile) {
@@ -154,9 +152,6 @@ public class EnergyManager implements IEnergyHandler {
/**
* Sends amount of energy to the tile at orientation.
* For power sources. Ignores canExtract()
* @param orientation
* @param tile
* @param amount
* @return amount sent
*/
public int sendEnergy(ForgeDirection orientation, TileEntity tile, int amount) {
@@ -175,7 +170,6 @@ public class EnergyManager implements IEnergyHandler {
/**
* Drains an amount of energy, due to decay from lack of work or other factors
* @param amount
*/
public void drainEnergy(int amount) {
energyStorage.modifyEnergyStored(-amount);
@@ -183,7 +177,6 @@ public class EnergyManager implements IEnergyHandler {
/**
* Creates an amount of energy, generated by engines
* @param amount
*/
public void generateEnergy(int amount) {
energyStorage.modifyEnergyStored(amount);
@@ -62,13 +62,10 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
public void fromPacketPayload(PacketPayload payload) {
super.fromPacketPayload(payload);
if (payload.intPayload[3] > 0)
shutdown = true;
else
shutdown = false;
shutdown = payload.intPayload[3] > 0;
}
public FilteredTank fuelTank;
public FilteredTank heatingTank;
private final FilteredTank fuelTank;
private final FilteredTank heatingTank;
private final TankManager tankManager;
public int burnTime;
public int totalTime;
@@ -214,11 +211,7 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
}
/**
* Returns the fuel value (power per cycle) an item of the passed ItemStack
* provides
*
* @param fluid
* @return
* Returns the fuel value (power per cycle) an item of the passed fluid
*/
private int determineFuelValue(Fluid fluid) {
if (FuelManager.bronzeEngineFuel.containsKey(fluid))
@@ -228,8 +221,6 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
}
/**
*
* @param fluid
* @return Duration of burn cycle of one bucket
*/
private int determineBurnTime(Fluid fluid) {
@@ -280,10 +271,6 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
return (heatingTank.getFluidAmount() * i) / Defaults.ENGINE_TANK_CAPACITY;
}
/**
* Reads saved data
* @param nbt
*/
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
@@ -301,10 +288,6 @@ public class EngineBronze extends Engine implements ISidedInventory, ILiquidTank
}
/**
* Writes data to save
* @param nbt
*/
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
@@ -199,9 +199,6 @@ public class EngineCopper extends Engine implements ISidedInventory {
/**
* Returns the fuel value (power per cycle) an item of the passed ItemStack provides
*
* @param fuel
* @return
*/
private int determineFuelValue(ItemStack fuel) {
if (FuelManager.copperEngineFuel.containsKey(fuel))
@@ -212,9 +209,6 @@ public class EngineCopper extends Engine implements ISidedInventory {
/**
* Returns the fuel value (power per cycle) an item of the passed ItemStack provides
*
* @param fuel
* @return
*/
private int determineBurnDuration(ItemStack fuel) {
if (FuelManager.copperEngineFuel.containsKey(fuel))
@@ -275,10 +269,6 @@ public class EngineCopper extends Engine implements ISidedInventory {
}
// / LOADING AND SAVING
/**
* Reads saved data
* @param nbttagcompound
*/
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
@@ -295,10 +285,6 @@ public class EngineCopper extends Engine implements ISidedInventory {
ashProduction = nbttagcompound.getInteger("AshProduction");
}
/**
* Writes data to save
* @param nbttagcompound
*/
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
@@ -50,7 +50,7 @@ public class EngineTin extends Engine implements ISocketable, IInventory {
}
}
private final short batterySlot = 0;
private static final short batterySlot = 0;
private final InventoryAdapter sockets = new InventoryAdapter(1, "sockets");
private final EuConfig euConfig = new EuConfig(Defaults.ENGINE_TIN_EU_FOR_CYCLE, Defaults.ENGINE_TIN_ENERGY_PER_CYCLE, Defaults.ENGINE_TIN_MAX_EU_STORED);
@@ -24,17 +24,17 @@ public class ContainerEngineBronze extends ContainerLiquidTanks {
super(engine, engine);
this.engine = engine;
this.addSlot(new SlotLiquidContainer(engine, EngineBronze.SLOT_CAN, 143, 40));
this.addSlotToContainer(new SlotLiquidContainer(engine, EngineBronze.SLOT_CAN, 143, 40));
int i;
for (i = 0; i < 3; ++i) {
for (int var4 = 0; var4 < 9; ++var4) {
this.addSlot(new Slot(player, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
this.addSlotToContainer(new Slot(player, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlot(new Slot(player, i, 8 + i * 18, 142));
this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
}
}
@@ -25,21 +25,21 @@ public class ContainerEngineCopper extends ContainerForestry {
super(tile);
this.engine = tile;
this.addSlot(new Slot(tile, 0, 44, 46));
this.addSlotToContainer(new Slot(tile, 0, 44, 46));
this.addSlot(new SlotClosed(tile, 1, 98, 35));
this.addSlot(new SlotClosed(tile, 2, 98, 53));
this.addSlot(new SlotClosed(tile, 3, 116, 35));
this.addSlot(new SlotClosed(tile, 4, 116, 53));
this.addSlotToContainer(new SlotClosed(tile, 1, 98, 35));
this.addSlotToContainer(new SlotClosed(tile, 2, 98, 53));
this.addSlotToContainer(new SlotClosed(tile, 3, 116, 35));
this.addSlotToContainer(new SlotClosed(tile, 4, 116, 53));
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (int i = 0; i < 9; ++i) {
this.addSlot(new Slot(player, i, 8 + i * 18, 142));
this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
}
}
@@ -24,15 +24,15 @@ public class ContainerEngineTin extends ContainerSocketed {
super(tile, tile);
this.tile = tile;
this.addSlot(new Slot(tile, 0, 84, 53));
this.addSlotToContainer(new Slot(tile, 0, 84, 53));
int i;
for (i = 0; i < 3; ++i)
for (int j = 0; j < 9; ++j)
this.addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
for (i = 0; i < 9; ++i)
this.addSlot(new Slot(player, i, 8 + i * 18, 142));
this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
}
@Override
@@ -24,16 +24,16 @@ public class ContainerGenerator extends ContainerLiquidTanks {
super(tile, tile);
this.tile = tile;
this.addSlot(new SlotLiquidContainer(tile, MachineGenerator.SLOT_CAN, 22, 38));
this.addSlotToContainer(new SlotLiquidContainer(tile, MachineGenerator.SLOT_CAN, 22, 38));
for (int i = 0; i < 3; ++i) {
for (int var4 = 0; var4 < 9; ++var4) {
this.addSlot(new Slot(player, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
this.addSlotToContainer(new Slot(player, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
}
}
for (int i = 0; i < 9; ++i) {
this.addSlot(new Slot(player, i, 8 + i * 18, 142));
this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
}
}
@@ -30,7 +30,7 @@ public class GuiEngineBronze extends GuiEngine {
protected class BiogasSlot extends Widget {
EngineBronze engine;
private final EngineBronze engine;
public BiogasSlot(WidgetManager manager, int xPos, int yPos, EngineBronze engine) {
super(manager, xPos, yPos);
@@ -60,7 +60,7 @@ public class GuiEngineBronze extends GuiEngine {
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0F);
while (true) {
int x = 0;
int x;
if (squaled > 16) {
x = 16;
@@ -87,8 +87,7 @@ public class GuiEngineBronze extends GuiEngine {
if (fluid == null)
return StringUtil.localize("gui.empty");
String tooltip = fluid.getLocalizedName(new FluidStack(fluid, 1));
return tooltip;
return fluid.getLocalizedName(new FluidStack(fluid, 1));
}
}
@@ -137,8 +137,7 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL
}
public static Recipe findMatchingRecipe(ItemStack res, FluidStack liqu) {
for (int i = 0; i < recipes.size(); i++) {
Recipe recipe = recipes.get(i);
for (Recipe recipe : recipes) {
if (recipe.matches(res, liqu))
return recipe;
}
@@ -99,8 +99,7 @@ public class MachineMoistener extends TileBase implements ISidedInventory, ILiqu
}
public static Recipe findMatchingRecipe(ItemStack item) {
for (int i = 0; i < recipes.size(); i++) {
Recipe recipe = recipes.get(i);
for (Recipe recipe : recipes) {
if (recipe.matches(item))
return recipe;
}
@@ -46,7 +46,7 @@ public class MachineRaintank extends TileBase implements ISidedInventory, ILiqui
private static final FluidStack STACK_WATER = Fluids.WATER.get(Defaults.RAINTANK_AMOUNT_PER_UPDATE);
/* MEMBER */
public FilteredTank resourceTank;
private final FilteredTank resourceTank;
private final TankManager tankManager;
private boolean isValidBiome = true;
private int fillingTime;
@@ -337,10 +337,7 @@ public class MachineSqueezer extends TilePowered implements ISidedInventory, ILi
private boolean addProduct(FluidStack stack) {
stack.amount -= productTank.fill(stack, true);
if (stack.amount <= 0)
return true;
else
return false;
return stack.amount <= 0;
}
private boolean addRemnant(ItemStack stack) {
@@ -65,12 +65,10 @@ public class MachineStill extends TilePowered implements ISidedInventory, ILiqui
}
public boolean matches(FluidStack res) {
if (res == null && input == null)
return true;
else if (res == null || input == null)
if (res == null)
return false;
else
return input.isFluidEqual(res);
return input.isFluidEqual(res);
}
}
@@ -90,8 +88,7 @@ public class MachineStill extends TilePowered implements ISidedInventory, ILiqui
}
public static Recipe findMatchingRecipe(FluidStack item) {
for (int i = 0; i < recipes.size(); i++) {
Recipe recipe = recipes.get(i);
for (Recipe recipe : recipes) {
if (recipe.matches(item))
return recipe;
}
@@ -25,19 +25,19 @@ public class ContainerBottler extends ContainerLiquidTanks {
super(tile, tile);
this.tile = tile;
this.addSlot(new SlotLiquidContainer(tile, MachineBottler.SLOT_RESOURCE, 116, 19, true));
this.addSlot(new SlotClosed(tile, MachineBottler.SLOT_PRODUCT, 116, 55));
this.addSlot(new SlotLiquidContainer(tile, MachineBottler.SLOT_CAN, 26, 38));
this.addSlotToContainer(new SlotLiquidContainer(tile, MachineBottler.SLOT_RESOURCE, 116, 19, true));
this.addSlotToContainer(new SlotClosed(tile, MachineBottler.SLOT_PRODUCT, 116, 55));
this.addSlotToContainer(new SlotLiquidContainer(tile, MachineBottler.SLOT_CAN, 26, 38));
int var3;
for (var3 = 0; var3 < 3; ++var3) {
for (int var4 = 0; var4 < 9; ++var4) {
this.addSlot(new Slot(player, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
this.addSlotToContainer(new Slot(player, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
}
}
for (var3 = 0; var3 < 9; ++var3) {
this.addSlot(new Slot(player, var3, 8 + var3 * 18, 142));
this.addSlotToContainer(new Slot(player, var3, 8 + var3 * 18, 142));
}
}
@@ -40,7 +40,6 @@ public class ContainerCarpenter extends ContainerLiquidTanks implements IContain
}
private MachineCarpenter machine;
private final IInventory craftingInventory;
private IInventory internalInventory;
public final InventoryCraftingAuto craftMatrix;
public final InventoryCraftResult craftResult;
@@ -50,7 +49,7 @@ public class ContainerCarpenter extends ContainerLiquidTanks implements IContain
machine = tile;
machine.activeContainer = this;
craftingInventory = machine.getCraftingInventory();
internalInventory = machine.getInternalInventory();
IInventory internalInventory = machine.getInternalInventory();
craftMatrix = new InventoryCraftingAuto(this, 3, 3);
craftResult = new InventoryCraftResult();
@@ -58,36 +57,36 @@ public class ContainerCarpenter extends ContainerLiquidTanks implements IContain
// Internal inventory
for (int i = 0; i < 2; i++) {
for (int k = 0; k < 9; k++) {
addSlot(new Slot(internalInventory, MachineCarpenter.SLOT_INVENTORY_1 + k + i * 9, 8 + k * 18, 90 + i * 18));
addSlotToContainer(new Slot(internalInventory, MachineCarpenter.SLOT_INVENTORY_1 + k + i * 9, 8 + k * 18, 90 + i * 18));
}
}
// Liquid Input
this.addSlot(new SlotLiquidContainer(internalInventory, MachineCarpenter.SLOT_CAN_INPUT, 120, 20));
this.addSlotToContainer(new SlotLiquidContainer(internalInventory, MachineCarpenter.SLOT_CAN_INPUT, 120, 20));
// Boxes
this.addSlot(new SlotCrate(this, internalInventory, MachineCarpenter.SLOT_BOX, 83, 20));
this.addSlotToContainer(new SlotCrate(this, internalInventory, MachineCarpenter.SLOT_BOX, 83, 20));
// Product
this.addSlot(new SlotOutput(internalInventory, MachineCarpenter.SLOT_PRODUCT, 120, 56));
this.addSlotToContainer(new SlotOutput(internalInventory, MachineCarpenter.SLOT_PRODUCT, 120, 56));
// CraftResult display
addSlot(new SlotLocked(craftResult, 0, 80, 51));
addSlotToContainer(new SlotLocked(craftResult, 0, 80, 51));
// Crafting matrix
for (int l = 0; l < 3; l++) {
for (int k1 = 0; k1 < 3; k1++) {
addSlot(new SlotCraftMatrix(this, craftingInventory, k1 + l * 3, 10 + k1 * 18, 20 + l * 18));
addSlotToContainer(new SlotCraftMatrix(this, craftingInventory, k1 + l * 3, 10 + k1 * 18, 20 + l * 18));
}
}
// Player inventory
for (int i1 = 0; i1 < 3; i1++) {
for (int l1 = 0; l1 < 9; l1++) {
addSlot(new Slot(inventoryplayer, l1 + i1 * 9 + 9, 8 + l1 * 18, 136 + i1 * 18));
addSlotToContainer(new Slot(inventoryplayer, l1 + i1 * 9 + 9, 8 + l1 * 18, 136 + i1 * 18));
}
}
// Player hotbar
for (int j1 = 0; j1 < 9; j1++) {
addSlot(new Slot(inventoryplayer, j1, 8 + j1 * 18, 194));
addSlotToContainer(new Slot(inventoryplayer, j1, 8 + j1 * 18, 194));
}
// Update crafting matrix with current contents of tileentity.
@@ -114,12 +113,6 @@ public class ContainerCarpenter extends ContainerLiquidTanks implements IContain
updateProductSlot();
}
/**
* Replaces the original onCraftMatrixChanged
*
* @param iinventory
* @param slot
*/
@Override
public void onCraftMatrixChanged(IInventory iinventory, int slot) {
craftingInventory.setInventorySlotContents(slot, iinventory.getStackInSlot(slot));
@@ -27,20 +27,20 @@ public class ContainerCentrifuge extends ContainerForestry {
this.tile = tile;
// Resource
this.addSlot(new Slot(tile, 0, 34, 37));
this.addSlotToContainer(new Slot(tile, 0, 34, 37));
// Product Inventory
for (int l = 0; l < 3; l++)
for (int k = 0; k < 3; k++)
addSlot(new SlotClosed(tile, 1 + k + l * 3, 98 + k * 18, 19 + l * 18));
addSlotToContainer(new SlotClosed(tile, 1 + k + l * 3, 98 + k * 18, 19 + l * 18));
// Player inventory
for (int i1 = 0; i1 < 3; i1++)
for (int l1 = 0; l1 < 9; l1++)
addSlot(new Slot(player, l1 + i1 * 9 + 9, 8 + l1 * 18, 84 + i1 * 18));
addSlotToContainer(new Slot(player, l1 + i1 * 9 + 9, 8 + l1 * 18, 84 + i1 * 18));
// Player hotbar
for (int j1 = 0; j1 < 9; j1++)
addSlot(new Slot(player, j1, 8 + j1 * 18, 142));
addSlotToContainer(new Slot(player, j1, 8 + j1 * 18, 142));
}
@Override
@@ -10,46 +10,44 @@
******************************************************************************/
package forestry.factory.gui;
import forestry.core.gui.ContainerLiquidTanks;
import forestry.core.gui.slots.SlotCrafter;
import forestry.factory.gadgets.MachineFabricator;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
public class ContainerFabricator extends ContainerLiquidTanks {
import forestry.core.gui.ContainerLiquidTanks;
import forestry.core.gui.slots.SlotCrafter;
import forestry.factory.gadgets.MachineFabricator;
private final MachineFabricator tile;
public class ContainerFabricator extends ContainerLiquidTanks {
public ContainerFabricator(InventoryPlayer playerInventory, MachineFabricator tile) {
super(tile, tile);
this.tile = tile;
// Internal inventory
for (int i = 0; i < 2; i++)
for (int k = 0; k < 9; k++)
addSlot(new Slot(tile, MachineFabricator.SLOT_INVENTORY_1 + k + i * 9, 8 + k * 18, 84 + i * 18));
addSlotToContainer(new Slot(tile, MachineFabricator.SLOT_INVENTORY_1 + k + i * 9, 8 + k * 18, 84 + i * 18));
// Molten resource
this.addSlot(new Slot(tile, MachineFabricator.SLOT_METAL, 26, 21));
this.addSlotToContainer(new Slot(tile, MachineFabricator.SLOT_METAL, 26, 21));
// Plan
this.addSlot(new Slot(tile, MachineFabricator.SLOT_PLAN, 139, 17));
this.addSlotToContainer(new Slot(tile, MachineFabricator.SLOT_PLAN, 139, 17));
// Result
this.addSlot(new SlotCrafter(playerInventory.player, tile, tile, MachineFabricator.SLOT_RESULT, 139, 53));
this.addSlotToContainer(new SlotCrafter(playerInventory.player, tile, tile, MachineFabricator.SLOT_RESULT, 139, 53));
// Crafting matrix
for (int l = 0; l < 3; l++)
for (int k = 0; k < 3; k++)
addSlot(new Slot(tile, MachineFabricator.SLOT_CRAFTING_1 + k + l * 3, 67 + k * 18, 17 + l * 18));
addSlotToContainer(new Slot(tile, MachineFabricator.SLOT_CRAFTING_1 + k + l * 3, 67 + k * 18, 17 + l * 18));
// Player inventory
for (int i = 0; i < 3; i++)
for (int k = 0; k < 9; k++)
addSlot(new Slot(playerInventory, k + i * 9 + 9, 8 + k * 18, 129 + i * 18));
addSlotToContainer(new Slot(playerInventory, k + i * 9 + 9, 8 + k * 18, 129 + i * 18));
// Player hotbar
for (int j = 0; j < 9; j++)
addSlot(new Slot(playerInventory, j, 8 + j * 18, 187));
addSlotToContainer(new Slot(playerInventory, j, 8 + j * 18, 187));
}
@@ -26,20 +26,20 @@ public class ContainerFermenter extends ContainerLiquidTanks {
super(fermenter, fermenter);
this.fermenter = fermenter;
this.addSlot(new SlotCustom(fermenter, MachineFermenter.SLOT_RESOURCE, 85, 23).setExclusion(true));
this.addSlot(new SlotCustom(fermenter, MachineFermenter.SLOT_FUEL, 75, 57).setExclusion(true));
this.addSlot(new SlotOutput(fermenter, MachineFermenter.SLOT_CAN_OUTPUT, 150, 58));
this.addSlot(new SlotLiquidContainer(fermenter, MachineFermenter.SLOT_CAN_INPUT, 150, 22, true));
this.addSlot(new SlotLiquidContainer(fermenter, MachineFermenter.SLOT_INPUT, 10, 40));
this.addSlotToContainer(new SlotCustom(fermenter, MachineFermenter.SLOT_RESOURCE, 85, 23).setExclusion(true));
this.addSlotToContainer(new SlotCustom(fermenter, MachineFermenter.SLOT_FUEL, 75, 57).setExclusion(true));
this.addSlotToContainer(new SlotOutput(fermenter, MachineFermenter.SLOT_CAN_OUTPUT, 150, 58));
this.addSlotToContainer(new SlotLiquidContainer(fermenter, MachineFermenter.SLOT_CAN_INPUT, 150, 22, true));
this.addSlotToContainer(new SlotLiquidContainer(fermenter, MachineFermenter.SLOT_INPUT, 10, 40));
for (int i = 0; i < 3; ++i) {
for (int var4 = 0; var4 < 9; ++var4) {
this.addSlot(new Slot(player, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
this.addSlotToContainer(new Slot(player, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
}
}
for (int i = 0; i < 9; ++i) {
this.addSlot(new Slot(player, i, 8 + i * 18, 142));
this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
}
}
@@ -30,32 +30,32 @@ public class ContainerMoistener extends ContainerLiquidTanks implements IContain
// Stash
for (int l = 0; l < 2; l++) {
for (int k1 = 0; k1 < 3; k1++) {
addSlot(new Slot(tile, k1 + l * 3, 39 + k1 * 18, 16 + l * 18));
addSlotToContainer(new Slot(tile, k1 + l * 3, 39 + k1 * 18, 16 + l * 18));
}
}
// Reservoir
for (int k1 = 0; k1 < 3; k1++) {
addSlot(new Slot(tile, k1 + 6, 39 + k1 * 18, 22 + 36));
addSlotToContainer(new Slot(tile, k1 + 6, 39 + k1 * 18, 22 + 36));
}
// Working slot
this.addSlot(new SlotWorking(tile, 9, 105, 37));
this.addSlotToContainer(new SlotWorking(tile, 9, 105, 37));
// Product slot
this.addSlot(new Slot(tile, 10, 143, 55));
this.addSlotToContainer(new Slot(tile, 10, 143, 55));
// Boxes
this.addSlot(new SlotCraftAuto(this, tile, 11, 143, 19));
this.addSlotToContainer(new SlotCraftAuto(this, tile, 11, 143, 19));
// Player inventory
int var3;
for (var3 = 0; var3 < 3; ++var3) {
for (int var4 = 0; var4 < 9; ++var4) {
this.addSlot(new Slot(player, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
this.addSlotToContainer(new Slot(player, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
}
}
for (var3 = 0; var3 < 9; ++var3) {
this.addSlot(new Slot(player, var3, 8 + var3 * 18, 142));
this.addSlotToContainer(new Slot(player, var3, 8 + var3 * 18, 142));
}
}
@@ -19,23 +19,20 @@ import net.minecraft.inventory.Slot;
public class ContainerRaintank extends ContainerLiquidTanks {
protected MachineRaintank tile;
public ContainerRaintank(InventoryPlayer player, MachineRaintank tile) {
super(tile, tile);
this.tile = tile;
this.addSlot(new SlotLiquidContainer(tile, MachineRaintank.SLOT_RESOURCE, 116, 19, true));
this.addSlot(new SlotClosed(tile, MachineRaintank.SLOT_PRODUCT, 116, 55));
this.addSlotToContainer(new SlotLiquidContainer(tile, MachineRaintank.SLOT_RESOURCE, 116, 19, true));
this.addSlotToContainer(new SlotClosed(tile, MachineRaintank.SLOT_PRODUCT, 116, 55));
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (int i = 0; i < 9; ++i) {
this.addSlot(new Slot(player, i, 8 + i * 18, 142));
this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
}
}
@@ -10,42 +10,39 @@
******************************************************************************/
package forestry.factory.gui;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import forestry.core.gui.ContainerLiquidTanks;
import forestry.core.gui.slots.SlotClosed;
import forestry.core.gui.slots.SlotLiquidContainer;
import forestry.factory.gadgets.MachineSqueezer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
public class ContainerSqueezer extends ContainerLiquidTanks {
protected MachineSqueezer tile;
public ContainerSqueezer(InventoryPlayer player, MachineSqueezer tile) {
super(tile, tile);
this.tile = tile;
// Resource inventory
for (int l = 0; l < 3; l++)
for (int k = 0; k < 3; k++)
addSlot(new Slot(tile, k + l * 3, 19 + k * 18, 18 + l * 18));
addSlotToContainer(new Slot(tile, k + l * 3, 19 + k * 18, 18 + l * 18));
// Remnants slot
this.addSlot(new SlotClosed(tile, 9, 123, 19));
this.addSlotToContainer(new SlotClosed(tile, 9, 123, 19));
// Can slot
this.addSlot(new SlotLiquidContainer(tile, 10, 106, 55, true));
this.addSlotToContainer(new SlotLiquidContainer(tile, 10, 106, 55, true));
// Output slot
this.addSlot(new SlotClosed(tile, 11, 140, 55));
this.addSlotToContainer(new SlotClosed(tile, 11, 140, 55));
// Player inventory
for (int i1 = 0; i1 < 3; i1++)
for (int l1 = 0; l1 < 9; l1++)
addSlot(new Slot(player, l1 + i1 * 9 + 9, 8 + l1 * 18, 84 + i1 * 18));
addSlotToContainer(new Slot(player, l1 + i1 * 9 + 9, 8 + l1 * 18, 84 + i1 * 18));
// Player hotbar
for (int j1 = 0; j1 < 9; j1++)
addSlot(new Slot(player, j1, 8 + j1 * 18, 142));
addSlotToContainer(new Slot(player, j1, 8 + j1 * 18, 142));
}
}
@@ -10,32 +10,30 @@
******************************************************************************/
package forestry.factory.gui;
import forestry.core.gui.ContainerLiquidTanks;
import forestry.core.gui.slots.SlotLiquidContainer;
import forestry.factory.gadgets.MachineStill;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
public class ContainerStill extends ContainerLiquidTanks {
import forestry.core.gui.ContainerLiquidTanks;
import forestry.core.gui.slots.SlotLiquidContainer;
import forestry.factory.gadgets.MachineStill;
protected MachineStill processor;
public class ContainerStill extends ContainerLiquidTanks {
public ContainerStill(InventoryPlayer player, MachineStill tile) {
super(tile, tile);
this.processor = tile;
this.addSlot(new Slot(tile, MachineStill.SLOT_PRODUCT, 150, 54));
this.addSlot(new SlotLiquidContainer(tile, MachineStill.SLOT_RESOURCE, 150, 18, true));
this.addSlot(new SlotLiquidContainer(tile, MachineStill.SLOT_CAN, 10, 36));
this.addSlotToContainer(new Slot(tile, MachineStill.SLOT_PRODUCT, 150, 54));
this.addSlotToContainer(new SlotLiquidContainer(tile, MachineStill.SLOT_RESOURCE, 150, 18, true));
this.addSlotToContainer(new SlotLiquidContainer(tile, MachineStill.SLOT_CAN, 10, 36));
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (int i = 0; i < 9; ++i) {
this.addSlot(new Slot(player, i, 8 + i * 18, 142));
this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
}
}
@@ -10,6 +10,12 @@
******************************************************************************/
package forestry.factory.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import forestry.core.gui.ContainerForestry;
import forestry.core.gui.IGuiSelectable;
import forestry.core.gui.slots.SlotCrafter;
@@ -20,56 +26,47 @@ import forestry.core.network.PacketUpdate;
import forestry.core.proxy.Proxies;
import forestry.core.utils.StackUtils;
import forestry.factory.gadgets.TileWorktable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCraftResult;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerWorktable extends ContainerForestry implements IContainerCrafting, IGuiSelectable {
EntityPlayer player;
TileWorktable tile;
IInventory craftingInventory;
IInventory internalInventory;
InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
InventoryCraftResult craftResult = new InventoryCraftResult();
long lastUpdate;
private final EntityPlayer player;
private final TileWorktable tile;
private final InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
private long lastUpdate;
public ContainerWorktable(EntityPlayer player, TileWorktable tile) {
super(tile.getInternalInventory());
this.tile = tile;
craftingInventory = tile.getCraftingInventory();
internalInventory = tile.getInternalInventory();
IInventory craftingInventory = tile.getCraftingInventory();
IInventory internalInventory = tile.getInternalInventory();
// Internal inventory
for (int i = 0; i < 2; i++) {
for (int k = 0; k < 9; k++) {
addSlot(new Slot(internalInventory, TileWorktable.SLOT_INVENTORY_1 + k + i * 9, 8 + k * 18, 90 + i * 18));
addSlotToContainer(new Slot(internalInventory, TileWorktable.SLOT_INVENTORY_1 + k + i * 9, 8 + k * 18, 90 + i * 18));
}
}
// Crafting matrix
for (int l = 0; l < 3; l++) {
for (int k1 = 0; k1 < 3; k1++) {
addSlot(new SlotCraftMatrix(this, craftingInventory, k1 + l * 3, 11 + k1 * 18, 20 + l * 18));
addSlotToContainer(new SlotCraftMatrix(this, craftingInventory, k1 + l * 3, 11 + k1 * 18, 20 + l * 18));
}
}
// CraftResult display
addSlot(new SlotCrafter(player, craftingInventory, tile, TileWorktable.SLOT_CRAFTING_RESULT, 77, 38));
addSlotToContainer(new SlotCrafter(player, craftingInventory, tile, TileWorktable.SLOT_CRAFTING_RESULT, 77, 38));
// Player inventory
for (int i1 = 0; i1 < 3; i1++) {
for (int l1 = 0; l1 < 9; l1++) {
addSlot(new Slot(player.inventory, l1 + i1 * 9 + 9, 8 + l1 * 18, 136 + i1 * 18));
addSlotToContainer(new Slot(player.inventory, l1 + i1 * 9 + 9, 8 + l1 * 18, 136 + i1 * 18));
}
}
// Player hotbar
for (int j1 = 0; j1 < 9; j1++) {
addSlot(new Slot(player.inventory, j1, 8 + j1 * 18, 194));
addSlotToContainer(new Slot(player.inventory, j1, 8 + j1 * 18, 194));
}
// Update crafting matrix with current contents of tileentity.
@@ -106,7 +103,7 @@ public class ContainerWorktable extends ContainerForestry implements IContainerC
private void updateMatrix() {
for (int i = 0; i < craftMatrix.getSizeInventory(); i++) {
craftMatrix.setInventorySlotContents(i, craftingInventory.getStackInSlot(i));
craftMatrix.setInventorySlotContents(i, tile.getCraftingInventory().getStackInSlot(i));
}
}
@@ -14,7 +14,7 @@ import forestry.core.vect.Vect;
public class FarmTarget {
private Vect start;
private final Vect start;
private int yOffset;
private int extent;
private int limit;
@@ -182,10 +182,7 @@ public class BlockFarm extends BlockStructure {
@Override
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) {
if (world.getBlockMetadata(x, y, z) == 5)
return true;
else
return false;
return world.getBlockMetadata(x, y, z) == 5;
}
@Override
@@ -40,45 +40,45 @@ public class ContainerFarm extends ContainerSocketed {
// Resources
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
addSlot(new SlotResources(inv, tile.getFarmLogics(), TileFarmPlain.SLOT_RESOURCES_1 + j + i * 2, 123 + j * 18, 22 + i * 18));
addSlotToContainer(new SlotResources(inv, tile.getFarmLogics(), TileFarmPlain.SLOT_RESOURCES_1 + j + i * 2, 123 + j * 18, 22 + i * 18));
}
}
// Germlings
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
addSlot(new SlotGermlings(inv, tile.getFarmLogics(), TileFarmPlain.SLOT_GERMLINGS_1 + j + i * 2, 164 + j * 18, 22 + i * 18));
addSlotToContainer(new SlotGermlings(inv, tile.getFarmLogics(), TileFarmPlain.SLOT_GERMLINGS_1 + j + i * 2, 164 + j * 18, 22 + i * 18));
}
}
// Production 1
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
addSlot(new SlotOutput(inv, TileFarmPlain.SLOT_PRODUCTION_1 + j + i * 2, 123 + j * 18, 86 + i * 18));
addSlotToContainer(new SlotOutput(inv, TileFarmPlain.SLOT_PRODUCTION_1 + j + i * 2, 123 + j * 18, 86 + i * 18));
}
}
// Production 2
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
addSlot(new SlotOutput(inv, TileFarmPlain.SLOT_PRODUCTION_1 + 4 + j + i * 2, 164 + j * 18, 86 + i * 18));
addSlotToContainer(new SlotOutput(inv, TileFarmPlain.SLOT_PRODUCTION_1 + 4 + j + i * 2, 164 + j * 18, 86 + i * 18));
}
}
// Fertilizer
addSlot(new SlotCustom(inv, TileFarmPlain.SLOT_FERTILIZER, 63, 95, PluginFarming.farmFertilizer));
addSlotToContainer(new SlotCustom(inv, TileFarmPlain.SLOT_FERTILIZER, 63, 95, PluginFarming.farmFertilizer));
// Can Slot
addSlot(new SlotLiquidContainer(inv, TileFarmPlain.SLOT_CAN, 15, 95));
addSlotToContainer(new SlotLiquidContainer(inv, TileFarmPlain.SLOT_CAN, 15, 95));
// Player inventory
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlot(new Slot(playerinventory, j + i * 9 + 9, 28 + j * 18, 138 + i * 18));
addSlotToContainer(new Slot(playerinventory, j + i * 9 + 9, 28 + j * 18, 138 + i * 18));
}
}
// Player hotbar
for (int i = 0; i < 9; i++) {
addSlot(new Slot(playerinventory, i, 28 + i * 18, 196));
addSlotToContainer(new Slot(playerinventory, i, 28 + i * 18, 196));
}
}
@@ -10,18 +10,20 @@
******************************************************************************/
package forestry.farming.logic;
import forestry.api.farming.ICrop;
import forestry.core.config.Defaults;
import forestry.core.vect.Vect;
import java.util.Collection;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.farming.ICrop;
import forestry.core.config.Defaults;
import forestry.core.vect.Vect;
public abstract class Crop implements ICrop {
protected World world;
protected Vect position;
protected final World world;
protected final Vect position;
public Crop(World world, Vect position) {
this.world = world;
Loaded 100 of 141 files, more files were not shown because too many files have changed in this diff. Show more