Amount specifying screen is now limited to valid values.
Cherry picked from 3402fc538ad1c00b384e0f180f6654995142f432
This commit is contained in:
@@ -14,6 +14,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||||||
by [@necauqua](https://github.com/necauqua) and [@Darkere](https://github.com/Darkere).
|
by [@necauqua](https://github.com/necauqua) and [@Darkere](https://github.com/Darkere).
|
||||||
- Fixed autocrafting task getting stuck if two tasks fulfilled each others requirements.
|
- Fixed autocrafting task getting stuck if two tasks fulfilled each others requirements.
|
||||||
- Fixed fluid autocrafting breaking when using 2 stacks of the same fluid in a pattern.
|
- Fixed fluid autocrafting breaking when using 2 stacks of the same fluid in a pattern.
|
||||||
|
- Amount specifying screen is now limited to valid values.
|
||||||
|
|
||||||
## [v1.10.0-beta.4] - 2021-12-28
|
## [v1.10.0-beta.4] - 2021-12-28
|
||||||
|
|
||||||
|
@@ -64,6 +64,18 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
|
|||||||
amountField.setTextColor(RenderSettings.INSTANCE.getSecondaryColor());
|
amountField.setTextColor(RenderSettings.INSTANCE.getSecondaryColor());
|
||||||
amountField.setCanLoseFocus(false);
|
amountField.setCanLoseFocus(false);
|
||||||
amountField.changeFocus(true);
|
amountField.changeFocus(true);
|
||||||
|
amountField.setResponder(text -> {
|
||||||
|
int amount = 0;
|
||||||
|
try {
|
||||||
|
amount = Integer.parseInt(amountField.getText());
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// NO OP
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amount > getMaxAmount()) {
|
||||||
|
amountField.setText(String.valueOf(getMaxAmount()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
addRenderableWidget(amountField);
|
addRenderableWidget(amountField);
|
||||||
|
|
||||||
|
@@ -205,7 +205,7 @@ public abstract class BaseScreen<T extends AbstractContainerMenu> extends Abstra
|
|||||||
minecraft.player,
|
minecraft.player,
|
||||||
slot.index,
|
slot.index,
|
||||||
slot.getItem(),
|
slot.getItem(),
|
||||||
slot.getMaxStackSize(),
|
Math.min(slot.getMaxStackSize(), slot.getItem().getMaxStackSize()),
|
||||||
((FilterSlot) slot).isAlternativesAllowed() ? (parent -> new AlternativesScreen(
|
((FilterSlot) slot).isAlternativesAllowed() ? (parent -> new AlternativesScreen(
|
||||||
parent,
|
parent,
|
||||||
minecraft.player,
|
minecraft.player,
|
||||||
|
Reference in New Issue
Block a user