fix: Use proper maximum value and increase 1.20.1 commons compatibility
This commit is contained in:
parent
cbed8270f3
commit
5b8164e855
|
@ -0,0 +1,22 @@
|
|||
package io.gitlab.jfronny.respackopts.mixin.muscript;
|
||||
|
||||
import io.gitlab.jfronny.commons.data.ImmCollection;
|
||||
import io.gitlab.jfronny.muscript.data.dynamic.additional.DFinal;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Mixin(DFinal.class)
|
||||
public class DFinalMixin {
|
||||
@Redirect(method = "of(Ljava/util/Map;)Lio/gitlab/jfronny/muscript/data/dynamic/DObject;", at = @At(value = "INVOKE", target = "Lio/gitlab/jfronny/commons/data/ImmCollection;copyOf(Ljava/util/Map;)Ljava/util/Map;"), remap = false)
|
||||
private static <K, V> Map<K, V> copyOf(Map<K, V> map) {
|
||||
return ImmCollection.of(new LinkedHashMap<>(map));
|
||||
}
|
||||
|
||||
@Redirect(method = "of(Ljava/util/List;)Lio/gitlab/jfronny/muscript/data/dynamic/DList;", at = @At(value = "INVOKE", target = "Lio/gitlab/jfronny/commons/data/ImmCollection;copyOf(Ljava/util/List;)Ljava/util/List;"), remap = false)
|
||||
private static <E> List<E> copyOf(List<E> list) {
|
||||
return ImmCollection.of(new LinkedList<>(list));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package io.gitlab.jfronny.respackopts.mixin.muscript;
|
||||
|
||||
import io.gitlab.jfronny.commons.StringFormatter;
|
||||
import io.gitlab.jfronny.muscript.ast.string.StringCoerce;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(StringCoerce.class)
|
||||
public class StringCoerceMixin {
|
||||
@Redirect(method = "optimize()Lio/gitlab/jfronny/muscript/ast/StringExpr;", at = @At(value = "INVOKE", target = "Lio/gitlab/jfronny/commons/StringFormatter;toStringPrecise(D)Ljava/lang/String;"), remap = false)
|
||||
private String toStringPrecise(double number) {
|
||||
return StringFormatter.toString(number);
|
||||
}
|
||||
}
|
|
@ -90,7 +90,7 @@ public class ConfigNumericEntry extends ConfigEntry<Double> implements DNumber {
|
|||
@Override
|
||||
public CategoryBuilder<?> buildEntry(GuiEntryBuilderParam args) {
|
||||
double min = this.min == null ? Double.NEGATIVE_INFINITY : this.min;
|
||||
double max = this.max == null ? Double.NEGATIVE_INFINITY : this.max;
|
||||
double max = this.max == null ? Double.POSITIVE_INFINITY : this.max;
|
||||
if (integer) {
|
||||
return args.builder().value(
|
||||
args.name(),
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
"DirectoryResourcePackAccessor",
|
||||
"FileResourcePackProviderMixin",
|
||||
"ResourcePackManagerMixin",
|
||||
"ZipResourcePackAccessor"
|
||||
"ZipResourcePackAccessor",
|
||||
"muscript.DFinalMixin",
|
||||
"muscript.StringCoerceMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
Loading…
Reference in New Issue