Revert "Add 1.18 port fixes"

This reverts commit b2f6441568.
This commit is contained in:
raoulvdberge
2022-07-30 19:47:26 +02:00
parent c9c3b42b16
commit 0afadf4dec
3 changed files with 12 additions and 11 deletions

View File

@@ -48,7 +48,7 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
} }
protected int parseAmount() { protected int parseAmount() {
return (int) Math.ceil(EquationEvaluator.evaluate(amountField.getValue())); return (int) Math.ceil(EquationEvaluator.evaluate(amountField.getText()));
} }
protected int clampAmount(int amount) { protected int clampAmount(int amount) {
@@ -75,8 +75,8 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
return 20; return 20;
} }
public Button addActionButton(Pair<Integer, Integer> absolutePos, int xOffset, int yOffset, Component text, public Button addActionButton(Pair<Integer, Integer> absolutePos, int xOffset, int yOffset, ITextComponent text,
Button.OnPress onPress) { IPressable onPress) {
return addButton(absolutePos.getLeft() + xOffset, absolutePos.getRight() + yOffset, getOkCancelButtonWidth(), return addButton(absolutePos.getLeft() + xOffset, absolutePos.getRight() + yOffset, getOkCancelButtonWidth(),
getOkCancelButtonHeight(), text, true, true, onPress); getOkCancelButtonHeight(), text, true, true, onPress);
} }
@@ -87,12 +87,13 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
Pair<Integer, Integer> absolutePos = Pair.of(x + pos.getLeft(), y + pos.getRight()); Pair<Integer, Integer> absolutePos = Pair.of(x + pos.getLeft(), y + pos.getRight());
okButton = addActionButton(absolutePos, 0, 0, getOkButtonText(), btn -> onOkButtonPressed(hasShiftDown())); okButton = addActionButton(absolutePos, 0, 0, getOkButtonText(), btn -> onOkButtonPressed(hasShiftDown()));
cancelButton = addActionButton(absolutePos, 0, 24, new TranslatableComponent("gui.cancel"), btn -> close()); cancelButton = addActionButton(absolutePos, 0, 24, new TranslationTextComponent("gui.cancel"), btn -> close());
evaluateButton = addActionButton(absolutePos, 0, 48, new TranslatableComponent("misc.refinedstorage.evaluate"), evaluateButton = addActionButton(absolutePos, 0, 48, new TranslationTextComponent("misc.refinedstorage.evaluate"),
btn -> onEvaluateButtonPressed(hasShiftDown())); btn -> onEvaluateButtonPressed(hasShiftDown()));
amountField = new EditBox(font, x + getAmountPos().getLeft(), y + getAmountPos().getRight(), 69 - 6, font.lineHeight, new TextComponent("")); amountField = new TextFieldWidget(font, x + getAmountPos().getLeft(), y + getAmountPos().getRight(), 69 - 6,
amountField.setBordered(false); font.FONT_HEIGHT, new StringTextComponent(""));
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());
@@ -177,7 +178,7 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
if (!canAmountGoNegative() && oldAmount == 1) { if (!canAmountGoNegative() && oldAmount == 1) {
newAmount--; newAmount--;
} }
amountField.setValue(String.valueOf(clampAmount(newAmount))); amountField.setText(String.valueOf(clampAmount(newAmount)));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
// NO OP // NO OP
} }
@@ -197,7 +198,7 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
private void onEvaluateButtonPressed(boolean shiftDown) { private void onEvaluateButtonPressed(boolean shiftDown) {
try { try {
amountField.setValue(String.valueOf(clampAmount(parseAmount()))); amountField.setText(String.valueOf(clampAmount(parseAmount())));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
// NO OP // NO OP
} }

View File

@@ -67,7 +67,7 @@ public class PriorityScreen extends AmountSpecifyingScreen<AbstractContainerMenu
} }
@Override @Override
protected void onValidAmountSaved(boolean shiftDown, int amount) { protected void onValidAmountSave(boolean shiftDown, int amount) {
BlockEntitySynchronizationManager.setParameter(priority, amount); BlockEntitySynchronizationManager.setParameter(priority, amount);
} }
} }

View File

@@ -62,7 +62,7 @@ public class CraftingSettingsScreen extends AmountSpecifyingScreen<CraftingSetti
} }
@Override @Override
protected void onValidAmountSaved(boolean shiftDown, int amount) { protected void onValidAmountSave(boolean shiftDown, int amount) {
RS.NETWORK_HANDLER.sendToServer(new GridCraftingPreviewRequestMessage(stack.getId(), amount, shiftDown, stack instanceof FluidGridStack)); RS.NETWORK_HANDLER.sendToServer(new GridCraftingPreviewRequestMessage(stack.getId(), amount, shiftDown, stack instanceof FluidGridStack));
okButton.active = false; okButton.active = false;