diff --git a/lang b/lang index 4204c1c2b..6a0217f4a 160000 --- a/lang +++ b/lang @@ -1 +1 @@ -Subproject commit 4204c1c2bbc668447f0914f79469d390e730637e +Subproject commit 6a0217f4ae1594a1e82ca61303242b1161cdd724 diff --git a/src/main/java/forestry/factory/gadgets/TileWorktable.java b/src/main/java/forestry/factory/gadgets/TileWorktable.java index a507e0b5c..6ae55cde3 100755 --- a/src/main/java/forestry/factory/gadgets/TileWorktable.java +++ b/src/main/java/forestry/factory/gadgets/TileWorktable.java @@ -193,6 +193,7 @@ public class TileWorktable extends TileBase implements ICrafter { private LinkedList recipes = new LinkedList(); private long lastUpdate; + public final int capacity = 9; public long getLastUpdate() { return lastUpdate; @@ -204,10 +205,13 @@ public class TileWorktable extends TileBase implements ICrafter { recipe.updateLastUse(world); Recipe memory = getMemorized(crafting, world); - if (memory != null) - recipes.remove(memory); + if (memory != null) { + int index = recipes.indexOf(memory); + recipes.set(index, recipe); + return; + } - if (recipes.size() < 8) { + if (recipes.size() < capacity) { recipes.add(recipe); return; } @@ -413,7 +417,7 @@ public class TileWorktable extends TileBase implements ICrafter { } public void chooseRecipe(int recipeIndex) { - if (recipeIndex == 9) { + if (recipeIndex >= memorized.capacity) { for (int slot = 0; slot < craftingInventory.getSizeInventory(); slot++) { craftingInventory.setInventorySlotContents(slot, null); } diff --git a/src/main/java/forestry/factory/gui/ContainerWorktable.java b/src/main/java/forestry/factory/gui/ContainerWorktable.java index 15d74c5a1..62a190aec 100755 --- a/src/main/java/forestry/factory/gui/ContainerWorktable.java +++ b/src/main/java/forestry/factory/gui/ContainerWorktable.java @@ -115,6 +115,10 @@ public class ContainerWorktable extends ContainerForestry implements IContainerC tile.setRecipe(craftMatrix); } + public void clearRecipe() { + sendRecipeClick(0, tile.getMemory().capacity); + } + public void sendRecipeClick(int mouseButton, int recipeIndex) { PacketPayload payload = new PacketPayload(2, 0, 0); payload.intPayload[0] = mouseButton; diff --git a/src/main/java/forestry/factory/gui/GuiWorktable.java b/src/main/java/forestry/factory/gui/GuiWorktable.java index e14044014..b1b8495d7 100755 --- a/src/main/java/forestry/factory/gui/GuiWorktable.java +++ b/src/main/java/forestry/factory/gui/GuiWorktable.java @@ -82,36 +82,21 @@ public class GuiWorktable extends GuiForestryTitled { } } - private class BookSlot extends Widget { + private class ClearWorktable extends Widget { - private final ItemStack BOOK = new ItemStack(Items.book); - - public BookSlot(WidgetManager manager, int xPos, int yPos) { + public ClearWorktable(WidgetManager manager, int xPos, int yPos) { super(manager, xPos, yPos); + width = 7; + height = 7; } @Override public void draw(int startX, int startY) { - GL11.glPushAttrib(GL11.GL_ENABLE_BIT); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_DEPTH_TEST); - RenderHelper.enableGUIStandardItemLighting(); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - manager.gui.drawItemStack(BOOK, startX + xPos, startY + yPos); - - GL11.glPopAttrib(); - } - - @Override - protected String getLegacyTooltip(EntityPlayer player) { - return StringUtil.localize("gui.worktable.clear"); } @Override public void handleMouseClick(int mouseX, int mouseY, int mouseButton) { - container.sendRecipeClick(mouseButton, 9); + container.clearRecipe(); } } private final TileWorktable worktable; @@ -125,18 +110,18 @@ public class GuiWorktable extends GuiForestryTitled { this.tile = tile; container = (ContainerWorktable) inventorySlots; - widgetManager.add(new BookSlot(widgetManager, 128, 38)); + final int spacing = 18; + int slot = 0; + for (int y = 0; y < 3; y++) { + int yPos = 20 + (y * spacing); + for (int x = 0; x < 3; x++) { + int xPos = 110 + (x * spacing); + widgetManager.add(new MemorizedSlot(widgetManager, xPos, yPos, slot)); + slot += 1; + } + } - widgetManager.add(new MemorizedSlot(widgetManager, 146, 20, 0)); - widgetManager.add(new MemorizedSlot(widgetManager, 146, 38, 1)); - widgetManager.add(new MemorizedSlot(widgetManager, 146, 56, 2)); - - widgetManager.add(new MemorizedSlot(widgetManager, 128, 56, 3)); - widgetManager.add(new MemorizedSlot(widgetManager, 110, 56, 4)); - - widgetManager.add(new MemorizedSlot(widgetManager, 110, 38, 5)); - widgetManager.add(new MemorizedSlot(widgetManager, 110, 20, 6)); - widgetManager.add(new MemorizedSlot(widgetManager, 128, 20, 7)); + widgetManager.add(new ClearWorktable(widgetManager, 66, 19)); } } diff --git a/src/main/resources/assets/forestry/textures/gui/worktable.png b/src/main/resources/assets/forestry/textures/gui/worktable.png index dd59d8ff0..48d18d27e 100755 Binary files a/src/main/resources/assets/forestry/textures/gui/worktable.png and b/src/main/resources/assets/forestry/textures/gui/worktable.png differ