Revert "Add an evaluate button for equation inputs"

This reverts commit d976cbe8b9.
This commit is contained in:
raoulvdberge
2022-07-30 19:47:29 +02:00
parent 51bbb68dbc
commit 183b423bbb
7 changed files with 10 additions and 37 deletions

View File

@@ -20,7 +20,6 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
protected EditBox amountField;
protected Button okButton;
protected Button cancelButton;
protected Button evaluateButton;
protected AmountSpecifyingScreen(BaseScreen<T> parent, T container, int width, int height, Inventory playerInventory, Component title) {
super(container, width, height, playerInventory, title);
@@ -64,36 +63,22 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
}
protected Pair<Integer, Integer> getOkCancelPos() {
return Pair.of(114, 20);
return Pair.of(114, 33);
}
protected int getOkCancelButtonWidth() {
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
public void onPostInit(int x, int y) {
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()));
cancelButton = addActionButton(absolutePos, 0, 24, new TranslationTextComponent("gui.cancel"), btn -> close());
evaluateButton = addActionButton(absolutePos, 0, 48, new TranslationTextComponent("misc.refinedstorage.evaluate"),
btn -> onEvaluateButtonPressed(hasShiftDown()));
okButton = addButton(x + pos.getLeft(), y + pos.getRight(), getOkCancelButtonWidth(), 20, getOkButtonText(), true, true, btn -> onOkButtonPressed(hasShiftDown()));
cancelButton = addButton(x + pos.getLeft(), y + pos.getRight() + 24, getOkCancelButtonWidth(), 20, new TranslatableComponent("gui.cancel"), true, true, btn -> close());
amountField = new TextFieldWidget(font, x + getAmountPos().getLeft(), y + getAmountPos().getRight(), 69 - 6,
font.FONT_HEIGHT, new StringTextComponent(""));
amountField.setEnableBackgroundDrawing(false);
amountField = new EditBox(font, x + getAmountPos().getLeft(), y + getAmountPos().getRight(), 69 - 6, font.lineHeight, new TextComponent(""));
amountField.setBordered(false);
amountField.setVisible(true);
amountField.setValue(String.valueOf(getDefaultAmount()));
amountField.setTextColor(RenderSettings.INSTANCE.getSecondaryColor());
@@ -188,7 +173,7 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
try {
int amount = parseAmount();
if (isAmountInBounds(amount)) {
onValidAmountSaved(shiftDown, amount);
onValidAmountSave(shiftDown, amount);
close();
}
} catch (IllegalArgumentException e) {
@@ -196,16 +181,7 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
}
}
private void onEvaluateButtonPressed(boolean shiftDown) {
try {
amountField.setText(String.valueOf(clampAmount(parseAmount())));
} catch (IllegalArgumentException e) {
// NO OP
}
}
protected void onValidAmountSaved(boolean shiftDown, int amount) {
}
protected void onValidAmountSave(boolean shiftDown, int amount) {}
@Override
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());
}
@Override
public boolean mouseScrolled(double x, double y, double delta) {
if (delta > 0) {

View File

@@ -87,7 +87,7 @@ public class FluidAmountScreen extends AmountSpecifyingScreen<FluidAmountContain
}
@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)));
}
}

View File

@@ -87,7 +87,7 @@ public class ItemAmountScreen extends AmountSpecifyingScreen<AmountContainerMenu
}
@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)));
}
}

View File

@@ -123,7 +123,6 @@
"misc.refinedstorage.start": "Start",
"misc.refinedstorage.clear": "Clear",
"misc.refinedstorage.set": "Set",
"misc.refinedstorage.evaluate": "Evaluate",
"misc.refinedstorage.cancel_all": "Cancel All",
"misc.refinedstorage.priority": "Priority",
"misc.refinedstorage.exact": "Exact",

View File

@@ -84,7 +84,6 @@
"misc.refinedstorage.start": "Commencer",
"misc.refinedstorage.clear": "Vider",
"misc.refinedstorage.set": "Fixer",
"misc.refinedstorage.evaluate": "Évaluer",
"misc.refinedstorage.cancel_all": "Tout annuler",
"misc.refinedstorage.priority": "Priorité",
"misc.refinedstorage.processing": "En traitement",

View File

@@ -113,7 +113,6 @@
"misc.refinedstorage.start": "开始",
"misc.refinedstorage.clear": "清除",
"misc.refinedstorage.set": "设置",
"misc.refinedstorage.evaluate": "评估",
"misc.refinedstorage.cancel_all": "取消所有",
"misc.refinedstorage.priority": "优先级",
"misc.refinedstorage.oredict": "矿物辞典",

View File

@@ -125,7 +125,6 @@
"misc.refinedstorage.start": "開始",
"misc.refinedstorage.clear": "清除",
"misc.refinedstorage.set": "設置",
"misc.refinedstorage.evaluate": "評估",
"misc.refinedstorage.cancel_all": "取消所有",
"misc.refinedstorage.priority": "優先級",
"misc.refinedstorage.exact": "合成模式",