diff options
author | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2023-11-07 22:08:55 -0500 |
---|---|---|
committer | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2023-11-07 22:08:55 -0500 |
commit | 92b3214ff78a40ff92c3d44baa435ddfda29779b (patch) | |
tree | d26b1a3fd36a7bfa077afef82f98f2273836a677 /src/main/java/de/hysky/skyblocker/mixin/yacl/NumberFieldControllerMixin.java | |
parent | 8731707bedea9ec7c59f9910214aec99cb4eab52 (diff) | |
download | Skyblocker-92b3214ff78a40ff92c3d44baa435ddfda29779b.tar.gz Skyblocker-92b3214ff78a40ff92c3d44baa435ddfda29779b.tar.bz2 Skyblocker-92b3214ff78a40ff92c3d44baa435ddfda29779b.zip |
Remove yacl patches
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/mixin/yacl/NumberFieldControllerMixin.java')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/mixin/yacl/NumberFieldControllerMixin.java | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/main/java/de/hysky/skyblocker/mixin/yacl/NumberFieldControllerMixin.java b/src/main/java/de/hysky/skyblocker/mixin/yacl/NumberFieldControllerMixin.java deleted file mode 100644 index 010f9a26..00000000 --- a/src/main/java/de/hysky/skyblocker/mixin/yacl/NumberFieldControllerMixin.java +++ /dev/null @@ -1,43 +0,0 @@ -package de.hysky.skyblocker.mixin.yacl; - -import java.text.DecimalFormatSymbols; -import java.text.NumberFormat; -import java.text.ParseException; -import java.text.ParsePosition; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; - -import dev.isxander.yacl3.gui.controllers.slider.ISliderController; -import dev.isxander.yacl3.gui.controllers.string.number.NumberFieldController; -import dev.isxander.yacl3.impl.utils.YACLConstants; -import net.minecraft.util.math.MathHelper; - -@Mixin(value = NumberFieldController.class, remap = false) -public abstract class NumberFieldControllerMixin<T extends Number> implements ISliderController<T> { - private static final NumberFormat NUMBER_FORMAT = NumberFormat.getInstance(); - private static final DecimalFormatSymbols DECIMAL_FORMAT_SYMBOLS = DecimalFormatSymbols.getInstance(); - - @Overwrite - public void setFromString(String value) { - try { - setPendingValue(MathHelper.clamp(NUMBER_FORMAT.parse(value).doubleValue(), min(), max())); - } catch (ParseException ignore) { - YACLConstants.LOGGER.warn("Failed to parse number: {}", value); - } - } - - @Overwrite - public boolean isInputValid(String input) { - input = input.replace(DECIMAL_FORMAT_SYMBOLS.getGroupingSeparator() + "", ""); - ParsePosition parsePosition = new ParsePosition(0); - NUMBER_FORMAT.parse(input, parsePosition); - - return parsePosition.getIndex() == input.length(); - } - - @Overwrite - protected String cleanupNumberString(String number) { - throw new UnsupportedOperationException("This method should no longer be called."); - } -} |