Revert "Add an evaluate button for equation inputs"
This reverts commit d976cbe8b9
.
This commit is contained in:
@@ -20,7 +20,6 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
|
|||||||
protected EditBox amountField;
|
protected EditBox amountField;
|
||||||
protected Button okButton;
|
protected Button okButton;
|
||||||
protected Button cancelButton;
|
protected Button cancelButton;
|
||||||
protected Button evaluateButton;
|
|
||||||
|
|
||||||
protected AmountSpecifyingScreen(BaseScreen<T> parent, T container, int width, int height, Inventory playerInventory, Component title) {
|
protected AmountSpecifyingScreen(BaseScreen<T> parent, T container, int width, int height, Inventory playerInventory, Component title) {
|
||||||
super(container, width, height, playerInventory, title);
|
super(container, width, height, playerInventory, title);
|
||||||
@@ -64,36 +63,22 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Pair<Integer, Integer> getOkCancelPos() {
|
protected Pair<Integer, Integer> getOkCancelPos() {
|
||||||
return Pair.of(114, 20);
|
return Pair.of(114, 33);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getOkCancelButtonWidth() {
|
protected int getOkCancelButtonWidth() {
|
||||||
return 50;
|
return 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getOkCancelButtonHeight() {
|
|
||||||
return 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Button addActionButton(Pair<Integer, Integer> absolutePos, int xOffset, int yOffset, ITextComponent text,
|
|
||||||
IPressable onPress) {
|
|
||||||
return addButton(absolutePos.getLeft() + xOffset, absolutePos.getRight() + yOffset, getOkCancelButtonWidth(),
|
|
||||||
getOkCancelButtonHeight(), text, true, true, onPress);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPostInit(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
Pair<Integer, Integer> pos = getOkCancelPos();
|
Pair<Integer, Integer> pos = getOkCancelPos();
|
||||||
Pair<Integer, Integer> absolutePos = Pair.of(x + pos.getLeft(), y + pos.getRight());
|
|
||||||
|
|
||||||
okButton = addActionButton(absolutePos, 0, 0, getOkButtonText(), btn -> onOkButtonPressed(hasShiftDown()));
|
okButton = addButton(x + pos.getLeft(), y + pos.getRight(), getOkCancelButtonWidth(), 20, getOkButtonText(), true, true, btn -> onOkButtonPressed(hasShiftDown()));
|
||||||
cancelButton = addActionButton(absolutePos, 0, 24, new TranslationTextComponent("gui.cancel"), btn -> close());
|
cancelButton = addButton(x + pos.getLeft(), y + pos.getRight() + 24, getOkCancelButtonWidth(), 20, new TranslatableComponent("gui.cancel"), true, true, btn -> close());
|
||||||
evaluateButton = addActionButton(absolutePos, 0, 48, new TranslationTextComponent("misc.refinedstorage.evaluate"),
|
|
||||||
btn -> onEvaluateButtonPressed(hasShiftDown()));
|
|
||||||
|
|
||||||
amountField = new TextFieldWidget(font, x + getAmountPos().getLeft(), y + getAmountPos().getRight(), 69 - 6,
|
amountField = new EditBox(font, x + getAmountPos().getLeft(), y + getAmountPos().getRight(), 69 - 6, font.lineHeight, new TextComponent(""));
|
||||||
font.FONT_HEIGHT, new StringTextComponent(""));
|
amountField.setBordered(false);
|
||||||
amountField.setEnableBackgroundDrawing(false);
|
|
||||||
amountField.setVisible(true);
|
amountField.setVisible(true);
|
||||||
amountField.setValue(String.valueOf(getDefaultAmount()));
|
amountField.setValue(String.valueOf(getDefaultAmount()));
|
||||||
amountField.setTextColor(RenderSettings.INSTANCE.getSecondaryColor());
|
amountField.setTextColor(RenderSettings.INSTANCE.getSecondaryColor());
|
||||||
@@ -188,7 +173,7 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
|
|||||||
try {
|
try {
|
||||||
int amount = parseAmount();
|
int amount = parseAmount();
|
||||||
if (isAmountInBounds(amount)) {
|
if (isAmountInBounds(amount)) {
|
||||||
onValidAmountSaved(shiftDown, amount);
|
onValidAmountSave(shiftDown, amount);
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
@@ -196,16 +181,7 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onEvaluateButtonPressed(boolean shiftDown) {
|
protected void onValidAmountSave(boolean shiftDown, int amount) {}
|
||||||
try {
|
|
||||||
amountField.setText(String.valueOf(clampAmount(parseAmount())));
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
// NO OP
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void onValidAmountSaved(boolean shiftDown, int amount) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick(int x, int y) {
|
public void tick(int x, int y) {
|
||||||
@@ -226,6 +202,7 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
|
|||||||
renderString(poseStack, 7, 7, title.getString());
|
renderString(poseStack, 7, 7, title.getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseScrolled(double x, double y, double delta) {
|
public boolean mouseScrolled(double x, double y, double delta) {
|
||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
|
@@ -87,7 +87,7 @@ public class FluidAmountScreen extends AmountSpecifyingScreen<FluidAmountContain
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onValidAmountSaved(boolean shiftDown, int amount) {
|
protected void onValidAmountSave(boolean shiftDown, int amount) {
|
||||||
RS.NETWORK_HANDLER.sendToServer(new SetFluidFilterSlotMessage(containerSlot, StackUtils.copy(stack, amount)));
|
RS.NETWORK_HANDLER.sendToServer(new SetFluidFilterSlotMessage(containerSlot, StackUtils.copy(stack, amount)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -87,7 +87,7 @@ public class ItemAmountScreen extends AmountSpecifyingScreen<AmountContainerMenu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onValidAmountSaved(boolean shiftDown, int amount) {
|
protected void onValidAmountSave(boolean shiftDown, int amount) {
|
||||||
RS.NETWORK_HANDLER.sendToServer(new SetFilterSlotMessage(containerSlot, ItemHandlerHelper.copyStackWithSize(stack, amount)));
|
RS.NETWORK_HANDLER.sendToServer(new SetFilterSlotMessage(containerSlot, ItemHandlerHelper.copyStackWithSize(stack, amount)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -123,7 +123,6 @@
|
|||||||
"misc.refinedstorage.start": "Start",
|
"misc.refinedstorage.start": "Start",
|
||||||
"misc.refinedstorage.clear": "Clear",
|
"misc.refinedstorage.clear": "Clear",
|
||||||
"misc.refinedstorage.set": "Set",
|
"misc.refinedstorage.set": "Set",
|
||||||
"misc.refinedstorage.evaluate": "Evaluate",
|
|
||||||
"misc.refinedstorage.cancel_all": "Cancel All",
|
"misc.refinedstorage.cancel_all": "Cancel All",
|
||||||
"misc.refinedstorage.priority": "Priority",
|
"misc.refinedstorage.priority": "Priority",
|
||||||
"misc.refinedstorage.exact": "Exact",
|
"misc.refinedstorage.exact": "Exact",
|
||||||
|
@@ -84,7 +84,6 @@
|
|||||||
"misc.refinedstorage.start": "Commencer",
|
"misc.refinedstorage.start": "Commencer",
|
||||||
"misc.refinedstorage.clear": "Vider",
|
"misc.refinedstorage.clear": "Vider",
|
||||||
"misc.refinedstorage.set": "Fixer",
|
"misc.refinedstorage.set": "Fixer",
|
||||||
"misc.refinedstorage.evaluate": "Évaluer",
|
|
||||||
"misc.refinedstorage.cancel_all": "Tout annuler",
|
"misc.refinedstorage.cancel_all": "Tout annuler",
|
||||||
"misc.refinedstorage.priority": "Priorité",
|
"misc.refinedstorage.priority": "Priorité",
|
||||||
"misc.refinedstorage.processing": "En traitement",
|
"misc.refinedstorage.processing": "En traitement",
|
||||||
|
@@ -113,7 +113,6 @@
|
|||||||
"misc.refinedstorage.start": "开始",
|
"misc.refinedstorage.start": "开始",
|
||||||
"misc.refinedstorage.clear": "清除",
|
"misc.refinedstorage.clear": "清除",
|
||||||
"misc.refinedstorage.set": "设置",
|
"misc.refinedstorage.set": "设置",
|
||||||
"misc.refinedstorage.evaluate": "评估",
|
|
||||||
"misc.refinedstorage.cancel_all": "取消所有",
|
"misc.refinedstorage.cancel_all": "取消所有",
|
||||||
"misc.refinedstorage.priority": "优先级",
|
"misc.refinedstorage.priority": "优先级",
|
||||||
"misc.refinedstorage.oredict": "矿物辞典",
|
"misc.refinedstorage.oredict": "矿物辞典",
|
||||||
|
@@ -125,7 +125,6 @@
|
|||||||
"misc.refinedstorage.start": "開始",
|
"misc.refinedstorage.start": "開始",
|
||||||
"misc.refinedstorage.clear": "清除",
|
"misc.refinedstorage.clear": "清除",
|
||||||
"misc.refinedstorage.set": "設置",
|
"misc.refinedstorage.set": "設置",
|
||||||
"misc.refinedstorage.evaluate": "評估",
|
|
||||||
"misc.refinedstorage.cancel_all": "取消所有",
|
"misc.refinedstorage.cancel_all": "取消所有",
|
||||||
"misc.refinedstorage.priority": "優先級",
|
"misc.refinedstorage.priority": "優先級",
|
||||||
"misc.refinedstorage.exact": "合成模式",
|
"misc.refinedstorage.exact": "合成模式",
|
||||||
|
Reference in New Issue
Block a user