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

@@ -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;
@@ -19,8 +19,8 @@ import net.minecraft.world.World;
public class CropBlock extends Crop {
Block block;
int meta;
protected final Block block;
protected final int meta;
public CropBlock(World world, Block block, int meta, Vect position) {
super(world, position);
@@ -23,7 +23,7 @@ import net.minecraft.world.World;
public class CropFruit extends Crop {
IFruitFamily family;
private final IFruitFamily family;
public CropFruit(World world, Vect position, IFruitFamily family) {
super(world, position);
@@ -31,11 +31,11 @@ import forestry.core.vect.Vect;
public abstract class FarmLogic implements IFarmLogic {
IFarmHousing housing;
protected final IFarmHousing housing;
boolean isManual;
protected boolean isManual;
static HashSet<Block> breakable = new HashSet<Block>();
private static final HashSet<Block> breakable = new HashSet<Block>();
public FarmLogic(IFarmHousing housing) {
this.housing = housing;
@@ -127,8 +127,6 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous {
@Override
public Collection<ICrop> harvest(int x, int y, int z, ForgeDirection direction, int extent) {
Collection<ICrop> crops = null;
Vect start = new Vect(x, y, z);
if (!lastExtentsHarvest.containsKey(start))
lastExtentsHarvest.put(start, 0);
@@ -138,7 +136,7 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous {
lastExtent = 0;
Vect position = translateWithOffset(x, y + 1, z, direction, lastExtent);
crops = getHarvestBlocks(position);
Collection<ICrop> crops = getHarvestBlocks(position);
lastExtent++;
lastExtentsHarvest.put(start, lastExtent);
@@ -102,8 +102,6 @@ public class FarmLogicCocoa extends FarmLogic {
@Override
public Collection<ICrop> harvest(int x, int y, int z, ForgeDirection direction, int extent) {
Collection<ICrop> crops = null;
Vect start = new Vect(x, y, z);
if (!lastExtentsHarvest.containsKey(start))
lastExtentsHarvest.put(start, 0);
@@ -113,7 +111,7 @@ public class FarmLogicCocoa extends FarmLogic {
lastExtent = 0;
Vect position = translateWithOffset(x, y + 1, z, direction, lastExtent);
crops = getHarvestBlocks(position);
Collection<ICrop> crops = getHarvestBlocks(position);
lastExtent++;
lastExtentsHarvest.put(start, lastExtent);
@@ -33,7 +33,7 @@ import net.minecraftforge.common.util.ForgeDirection;
public abstract class FarmLogicCrops extends FarmLogicWatered {
private final IFarmable[] seeds;
private static ItemStack farmland = new ItemStack(Blocks.farmland, 1, Defaults.WILDCARD);
private static final ItemStack farmland = new ItemStack(Blocks.farmland, 1, Defaults.WILDCARD);
public FarmLogicCrops(IFarmHousing housing, IFarmable[] seeds) {
super(housing,
@@ -82,8 +82,6 @@ public class FarmLogicOrchard extends FarmLogic {
@Override
public Collection<ICrop> harvest(int x, int y, int z, ForgeDirection direction, int extent) {
Collection<ICrop> crops = null;
Vect start = new Vect(x, y, z);
if (!lastExtents.containsKey(start))
lastExtents.put(start, 0);
@@ -95,7 +93,7 @@ public class FarmLogicOrchard extends FarmLogic {
// Proxies.log.finest("Logic %s is searching in direction %s at %s/%s/%s with extension %s.", getClass(), direction, x, y, z, lastExtent);
Vect position = translateWithOffset(x, y + 1, z, direction, lastExtent);
crops = getHarvestBlocks(position);
Collection<ICrop> crops = getHarvestBlocks(position);
lastExtent++;
lastExtents.put(start, lastExtent);
@@ -29,7 +29,7 @@ import net.minecraftforge.common.util.ForgeDirection;
public class FarmLogicPoale extends FarmLogic {
IFarmable[] germlings;
private final IFarmable[] germlings;
public FarmLogicPoale(IFarmHousing housing) {
super(housing);
@@ -94,7 +94,6 @@ public class FarmLogicRubber extends FarmLogic {
if (inActive)
return null;
Collection<ICrop> crops = null;
Vect start = new Vect(x, y, z);
if (!lastExtents.containsKey(start))
lastExtents.put(start, 0);
@@ -104,7 +103,7 @@ public class FarmLogicRubber extends FarmLogic {
lastExtent = 0;
Vect position = translateWithOffset(x, y + 1, z, direction, lastExtent);
crops = getHarvestBlocks(position);
Collection<ICrop> crops = getHarvestBlocks(position);
lastExtent++;
lastExtents.put(start, lastExtent);
@@ -29,7 +29,7 @@ import net.minecraftforge.common.util.ForgeDirection;
public class FarmLogicSucculent extends FarmLogic {
IFarmable[] germlings;
private final IFarmable[] germlings;
public FarmLogicSucculent(IFarmHousing housing) {
super(housing);
@@ -27,7 +27,7 @@ import net.minecraftforge.fluids.FluidStack;
public abstract class FarmLogicWatered extends FarmLogic {
protected ItemStack ground;
protected final ItemStack ground;
private final ItemStack[] resource;
private static final FluidStack STACK_WATER = Fluids.WATER.get(1000);
@@ -39,10 +39,7 @@ public class FarmableFarmCraftory implements IFarmable {
return false;
Block block = world.getBlock(x, y, z);
if (block != PluginFarmCraftory.blockSingle && block != PluginFarmCraftory.blockMulti)
return false;
else
return true;
return block == PluginFarmCraftory.blockSingle || block == PluginFarmCraftory.blockMulti;
}
@Override
@@ -32,14 +32,7 @@ public class FarmableGenericCrop implements IFarmable {
@Override
public boolean isSaplingAt(World world, int x, int y, int z) {
if (world.isAirBlock(x, y, z))
return false;
if (world.getBlock(x, y, z) != block)
return false;
else
return true;
return world.getBlock(x, y, z) == block;
}
@Override
@@ -21,10 +21,9 @@ import net.minecraft.world.World;
public class FarmableGenericSapling implements IFarmable {
final Block sapling;
final int saplingMeta;
ItemStack[] windfall;
private final Block sapling;
private final int saplingMeta;
private final ItemStack[] windfall;
public FarmableGenericSapling(Block sapling, int saplingMeta, ItemStack... windfall) {
this.sapling = sapling;
@@ -10,20 +10,21 @@
******************************************************************************/
package forestry.farming.logic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmable;
import forestry.core.config.Defaults;
import forestry.core.utils.StackUtils;
import forestry.core.vect.Vect;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class FarmableGourd implements IFarmable {
public ItemStack seed;
public ItemStack stem;
public ItemStack fruit;
private final ItemStack seed;
private final ItemStack stem;
private final ItemStack fruit;
public FarmableGourd(ItemStack seed, ItemStack stem, ItemStack fruit) {
this.seed = seed;
@@ -36,10 +37,7 @@ public class FarmableGourd implements IFarmable {
if (world.isAirBlock(x, y, z))
return false;
if (!StackUtils.equals(world.getBlock(x, y, z), stem))
return false;
return true;
return StackUtils.equals(world.getBlock(x, y, z), stem);
}
@Override
@@ -22,8 +22,8 @@ import net.minecraft.world.World;
public class FarmableStacked implements IFarmable {
Block block;
int matureHeight;
private final Block block;
private final int matureHeight;
public FarmableStacked(Block block, int matureHeight) {
this.block = block;