Added output slots to farming station

* Added 2 output slots to farming station to prevent overflow from
shearing leaves
* Resized GUI to make space
* Solves #2096
This commit is contained in:
HenryLoenwind committed 2015-03-18 21:58:16 +01:00
1 parent 32bb6fb41e
commit d7a3b347b8
4 files changed
+88 -36

No files matched your search

@@ -9,6 +9,18 @@ import crazypants.enderio.machine.gui.AbstractMachineContainer;
public class FarmStationContainer extends AbstractMachineContainer {
private static final int ROW_TOOLS = 19;
private static final int ROW_IO = 44;
private static final int COL_TOOLS = 44;
private static final int COL_INPUT = 53;
private static final int COL_OUTPUT = 116;
private static final int SLOT_SIZE = 18;
private static final int ONE = 0 * SLOT_SIZE;
private static final int TWO = 1 * SLOT_SIZE;
private static final int THREE = 2 * SLOT_SIZE;
public FarmStationContainer(InventoryPlayer inventory, TileFarmStation te) {
super(inventory,te);
}
@@ -17,19 +29,21 @@ public class FarmStationContainer extends AbstractMachineContainer {
protected void addMachineSlots(InventoryPlayer playerInv) {
Point[] points = new Point[] {
new Point(44, 12),
new Point(62, 12),
new Point(80, 12),
new Point(COL_TOOLS + ONE, ROW_TOOLS),
new Point(COL_TOOLS + TWO, ROW_TOOLS),
new Point(COL_TOOLS + THREE, ROW_TOOLS),
new Point(53, 37),
new Point(71, 37),
new Point(53, 55),
new Point(71, 55),
new Point(COL_INPUT + ONE, ROW_IO + ONE),
new Point(COL_INPUT + TWO, ROW_IO + ONE),
new Point(COL_INPUT + ONE, ROW_IO + TWO),
new Point(COL_INPUT + TWO, ROW_IO + TWO),
new Point(116, 37),
new Point(134, 37),
new Point(116, 55),
new Point(134, 55),
new Point(COL_OUTPUT + ONE, ROW_IO + ONE),
new Point(COL_OUTPUT + TWO, ROW_IO + ONE),
new Point(COL_OUTPUT + THREE, ROW_IO + ONE),
new Point(COL_OUTPUT + ONE, ROW_IO + TWO),
new Point(COL_OUTPUT + TWO, ROW_IO + TWO),
new Point(COL_OUTPUT + THREE, ROW_IO + TWO),
};
int i=0;
@@ -55,4 +69,14 @@ public class FarmStationContainer extends AbstractMachineContainer {
}
@Override
public Point getPlayerInventoryOffset() {
return new Point(8,87);
}
@Override
public Point getUpgradeOffset() {
return new Point(12,63);
}
}
@@ -31,7 +31,7 @@ public class GuiFarmStation extends GuiPoweredMachineBase<TileFarmStation> {
super.initGui();
int x = getGuiLeft() + 36;
int y = getGuiTop() + 36;
int y = getGuiTop() + 43;
buttonList.add(createLockButton(TileFarmStation.minSupSlot + 0, x, y));
buttonList.add(createLockButton(TileFarmStation.minSupSlot + 1, x + 52, y));
@@ -70,10 +70,10 @@ public class GuiFarmStation extends GuiPoweredMachineBase<TileFarmStation> {
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
GL11.glEnable(GL11.GL_BLEND);
fr.drawString("SW", sx + 55, sy + 41, ColorUtil.getARGB(1f,1f,0.35f,1f), true);
fr.drawString("NW", sx + 55, sy + 59, ColorUtil.getARGB(1f,1f,0.35f,1f), true);
fr.drawString("SE", sx + 73, sy + 41, ColorUtil.getARGB(1f,1f,0.35f,1f), true);
fr.drawString("NE", sx + 73, sy + 59, ColorUtil.getARGB(1f,1f,0.35f,1f), true);
fr.drawString("SW", sx + 55, sy + 48, ColorUtil.getARGB(1f,1f,0.35f,1f), true);
fr.drawString("NW", sx + 55, sy + 66, ColorUtil.getARGB(1f,1f,0.35f,1f), true);
fr.drawString("SE", sx + 73, sy + 48, ColorUtil.getARGB(1f,1f,0.35f,1f), true);
fr.drawString("NE", sx + 73, sy + 66, ColorUtil.getARGB(1f,1f,0.35f,1f), true);
GL11.glDisable(GL11.GL_BLEND);
RenderUtil.bindTexture("enderio:textures/gui/farmStation.png");
@@ -97,4 +97,10 @@ public class GuiFarmStation extends GuiPoweredMachineBase<TileFarmStation> {
protected String getPowerOutputLabel() {
return Lang.localize("farm.gui.baseUse");
}
@Override
protected int getPowerHeight() {
return super.getPowerHeight() + 3;
}
}
@@ -49,12 +49,24 @@ public class TileFarmStation extends AbstractPoweredTaskEntity {
}
},
AXE { @Override
boolean match(ItemStack item) { return item.getItem().getHarvestLevel(item, "axe") >= 0; }},
TREETAP { @Override
boolean match(ItemStack item) { return item.getItem().getClass() == RubberTreeFarmerIC2.treeTap; }},
SHEARS { @Override
boolean match(ItemStack item) { return item.getItem() instanceof ItemShears; }};
AXE {
@Override
boolean match(ItemStack item) {
return item.getItem().getHarvestLevel(item, "axe") >= 0;
}
},
TREETAP {
@Override
boolean match(ItemStack item) {
return item.getItem().getClass() == RubberTreeFarmerIC2.treeTap;
}
},
SHEARS {
@Override
boolean match(ItemStack item) {
return item.getItem() instanceof ItemShears;
}
};
public final boolean itemMatches(ItemStack item) {
if (item == null) {
@@ -99,11 +111,11 @@ public class TileFarmStation extends AbstractPoweredTaskEntity {
public String notification = "";
public boolean sendNotification = false;
private boolean wasActive;
public TileFarmStation() {
super(new SlotDefinition(7, 4, 1));
super(new SlotDefinition(7, 6, 1));
}
public int getFarmSize() {
@@ -306,19 +318,19 @@ public class TileFarmStation extends AbstractPoweredTaskEntity {
return false;
}
if(i <= maxToolSlot) {
if (ToolType.isTool(stack)) {
int otherSlot = i == minToolSlot ? maxToolSlot : minToolSlot;
if (inventory[otherSlot] == null) {
return true;
} else { // let's make sure there's not one of this type in here already
for (ToolType type : ToolType.values()) {
if (type.itemMatches(inventory[otherSlot]) && type.itemMatches(stack)) {
return false;
}
if (ToolType.isTool(stack)) {
int otherSlot = i == minToolSlot ? maxToolSlot : minToolSlot;
if (inventory[otherSlot] == null) {
return true;
} else { // let's make sure there's not one of this type in here already
for (ToolType type : ToolType.values()) {
if (type.itemMatches(inventory[otherSlot]) && type.itemMatches(stack)) {
return false;
}
return true;
}
return true;
}
}
return false;
}
return (inventory[i] != null || !isSlotLocked(i)) && FarmersCommune.instance.canPlant(stack);
@@ -643,13 +655,23 @@ public class TileFarmStation extends AbstractPoweredTaskEntity {
}
int slotLayoutVersion = nbtRoot.getInteger("slotLayoutVersion");
if (slotLayoutVersion < 1) {
for (int i = inventory.length - 2; i >= 2; i--) {
// update from v0 (2+4+4+1) to v1 (3+4+4+1) by moving in+out+cap one back
for (int i = (3+4+4+1) - 2; i >= 2; i--) {
if (inventory[i+1] == null) {
// Should always be true, but better safe than deleting items
inventory[i+1] = inventory[i];
inventory[i] = null;
}
}
slotLayoutVersion = 1;
}
if (slotLayoutVersion < 2) {
// update from v1 (3+4+4+1) to v2 (3+4+6+1) by moving cap to new position
if (inventory[(3+4+6+1)-1] == null) {
inventory[(3+4+6+1)-1] = inventory[(3+4+4+1)-1];
inventory[(3+4+4+1)-3] = null;
}
slotLayoutVersion = 2;
}
}
@@ -673,7 +695,7 @@ public class TileFarmStation extends AbstractPoweredTaskEntity {
}
nbtRoot.setIntArray("lockedSlots", locked);
}
nbtRoot.setInteger("slotLayoutVersion", 1);
nbtRoot.setInteger("slotLayoutVersion", 2);
}
}