From 4d320d40ae7bcc9514a8e54c8931ebf8e45ef565 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Sun, 22 Jul 2018 19:11:01 +0200 Subject: [PATCH] Clean up amount specifying GUIs. --- .../container/ContainerBase.java | 4 +- .../gui/GuiAmountSpecifying.java | 188 ++++++++++++++++ .../refinedstorage/gui/GuiPriority.java | 31 ++- .../gui/grid/GuiCraftingStart.java | 210 ------------------ .../refinedstorage/gui/grid/GuiGrid.java | 2 +- .../gui/grid/GuiGridCraftingSettings.java | 77 +++++++ .../GuiGridPatternFluidAmount.java} | 36 +-- .../MessageGridCraftingPreviewResponse.java | 6 +- .../MessageGridCraftingStartResponse.java | 6 +- .../textures/gui/crafting_settings.png | Bin 1768 -> 1769 bytes 10 files changed, 310 insertions(+), 250 deletions(-) create mode 100644 src/main/java/com/raoulvdberge/refinedstorage/gui/GuiAmountSpecifying.java delete mode 100755 src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiCraftingStart.java create mode 100644 src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGridCraftingSettings.java rename src/main/java/com/raoulvdberge/refinedstorage/gui/{GuiFluidAmount.java => grid/GuiGridPatternFluidAmount.java} (67%) diff --git a/src/main/java/com/raoulvdberge/refinedstorage/container/ContainerBase.java b/src/main/java/com/raoulvdberge/refinedstorage/container/ContainerBase.java index cacc6b860..c5e11e8cc 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/container/ContainerBase.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/container/ContainerBase.java @@ -3,7 +3,7 @@ package com.raoulvdberge.refinedstorage.container; import com.raoulvdberge.refinedstorage.apiimpl.API; import com.raoulvdberge.refinedstorage.container.slot.*; import com.raoulvdberge.refinedstorage.gui.GuiBase; -import com.raoulvdberge.refinedstorage.gui.GuiFluidAmount; +import com.raoulvdberge.refinedstorage.gui.grid.GuiGridPatternFluidAmount; import com.raoulvdberge.refinedstorage.tile.TileBase; import com.raoulvdberge.refinedstorage.tile.config.IType; import com.raoulvdberge.refinedstorage.tile.data.TileDataWatcher; @@ -92,7 +92,7 @@ public abstract class ContainerBase extends Container { } else if (slot.getHasStack()) { if (slot instanceof SlotFilterType && ((SlotFilterType) slot).getType().getType() == IType.FLUIDS) { if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { - FMLClientHandler.instance().showGuiScreen(new GuiFluidAmount((GuiBase) Minecraft.getMinecraft().currentScreen, player, slot.getSlotIndex(), ((SlotFilterType) slot).getActualStack())); + FMLClientHandler.instance().showGuiScreen(new GuiGridPatternFluidAmount((GuiBase) Minecraft.getMinecraft().currentScreen, player, slot.getSlotIndex(), ((SlotFilterType) slot).getActualStack())); } } else { slot.getStack().setCount(((SlotFilter) slot).getAmountModified(dragType)); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiAmountSpecifying.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiAmountSpecifying.java new file mode 100644 index 000000000..354c6b76a --- /dev/null +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiAmountSpecifying.java @@ -0,0 +1,188 @@ +package com.raoulvdberge.refinedstorage.gui; + +import com.google.common.primitives.Ints; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.inventory.Container; +import net.minecraftforge.fml.client.FMLClientHandler; +import org.apache.commons.lang3.tuple.Pair; +import org.lwjgl.input.Keyboard; + +import java.io.IOException; + +public abstract class GuiAmountSpecifying extends GuiBase { + protected GuiTextField amountField; + + private GuiBase parent; + + protected GuiButton okButton; + private GuiButton cancelButton; + + private GuiButton[] incrementButtons = new GuiButton[6]; + + public GuiAmountSpecifying(GuiBase parent, Container container, int width, int height) { + super(container, width, height); + + this.parent = parent; + } + + protected abstract String getOkButtonText(); + + protected abstract String getTitle(); + + protected abstract String getTexture(); + + protected abstract int[] getIncrements(); + + protected abstract int getDefaultAmount(); + + protected abstract boolean canAmountGoNegative(); + + protected abstract int getMaxAmount(); + + protected Pair getAmountPos() { + return Pair.of(7 + 2, 50 + 1); + } + + protected Pair getOkCancelPos() { + return Pair.of(114, 33); + } + + @Override + public void init(int x, int y) { + Pair pos = getOkCancelPos(); + + okButton = addButton(x + pos.getLeft(), y + pos.getRight(), 50, 20, getOkButtonText()); + cancelButton = addButton(x + pos.getLeft(), y + pos.getRight() + 24, 50, 20, t("gui.cancel")); + + amountField = new GuiTextField(0, fontRenderer, x + getAmountPos().getLeft(), y + getAmountPos().getRight(), 69 - 6, fontRenderer.FONT_HEIGHT); + amountField.setEnableBackgroundDrawing(false); + amountField.setVisible(true); + amountField.setText(String.valueOf(getDefaultAmount())); + amountField.setTextColor(16777215); + amountField.setCanLoseFocus(false); + amountField.setFocused(true); + + int[] increments = getIncrements(); + + int xx = 7; + int width = 30; + + for (int i = 0; i < 3; ++i) { + String text = "+" + increments[i]; + + if (text.equals("+1000")) { + text = "+1B"; + } + + incrementButtons[i] = addButton(x + xx, y + 20, width, 20, text); + + xx += width + 3; + } + + xx = 7; + + for (int i = 0; i < 3; ++i) { + String text = "-" + increments[i]; + + if (text.equals("-1000")) { + text = "-1B"; + } + + incrementButtons[3 + i] = addButton(x + xx, y + screenHeight - 20 - 7, width, 20, text); + + xx += width + 3; + } + } + + @Override + public void update(int x, int y) { + // NO OP + } + + @Override + public void drawBackground(int x, int y, int mouseX, int mouseY) { + bindTexture(getTexture()); + + drawTexture(x, y, 0, 0, screenWidth, screenHeight); + + amountField.drawTextBox(); + } + + @Override + public void drawForeground(int mouseX, int mouseY) { + drawString(7, 7, getTitle()); + } + + @Override + protected void keyTyped(char character, int keyCode) throws IOException { + if (!checkHotbarKeys(keyCode) && amountField.textboxKeyTyped(character, keyCode)) { + // NO OP + } else { + if (keyCode == Keyboard.KEY_RETURN) { + onOkButtonPressed(isShiftKeyDown()); + } else if (keyCode == Keyboard.KEY_ESCAPE) { + close(); + } else { + super.keyTyped(character, keyCode); + } + } + } + + @Override + protected void actionPerformed(GuiButton button) throws IOException { + super.actionPerformed(button); + + if (button.id == okButton.id) { + onOkButtonPressed(isShiftKeyDown()); + } else if (button.id == cancelButton.id) { + close(); + } else { + for (GuiButton incrementButton : incrementButtons) { + if (incrementButton.id == button.id) { + Integer oldAmount = Ints.tryParse(amountField.getText()); + + if (oldAmount == null) { + oldAmount = 0; + } + + String incrementButtonText = incrementButton.displayString; + + if (incrementButtonText.equals("+1B")) { + incrementButtonText = "1000"; + } else if (incrementButtonText.equals("-1B")) { + incrementButtonText = "-1000"; + } + + int newAmount = Integer.parseInt(incrementButtonText); + + if (!canAmountGoNegative()) { + newAmount = Math.max(1, ((oldAmount == 1 && newAmount != 1) ? 0 : oldAmount) + newAmount); + } else { + newAmount = oldAmount + newAmount; + } + + if (newAmount > getMaxAmount()) { + newAmount = getMaxAmount(); + } + + amountField.setText(String.valueOf(newAmount)); + + break; + } + } + } + } + + protected void onOkButtonPressed(boolean shiftDown) { + // NO OP + } + + public void close() { + FMLClientHandler.instance().showGuiScreen(parent); + } + + public GuiBase getParent() { + return parent; + } +} diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiPriority.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiPriority.java index 34ccabc5c..3cb7edbed 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiPriority.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiPriority.java @@ -1,18 +1,17 @@ package com.raoulvdberge.refinedstorage.gui; import com.google.common.primitives.Ints; -import com.raoulvdberge.refinedstorage.gui.grid.GuiCraftingStart; import com.raoulvdberge.refinedstorage.tile.data.TileDataManager; import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; -import net.minecraft.util.Tuple; +import org.apache.commons.lang3.tuple.Pair; -public class GuiPriority extends GuiCraftingStart { +public class GuiPriority extends GuiAmountSpecifying { private TileDataParameter priority; public GuiPriority(GuiBase parent, TileDataParameter priority) { - super(parent, null, new Container() { + super(parent, new Container() { @Override public boolean canInteractWith(EntityPlayer player) { return false; @@ -23,12 +22,12 @@ public class GuiPriority extends GuiCraftingStart { } @Override - protected int getAmount() { + protected int getDefaultAmount() { return priority.getValue(); } @Override - protected String getStartButtonText() { + protected String getOkButtonText() { return t("misc.refinedstorage:set"); } @@ -43,18 +42,13 @@ public class GuiPriority extends GuiCraftingStart { } @Override - protected Tuple getAmountPos() { - return new Tuple<>(18 + 1, 47 + 1); + protected Pair getAmountPos() { + return Pair.of(18 + 1, 47 + 1); } @Override - protected Tuple getIncrementButtonPos(int x, int y) { - return new Tuple<>(6 + (x * (30 + 3)), y + (y == 0 ? 20 : 64)); - } - - @Override - protected Tuple getStartCancelPos() { - return new Tuple<>(107, 30); + protected Pair getOkCancelPos() { + return Pair.of(107, 30); } @Override @@ -62,6 +56,11 @@ public class GuiPriority extends GuiCraftingStart { return true; } + @Override + protected int getMaxAmount() { + return Integer.MAX_VALUE; + } + @Override protected int[] getIncrements() { return new int[]{ @@ -71,7 +70,7 @@ public class GuiPriority extends GuiCraftingStart { } @Override - protected void startRequest(boolean noPreview) { + protected void onOkButtonPressed(boolean noPreview) { Integer amount = Ints.tryParse(amountField.getText()); if (amount != null) { diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiCraftingStart.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiCraftingStart.java deleted file mode 100755 index 00eba4e75..000000000 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiCraftingStart.java +++ /dev/null @@ -1,210 +0,0 @@ -package com.raoulvdberge.refinedstorage.gui.grid; - -import com.google.common.primitives.Ints; -import com.raoulvdberge.refinedstorage.RS; -import com.raoulvdberge.refinedstorage.container.ContainerCraftingSettings; -import com.raoulvdberge.refinedstorage.gui.GuiBase; -import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackFluid; -import com.raoulvdberge.refinedstorage.gui.grid.stack.IGridStack; -import com.raoulvdberge.refinedstorage.network.MessageGridCraftingPreview; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiTextField; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.util.Tuple; -import net.minecraftforge.fml.client.FMLClientHandler; -import org.lwjgl.input.Keyboard; - -import java.io.IOException; - -// TODO: Change quantities for fluid craft. -// TODO: Cleanup childclasses. -public class GuiCraftingStart extends GuiBase { - private static final int DEFAULT_AMOUNT = 1; - - protected GuiTextField amountField; - private GuiBase parent; - private IGridStack stack; - private GuiButton startButton; - private GuiButton cancelButton; - private GuiButton[] incrementButtons = new GuiButton[6]; - - public GuiCraftingStart(GuiBase parent, IGridStack stack, Container container, int w, int h) { - super(container, w, h); - - this.parent = parent; - this.stack = stack; - } - - public GuiCraftingStart(GuiGrid parent, EntityPlayer player, IGridStack stack) { - this(parent, stack, new ContainerCraftingSettings(player, stack), 172, 99); - } - - protected String getStartButtonText() { - return t("misc.refinedstorage:start"); - } - - protected String getTitle() { - return t("container.crafting"); - } - - protected String getTexture() { - return "gui/crafting_settings.png"; - } - - protected int[] getIncrements() { - if (stack instanceof GridStackFluid) { - return new int[]{ - 1, 500, 1000, - -1, -500, -1000 - }; - } else { - return new int[]{ - 1, 10, 64, - -1, -10, -64 - }; - } - } - - protected int getAmount() { - return stack instanceof GridStackFluid ? 1000 : DEFAULT_AMOUNT; - } - - protected Tuple getAmountPos() { - return new Tuple<>(7 + 1, 50 + 1); - } - - protected Tuple getIncrementButtonPos(int x, int y) { - return new Tuple<>(6 + (x * (30 + 3)), y + (y == 0 ? 20 : 72)); - } - - protected Tuple getStartCancelPos() { - return new Tuple<>(114, 33); - } - - protected boolean canAmountGoNegative() { - return false; - } - - @Override - public void init(int x, int y) { - Tuple pos = getStartCancelPos(); - - startButton = addButton(x + pos.getFirst(), y + pos.getSecond(), 50, 20, getStartButtonText()); - cancelButton = addButton(x + pos.getFirst(), y + pos.getSecond() + 24, 50, 20, t("gui.cancel")); - - amountField = new GuiTextField(0, fontRenderer, x + getAmountPos().getFirst(), y + getAmountPos().getSecond(), 69 - 6, fontRenderer.FONT_HEIGHT); - amountField.setEnableBackgroundDrawing(false); - amountField.setVisible(true); - amountField.setText(String.valueOf(getAmount())); - amountField.setTextColor(16777215); - amountField.setCanLoseFocus(false); - amountField.setFocused(true); - - int[] increments = getIncrements(); - - for (int i = 0; i < 3; ++i) { - pos = getIncrementButtonPos(i, 0); - - incrementButtons[i] = addButton(x + pos.getFirst(), y + pos.getSecond(), 30, 20, "+" + increments[i]); - } - - for (int i = 0; i < 3; ++i) { - pos = getIncrementButtonPos(i, 1); - - incrementButtons[3 + i] = addButton(x + pos.getFirst(), y + pos.getSecond(), 30, 20, String.valueOf(increments[3 + i])); - } - } - - @Override - public void update(int x, int y) { - } - - @Override - public void drawBackground(int x, int y, int mouseX, int mouseY) { - bindTexture(getTexture()); - - drawTexture(x, y, 0, 0, screenWidth, screenHeight); - - amountField.drawTextBox(); - } - - @Override - public void drawForeground(int mouseX, int mouseY) { - drawString(7, 7, getTitle()); - } - - @Override - protected void keyTyped(char character, int keyCode) throws IOException { - if (!checkHotbarKeys(keyCode) && amountField.textboxKeyTyped(character, keyCode)) { - // NO OP - } else { - if (keyCode == Keyboard.KEY_RETURN) { - startRequest(isShiftKeyDown()); - } else if (keyCode == Keyboard.KEY_ESCAPE) { - close(); - } else { - super.keyTyped(character, keyCode); - } - } - } - - @Override - protected void actionPerformed(GuiButton button) throws IOException { - super.actionPerformed(button); - - if (button.id == startButton.id) { - startRequest(isShiftKeyDown()); - } else if (button.id == cancelButton.id) { - close(); - } else { - for (GuiButton incrementButton : incrementButtons) { - if (incrementButton.id == button.id) { - Integer oldAmount = Ints.tryParse(amountField.getText()); - - if (oldAmount == null) { - oldAmount = 0; - } - - int newAmount = Integer.parseInt(incrementButton.displayString); - - if (!canAmountGoNegative()) { - newAmount = Math.max(DEFAULT_AMOUNT, ((oldAmount == 1 && newAmount != 1) ? 0 : oldAmount) + newAmount); - } else { - newAmount = oldAmount + newAmount; - } - - if (newAmount > getMaxAmount()) { - newAmount = getMaxAmount(); - } - - amountField.setText(String.valueOf(newAmount)); - - break; - } - } - } - } - - protected int getMaxAmount() { - return Integer.MAX_VALUE; - } - - protected void startRequest(boolean noPreview) { - Integer quantity = Ints.tryParse(amountField.getText()); - - if (quantity != null && quantity > 0) { - RS.INSTANCE.network.sendToServer(new MessageGridCraftingPreview(stack.getHash(), quantity, noPreview, stack instanceof GridStackFluid)); - - startButton.enabled = false; - } - } - - public void close() { - FMLClientHandler.instance().showGuiScreen(parent); - } - - public GuiBase getParent() { - return parent; - } -} diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGrid.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGrid.java index 2ab3868f9..080677632 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGrid.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGrid.java @@ -452,7 +452,7 @@ public class GuiGrid extends GuiBase implements IResizableDisplay { if (isPulling) { if (stack.isCraftable() && view.canCraft() && (stack.doesDisplayCraftText() || (GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown()))) { - FMLCommonHandler.instance().showGuiScreen(new GuiCraftingStart(this, ((ContainerGrid) this.inventorySlots).getPlayer(), stack)); + FMLCommonHandler.instance().showGuiScreen(new GuiGridCraftingSettings(this, ((ContainerGrid) this.inventorySlots).getPlayer(), stack)); } else if (grid.getGridType() == GridType.FLUID && held.isEmpty()) { RS.INSTANCE.network.sendToServer(new MessageGridFluidPull(view.getStacks().get(slotNumber).getHash(), GuiScreen.isShiftKeyDown())); } else if (grid.getGridType() == GridType.NORMAL || grid.getGridType() == GridType.PATTERN) { diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGridCraftingSettings.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGridCraftingSettings.java new file mode 100644 index 000000000..18c46f106 --- /dev/null +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGridCraftingSettings.java @@ -0,0 +1,77 @@ +package com.raoulvdberge.refinedstorage.gui.grid; + +import com.google.common.primitives.Ints; +import com.raoulvdberge.refinedstorage.RS; +import com.raoulvdberge.refinedstorage.container.ContainerCraftingSettings; +import com.raoulvdberge.refinedstorage.gui.GuiAmountSpecifying; +import com.raoulvdberge.refinedstorage.gui.GuiBase; +import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackFluid; +import com.raoulvdberge.refinedstorage.gui.grid.stack.IGridStack; +import com.raoulvdberge.refinedstorage.network.MessageGridCraftingPreview; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.fluids.Fluid; + +public class GuiGridCraftingSettings extends GuiAmountSpecifying { + private IGridStack stack; + + public GuiGridCraftingSettings(GuiBase parent, EntityPlayer player, IGridStack stack) { + super(parent, new ContainerCraftingSettings(player, stack), 172, 99); + + this.stack = stack; + } + + @Override + protected String getOkButtonText() { + return t("misc.refinedstorage:start"); + } + + @Override + protected String getTitle() { + return t("container.crafting"); + } + + @Override + protected String getTexture() { + return "gui/crafting_settings.png"; + } + + @Override + protected int[] getIncrements() { + if (stack instanceof GridStackFluid) { + return new int[]{ + 100, 500, 1000, + -100, -500, -1000 + }; + } else { + return new int[]{ + 1, 10, 64, + -1, -10, -64 + }; + } + } + + @Override + protected int getDefaultAmount() { + return stack instanceof GridStackFluid ? Fluid.BUCKET_VOLUME : 1; + } + + @Override + protected boolean canAmountGoNegative() { + return false; + } + + @Override + protected int getMaxAmount() { + return Integer.MAX_VALUE; + } + + protected void onOkButtonPressed(boolean shiftDown) { + Integer quantity = Ints.tryParse(amountField.getText()); + + if (quantity != null && quantity > 0) { + RS.INSTANCE.network.sendToServer(new MessageGridCraftingPreview(stack.getHash(), quantity, shiftDown, stack instanceof GridStackFluid)); + + okButton.enabled = false; + } + } +} diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiFluidAmount.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGridPatternFluidAmount.java similarity index 67% rename from src/main/java/com/raoulvdberge/refinedstorage/gui/GuiFluidAmount.java rename to src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGridPatternFluidAmount.java index 524ebfa27..e9976c638 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiFluidAmount.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGridPatternFluidAmount.java @@ -1,32 +1,43 @@ -package com.raoulvdberge.refinedstorage.gui; +package com.raoulvdberge.refinedstorage.gui.grid; import com.google.common.primitives.Ints; import com.raoulvdberge.refinedstorage.RS; import com.raoulvdberge.refinedstorage.container.ContainerFluidAmount; -import com.raoulvdberge.refinedstorage.gui.grid.GuiCraftingStart; +import com.raoulvdberge.refinedstorage.gui.GuiAmountSpecifying; +import com.raoulvdberge.refinedstorage.gui.GuiBase; import com.raoulvdberge.refinedstorage.network.MessageGridFluidAmount; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; -public class GuiFluidAmount extends GuiCraftingStart { +public class GuiGridPatternFluidAmount extends GuiAmountSpecifying { private int slot; private ItemStack fluidContainer; - public GuiFluidAmount(GuiBase parent, EntityPlayer player, int slot, ItemStack fluidContainer) { - super(parent, null, new ContainerFluidAmount(player, fluidContainer), 172, 99); + public GuiGridPatternFluidAmount(GuiBase parent, EntityPlayer player, int slot, ItemStack fluidContainer) { + super(parent, new ContainerFluidAmount(player, fluidContainer), 172, 99); this.slot = slot; this.fluidContainer = fluidContainer; } @Override - protected int getAmount() { + protected int getDefaultAmount() { return fluidContainer.getCount(); } @Override - protected String getStartButtonText() { + protected boolean canAmountGoNegative() { + return false; + } + + @Override + protected int getMaxAmount() { + return Fluid.BUCKET_VOLUME; + } + + @Override + protected String getOkButtonText() { return t("misc.refinedstorage:set"); } @@ -36,8 +47,8 @@ public class GuiFluidAmount extends GuiCraftingStart { } @Override - protected boolean canAmountGoNegative() { - return false; + protected String getTexture() { + return "gui/crafting_settings.png"; } @Override @@ -49,12 +60,7 @@ public class GuiFluidAmount extends GuiCraftingStart { } @Override - protected int getMaxAmount() { - return Fluid.BUCKET_VOLUME; - } - - @Override - protected void startRequest(boolean noPreview) { + protected void onOkButtonPressed(boolean shiftDown) { Integer amount = Ints.tryParse(amountField.getText()); if (amount != null && amount > 0 && amount <= Fluid.BUCKET_VOLUME) { diff --git a/src/main/java/com/raoulvdberge/refinedstorage/network/MessageGridCraftingPreviewResponse.java b/src/main/java/com/raoulvdberge/refinedstorage/network/MessageGridCraftingPreviewResponse.java index 1f226ae84..19a7a12b7 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/network/MessageGridCraftingPreviewResponse.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/network/MessageGridCraftingPreviewResponse.java @@ -3,7 +3,7 @@ package com.raoulvdberge.refinedstorage.network; import com.raoulvdberge.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement; import com.raoulvdberge.refinedstorage.apiimpl.API; import com.raoulvdberge.refinedstorage.gui.GuiCraftingPreview; -import com.raoulvdberge.refinedstorage.gui.grid.GuiCraftingStart; +import com.raoulvdberge.refinedstorage.gui.grid.GuiGridCraftingSettings; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -69,8 +69,8 @@ public class MessageGridCraftingPreviewResponse implements IMessage, IMessageHan Minecraft.getMinecraft().addScheduledTask(() -> { GuiScreen screen = Minecraft.getMinecraft().currentScreen; - if (screen instanceof GuiCraftingStart) { - screen = ((GuiCraftingStart) screen).getParent(); + if (screen instanceof GuiGridCraftingSettings) { + screen = ((GuiGridCraftingSettings) screen).getParent(); } FMLCommonHandler.instance().showGuiScreen(new GuiCraftingPreview(screen, message.stacks, message.hash, message.quantity, message.fluids)); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/network/MessageGridCraftingStartResponse.java b/src/main/java/com/raoulvdberge/refinedstorage/network/MessageGridCraftingStartResponse.java index a920395f3..57f54bd2e 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/network/MessageGridCraftingStartResponse.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/network/MessageGridCraftingStartResponse.java @@ -1,6 +1,6 @@ package com.raoulvdberge.refinedstorage.network; -import com.raoulvdberge.refinedstorage.gui.grid.GuiCraftingStart; +import com.raoulvdberge.refinedstorage.gui.grid.GuiGridCraftingSettings; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -30,8 +30,8 @@ public class MessageGridCraftingStartResponse implements IMessage, IMessageHandl Minecraft.getMinecraft().addScheduledTask(() -> { GuiScreen screen = Minecraft.getMinecraft().currentScreen; - if (screen instanceof GuiCraftingStart) { - ((GuiCraftingStart) screen).close(); + if (screen instanceof GuiGridCraftingSettings) { + ((GuiGridCraftingSettings) screen).close(); } }); diff --git a/src/main/resources/assets/refinedstorage/textures/gui/crafting_settings.png b/src/main/resources/assets/refinedstorage/textures/gui/crafting_settings.png index 58c8ac01dbc09d43f0b43d107c151302c17469f7..6b8b35fdd669a633c3e820cc455c44243c0bd5a6 100755 GIT binary patch delta 356 zcmaFC`;vD<2n*K^1_r(zj9HFfqbJ9)h~-F@xJHx&=ckpFCl;kL6eMQmmFVTAmMEC$ z8R!`qepJYu%D}*6?djqeQW5v|?m;hRLk6~oTi3q-e`0m+@yTB5jDW8aJB#Y`Lu4C`#RF)-}tdGWse&oqXZkBk4=#WU3WU(ZnSpcf_$q#J(!UVnc7 z`9B+uhkj>~h+?R@SI>HYIbXzqfwAD}Mpgsn2VeC?Z9cd~GoI0CU|@Q1Dw$gWM0acj z(K|lf0GVOVV3G6|$xw#Ah}{fN7^YV;9RK^&+Jy7L_ikpf{7e5McI^N9Q(q?RedYa! oXRF?uO%7zMpZuP+L?ZL~Pv(N3CX)s1m>597)78&qol`;+0NA~jUjP6A delta 360 zcmV-u0hj*i4d@N9R0ImS000iT0k{Sizmr}B7JnFYMObuGZ)S9NVRB^vaA9d~bS`dX zbRaY?FfKW4Gk#7000KKnL_t(|UhUn%N&_(f2H~~U_kZNoy5mWDX%k488H68U*`(h= zyokqn9$R!y>Nt(4Xa?YirZ0AmY)&- zalqnD`X39Aw_g9kVfC*24sX_bw<(hW2GEo61tJ(qJI`;f`ZS1LZ