diff options
author | syeyoung <cyoung06@naver.com> | 2023-02-05 23:02:46 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2023-02-05 23:04:16 +0900 |
commit | 6ef7dd02899795384801c11ffdae9764c27dc238 (patch) | |
tree | 734b86ce888ae17c9b8d5fcb0e58331291f1c8ab /mod/src/main/java/kr/syeyoung/dungeonsguide | |
parent | bfb7f88902585725b58b82f083515d36ac9cf06f (diff) | |
download | Skyblock-Dungeons-Guide-6ef7dd02899795384801c11ffdae9764c27dc238.tar.gz Skyblock-Dungeons-Guide-6ef7dd02899795384801c11ffdae9764c27dc238.tar.bz2 Skyblock-Dungeons-Guide-6ef7dd02899795384801c11ffdae9764c27dc238.zip |
- better precision
- min max in settings (Fixes #301)
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod/src/main/java/kr/syeyoung/dungeonsguide')
18 files changed, 101 insertions, 67 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCFloat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCDouble.java index 5bd47d09..78013434 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCFloat.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCDouble.java @@ -32,37 +32,48 @@ import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.util.ResourceLocation; import org.lwjgl.input.Keyboard; -public class TCFloat implements FeatureTypeHandler<Float> { - public static final TCFloat INSTANCE = new TCFloat(); +public class TCDouble implements FeatureTypeHandler<Double> { + public static final TCDouble INSTANCE = new TCDouble(); @Override - public Float deserialize(JsonElement element) { - return element.getAsFloat(); + public Double deserialize(JsonElement element) { + return element.getAsDouble(); } @Override - public JsonElement serialize(Float element) { + public JsonElement serialize(Double element) { return new JsonPrimitive(element); } @Override public Widget createDefaultWidgetFor(FeatureParameter parameter) { - ParameterItem parameterItem = new ParameterItem(parameter, new FloatEditWidget(parameter)); + ParameterItem parameterItem = new ParameterItem(parameter, new DoubleEditWidget(parameter)); return parameterItem; } - public static class FloatEditWidget extends AnnotatedImportOnlyWidget { + public static class DoubleEditWidget extends AnnotatedImportOnlyWidget { @Bind(variableName = "value") public final BindableAttribute<String> value = new BindableAttribute<>(String.class); - private float truth; + private double truth; - public FloatEditWidget(FeatureParameter<Float> featureParameter) { + private double min; + private double max; + + public DoubleEditWidget(FeatureParameter<Double> featureParameter) { + this(featureParameter, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); + } + + public DoubleEditWidget(FeatureParameter<Double> featureParameter, double min, double max) { super(new ResourceLocation("dungeonsguide:gui/config/parameter/number.gui")); this.truth = featureParameter.getValue(); - value.setValue(String.valueOf(truth)); + this.min = min; + this.max = max; + value.setValue(String.format("%f", truth)); value.addOnUpdate((old, neu) -> { try { truth = Float.parseFloat(neu); + if (truth < min) return; + if (truth > max) return; featureParameter.setValue(truth); } catch (Exception e) { } @@ -73,14 +84,16 @@ public class TCFloat implements FeatureTypeHandler<Float> { public void inc() { Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); truth += (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) ? 1 : 0.1); - value.setValue(String.valueOf(truth)); + if (truth > max) truth = max; + value.setValue(String.format("%f", truth)); } @On(functionName = "dec") public void dec() { Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); truth -= (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) ? 1 : 0.1); - value.setValue(String.valueOf(truth)); + if (truth < min) truth = min; + value.setValue(String.format("%f", truth)); } } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java index 15a5bbe0..56dd9ada 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java @@ -79,7 +79,7 @@ public class ActionMove extends AbstractAction { if (!FeatureRegistry.SECRET_TOGGLE_KEY.isEnabled() || !FeatureRegistry.SECRET_TOGGLE_KEY.togglePathfindStatus) { if (poses != null){ - RenderUtils.drawLinesVec3(poses, actionRouteProperties.getLineColor(), actionRouteProperties.getLineWidth(), partialTicks, true); + RenderUtils.drawLinesVec3(poses, actionRouteProperties.getLineColor(), (float) actionRouteProperties.getLineWidth(), partialTicks, true); } } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionRouteProperties.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionRouteProperties.java index cc215bf5..a26fc2fc 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionRouteProperties.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionRouteProperties.java @@ -26,7 +26,7 @@ public class ActionRouteProperties { private boolean pathfind; private int lineRefreshRate; private AColor lineColor; - private float lineWidth; + private double lineWidth; private boolean beacon; private AColor beaconColor; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditFloat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditFloat.java index 00b9937e..3a668d0f 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditFloat.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditFloat.java @@ -26,7 +26,7 @@ import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabelAndElement; import java.awt.*; -public class ValueEditFloat extends MPanel implements ValueEdit<Float> { +public class ValueEditFloat extends MPanel implements ValueEdit<Double> { private Parameter parameter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorIcePath.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorIcePath.java index d46264f7..e8088828 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorIcePath.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorIcePath.java @@ -141,7 +141,7 @@ public class RoomProcessorIcePath extends GeneralRoomProcessor { super.drawWorld(partialTicks); if (!FeatureRegistry.SOLVER_SILVERFISH.isEnabled()) return; if (!err) - RenderUtils.drawLines(solution, FeatureRegistry.SOLVER_SILVERFISH.getLineColor(),FeatureRegistry.SOLVER_SILVERFISH.getLineWidth(), partialTicks, true); + RenderUtils.drawLines(solution, FeatureRegistry.SOLVER_SILVERFISH.getLineColor(), (float) FeatureRegistry.SOLVER_SILVERFISH.getLineWidth(), partialTicks, true); } public Point getPointOfSilverFishOnMap(BlockPos blockPos) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java index c8de6e5c..97a80656 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java @@ -363,11 +363,11 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { } if (pathFound != null) { - RenderUtils.drawLines(pathFound, FeatureRegistry.SOLVER_BOX.getLineColor(),FeatureRegistry.SOLVER_BOX.getLineWidth(), partialTicks, true); + RenderUtils.drawLines(pathFound, FeatureRegistry.SOLVER_BOX.getLineColor(), (float) FeatureRegistry.SOLVER_BOX.getLineWidth(), partialTicks, true); } } else { if (totalPath != null) { - RenderUtils.drawLines(totalPath, FeatureRegistry.SOLVER_BOX.getLineColor(),FeatureRegistry.SOLVER_BOX.getLineWidth(), partialTicks, false); + RenderUtils.drawLines(totalPath, FeatureRegistry.SOLVER_BOX.getLineColor(), (float) FeatureRegistry.SOLVER_BOX.getLineWidth(), partialTicks, false); } if (totalPushedBlocks != null) { for (int i = 0; i < totalPushedBlocks.size(); i++) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/icefill/RoomProcessorIcePath2.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/icefill/RoomProcessorIcePath2.java index b6bba1f0..66140160 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/icefill/RoomProcessorIcePath2.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/icefill/RoomProcessorIcePath2.java @@ -99,7 +99,7 @@ public class RoomProcessorIcePath2 extends GeneralRoomProcessor { public void drawWorld(float partialTicks) { if (!FeatureRegistry.SOLVER_ICEPATH.isEnabled()) return; for (List<BlockPos> solution:this.solution) - RenderUtils.drawLines(solution, FeatureRegistry.SOLVER_ICEPATH.getLineColor(),FeatureRegistry.SOLVER_ICEPATH.getLineWidth(), partialTicks, true); + RenderUtils.drawLines(solution, FeatureRegistry.SOLVER_ICEPATH.getLineColor(), (float) FeatureRegistry.SOLVER_ICEPATH.getLineWidth(), partialTicks, true); } public static class Generator implements RoomProcessorGenerator<RoomProcessorIcePath2> { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java index 3b009181..f9a558f3 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java @@ -18,8 +18,9 @@ package kr.syeyoung.dungeonsguide.mod.features; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.ParameterItem; import kr.syeyoung.dungeonsguide.mod.config.types.TCBoolean; -import kr.syeyoung.dungeonsguide.mod.config.types.TCFloat; +import kr.syeyoung.dungeonsguide.mod.config.types.TCDouble; import kr.syeyoung.dungeonsguide.mod.config.types.TCKeybind; import kr.syeyoung.dungeonsguide.mod.events.annotations.EventHandlerRegistry; import kr.syeyoung.dungeonsguide.mod.features.impl.advanced.*; @@ -145,11 +146,11 @@ public class FeatureRegistry { if (init) OverlayManager.getEventHandler().guiResize(null); })); - addParameter("scale", new FeatureParameter<Float>("scale", "Scale", "Custom HUD Scale",1.0f, TCFloat.INSTANCE, a -> { + addParameter("scale", new FeatureParameter<Double>("scale", "Scale", "Custom HUD Scale",1.0, TCDouble.INSTANCE, a -> { if (init) OverlayManager.getEventHandler().guiResize(null); - })); + }).setWidgetGenerator((param) -> new ParameterItem(param, new TCDouble.DoubleEditWidget(param, 0.1, Double.POSITIVE_INFINITY)))); init = true; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPeople.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPeople.java index 7e1d6096..771ef5d2 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPeople.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPeople.java @@ -21,7 +21,8 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.advanced; import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftProfileTexture; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; -import kr.syeyoung.dungeonsguide.mod.config.types.TCFloat; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.ParameterItem; +import kr.syeyoung.dungeonsguide.mod.config.types.TCDouble; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonStartedEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; @@ -65,7 +66,7 @@ import static kr.syeyoung.dungeonsguide.mod.utils.TabListUtil.getString; public class FeatureTestPeople extends RawRenderingGuiFeature { Logger logger = LogManager.getLogger("FeatureTestPeople"); - private Float scale; + private Double scale; private Set<String> lastMembersRaw; private boolean broadcastLock; @@ -73,7 +74,8 @@ public class FeatureTestPeople extends RawRenderingGuiFeature { super("Dungeon", "Feature test", "NOU", "", false, 200, 100); - addParameter("scale", new FeatureParameter<>("scale", "Scale", "Scale", 2.0f, TCFloat.INSTANCE, nval -> this.scale = nval)); + addParameter("scale", new FeatureParameter<>("scale", "Scale", "Scale", 2.0, TCDouble.INSTANCE, nval -> this.scale = nval) + .setWidgetGenerator((param) -> new ParameterItem(param, new TCDouble.DoubleEditWidget(param, 0.1, Double.POSITIVE_INFINITY)))); // (new Thread(() -> { // while (true){ diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java index 43763842..3be8695b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java @@ -22,6 +22,7 @@ import com.google.common.collect.ComparisonChain; import com.google.common.collect.Ordering; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.ParameterItem; import kr.syeyoung.dungeonsguide.mod.config.types.*; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.map.DungeonRoomScaffoldParser; @@ -69,14 +70,14 @@ public class FeatureDungeonMap extends RawRenderingGuiFeature { private AColor backgroudColor; private AColor playerColor; private boolean shouldCacheMap; - private float playerHeadScale; + private double playerHeadScale; private boolean shouldShowOtherPlayers; - private float textScale; + private double textScale; private boolean showSecretCount; private boolean showPlayerHeads; private boolean shouldRotateWithPlayer; private boolean shouldScale; - private float postscaleOfMap; + private double postscaleOfMap; private boolean centerMapOnPlayer; public FeatureDungeonMap() { @@ -86,12 +87,15 @@ public class FeatureDungeonMap extends RawRenderingGuiFeature { addParameter("cacheMap", new FeatureParameter<>("cacheMap", "Should cache map data", "name", true, TCBoolean.INSTANCE, nval -> shouldCacheMap = nval)); addParameter("playerCenter", new FeatureParameter<>("playerCenter", "Center map at player", "Render you in the center", false, TCBoolean.INSTANCE, nval -> centerMapOnPlayer = nval)); addParameter("rotate", new FeatureParameter<>("rotate", "Rotate map centered at player", "Only works with Center map at player enabled", false, TCBoolean.INSTANCE, nval -> shouldRotateWithPlayer = nval)); - addParameter("postScale", new FeatureParameter<>("postScale", "Scale factor of map", "Only works with Center map at player enabled", 1.0f, TCFloat.INSTANCE, nval -> postscaleOfMap = nval)); + addParameter("postScale", new FeatureParameter<>("postScale", "Scale factor of map", "Only works with Center map at player enabled", 1.0, TCDouble.INSTANCE, nval -> postscaleOfMap = nval) + .setWidgetGenerator((param) -> new ParameterItem(param, new TCDouble.DoubleEditWidget(param, 0.1, Double.POSITIVE_INFINITY)))); addParameter("useplayerheads", new FeatureParameter<>("useplayerheads", "Use player heads instead of arrows", "Option to use player heads instead of arrows", true, TCBoolean.INSTANCE, nval -> showPlayerHeads = nval)); addParameter("showotherplayers", new FeatureParameter<>("showotherplayers", "Show other players", "Option to show other players in map", true, TCBoolean.INSTANCE, nval -> shouldShowOtherPlayers = nval)); addParameter("showtotalsecrets", new FeatureParameter<>("showtotalsecrets", "Show Total secrets in the room", "Option to overlay total secrets in the specific room", true, TCBoolean.INSTANCE, nval -> showSecretCount = nval)); - addParameter("playerheadscale", new FeatureParameter<>("playerheadscale", "Player head scale", "Scale factor of player heads, defaults to 1", 1.0f, TCFloat.INSTANCE, nval -> playerHeadScale = nval)); - addParameter("textScale", new FeatureParameter<>("textScale", "Text scale", "Scale factor of texts on map, defaults to 1", 1.0f, TCFloat.INSTANCE, nval -> textScale = nval)); + addParameter("playerheadscale", new FeatureParameter<>("playerheadscale", "Player head scale", "Scale factor of player heads, defaults to 1", 1.0, TCDouble.INSTANCE, nval -> playerHeadScale = nval) + .setWidgetGenerator((param) -> new ParameterItem(param, new TCDouble.DoubleEditWidget(param, 0.1, Double.POSITIVE_INFINITY)))); + addParameter("textScale", new FeatureParameter<>("textScale", "Text scale", "Scale factor of texts on map, defaults to 1", 1.0, TCDouble.INSTANCE, nval -> textScale = nval) + .setWidgetGenerator((param) -> new ParameterItem(param, new TCDouble.DoubleEditWidget(param, 0.1, Double.POSITIVE_INFINITY)))); addParameter("border_color", new FeatureParameter<>("border_color", "Color of the border", "Same as name", new AColor(255, 255, 255, 255), TCAColor.INSTANCE)); addParameter("background_color", new FeatureParameter<>("background_color", "Color of the background", "Same as name", new AColor(0x22000000, true), TCAColor.INSTANCE, nval -> backgroudColor = nval)); @@ -168,7 +172,7 @@ public class FeatureDungeonMap extends RawRenderingGuiFeature { public void renderMap(float partialTicks, DungeonRoomScaffoldParser mapProcessor, MapData mapData, DungeonContext context) { EntityPlayer p = Minecraft.getMinecraft().thePlayer; - float postScale = this.centerMapOnPlayer ? postscaleOfMap : 1; + double postScale = this.centerMapOnPlayer ? postscaleOfMap : 1; GUIPosition featureRect = getFeatureRect(); int width = featureRect.getWidth().intValue(); @@ -353,7 +357,7 @@ public class FeatureDungeonMap extends RawRenderingGuiFeature { } - private void renderHeads(DungeonRoomScaffoldParser mapProcessor, MapData mapData, float scale, float postScale, float partialTicks) { + private void renderHeads(DungeonRoomScaffoldParser mapProcessor, MapData mapData, float scale, double postScale, float partialTicks) { EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; Set<TabListEntry> playerList = getPlayerListCached(); @@ -413,7 +417,7 @@ public class FeatureDungeonMap extends RawRenderingGuiFeature { * @param pt2 * @param yaw2 */ - private void drawHead(float scale, float postScale, TabListEntry networkPlayerInfo, EntityPlayer entityPlayer, Vector2d pt2, float yaw2) { + private void drawHead(float scale, double postScale, TabListEntry networkPlayerInfo, EntityPlayer entityPlayer, Vector2d pt2, float yaw2) { GlStateManager.pushMatrix(); boolean flag1 = entityPlayer != null && entityPlayer.isWearing(EnumPlayerModelParts.CAPE); GlStateManager.enableTexture2D(); @@ -441,7 +445,7 @@ public class FeatureDungeonMap extends RawRenderingGuiFeature { private static final ResourceLocation mapIcons = new ResourceLocation("textures/map/map_icons.png"); - private void renderArrows(MapData mapData, float scale, float postScale) { + private void renderArrows(MapData mapData, float scale, double postScale) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int k = 0; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDecreaseExplosionSound.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDecreaseExplosionSound.java index 5f7d17dd..054a1e89 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDecreaseExplosionSound.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDecreaseExplosionSound.java @@ -20,7 +20,8 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.TCFloat; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.ParameterItem; +import kr.syeyoung.dungeonsguide.mod.config.types.TCDouble; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; @@ -30,7 +31,8 @@ import net.minecraftforge.client.event.sound.PlaySoundEvent; public class FeatureDecreaseExplosionSound extends SimpleFeature { public FeatureDecreaseExplosionSound() { super("Misc", "Decrease Explosion sound effect", "Decreases volume of explosions while on skyblock", "qol.explosionsound"); - addParameter("sound", new FeatureParameter<Float>("sound", "Sound Multiplier %", "The volume of explosion effect will be multiplied by this value. 0~100", 10.0f, TCFloat.INSTANCE)); + addParameter("sound", new FeatureParameter<Double>("sound", "Sound Multiplier %", "The volume of explosion effect will be multiplied by this value. 0~100", 10.0, TCDouble.INSTANCE) + .setWidgetGenerator((param) -> new ParameterItem(param, new TCDouble.DoubleEditWidget(param, 0, 100)))); } @DGEventHandler @@ -41,7 +43,7 @@ public class FeatureDecreaseExplosionSound extends SimpleFeature { PositionedSoundRecord positionedSoundRecord = (PositionedSoundRecord) soundEvent.result; PositionedSoundRecord neweff = new PositionedSoundRecord( positionedSoundRecord.getSoundLocation(), - positionedSoundRecord.getVolume() * (this.<Float>getParameter("sound").getValue() / 100), + (float) (positionedSoundRecord.getVolume() * (this.<Double>getParameter("sound").getValue() / 100)), positionedSoundRecord.getPitch(), positionedSoundRecord.getXPosF(), positionedSoundRecord.getYPosF(), diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/PathfindLineProperties.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/PathfindLineProperties.java index fd49c21d..7afe42a3 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/PathfindLineProperties.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/PathfindLineProperties.java @@ -18,6 +18,7 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.secret; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.ParameterItem; import kr.syeyoung.dungeonsguide.mod.config.types.*; import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRouteProperties; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; @@ -35,7 +36,8 @@ public class PathfindLineProperties extends SimpleFeature { addParameter("useGlobal", new FeatureParameter<Boolean>("useGlobal", "Use Global Settings instead of this", "Completely ignore these settings, then use the parent one:: '"+parent.getName()+"'", useParent, TCBoolean.INSTANCE)); addParameter("pathfind", new FeatureParameter<Boolean>("pathfind", "Enable Pathfinding", "Enable pathfind for secrets", useParent, TCBoolean.INSTANCE)); addParameter("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the pathfind line", new AColor(0xFFFF0000, true), TCAColor.INSTANCE)); - addParameter("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the pathfind line",1.0f, TCFloat.INSTANCE)); + addParameter("lineWidth", new FeatureParameter<Double>("lineWidth", "Line Thickness", "Thickness of the pathfind line",1.0, TCDouble.INSTANCE) + .setWidgetGenerator((param) -> new ParameterItem(param, new TCDouble.DoubleEditWidget(param, 0.1, Double.POSITIVE_INFINITY)))); addParameter("linerefreshrate", new FeatureParameter<Integer>("linerefreshrate", "Line Refreshrate", "Ticks to wait per line refresh. Specify it to -1 to don't refresh line at all", 10, TCInteger.INSTANCE)); addParameter("beacon", new FeatureParameter<Boolean>("beacon", "Enable Beacons", "Enable beacons for pathfind line targets", true, TCBoolean.INSTANCE)); addParameter("beamColor", new FeatureParameter<AColor>("beamColor", "Beam Color", "Color of the beacon beam", new AColor(0x77FF0000, true), TCAColor.INSTANCE)); @@ -59,8 +61,8 @@ public class PathfindLineProperties extends SimpleFeature { public AColor getLineColor() { return isGlobal() ? parent.getLineColor() : this.<AColor>getParameter("lineColor").getValue(); } - public float getLineWidth() { - return isGlobal() ? parent.getLineWidth() : this.<Float>getParameter("lineWidth").getValue(); + public double getLineWidth() { + return isGlobal() ? parent.getLineWidth() : this.<Double>getParameter("lineWidth").getValue(); } public int getRefreshRate() { return isGlobal() ? parent.getRefreshRate() : this.<Integer>getParameter("linerefreshrate").getValue(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java index 3795e3b5..7b805234 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java @@ -21,8 +21,9 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.ParameterItem; import kr.syeyoung.dungeonsguide.mod.config.types.GUIPosition; -import kr.syeyoung.dungeonsguide.mod.config.types.TCFloat; +import kr.syeyoung.dungeonsguide.mod.config.types.TCDouble; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRoute; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; @@ -62,18 +63,19 @@ public class FeatureMechanicBrowse extends RawRenderingGuiFeature { public FeatureMechanicBrowse() { super("Dungeon.Secrets.Secret Browser","Secret Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300); - addParameter("scale", new FeatureParameter<Float>("scale", "Scale", "Scale", 1.0f, TCFloat.INSTANCE)); + addParameter("scale", new FeatureParameter<Double>("scale", "Scale", "Scale", 1.0, TCDouble.INSTANCE) + .setWidgetGenerator((param) -> new ParameterItem(param, new TCDouble.DoubleEditWidget(param, 0.1, Double.POSITIVE_INFINITY)))); } public double getScale() { - return this.<Float>getParameter("scale").getValue(); + return this.<Double>getParameter("scale").getValue(); } @Override public void drawDemo(float partialTicks) { - double scale = FeatureMechanicBrowse.this.<Float>getParameter("scale").getValue(); + double scale = FeatureMechanicBrowse.this.<Double>getParameter("scale").getValue(); GlStateManager.scale(scale, scale, 1.0); GUIPosition bigDim = getFeatureRect(); @@ -104,7 +106,7 @@ public class FeatureMechanicBrowse extends RawRenderingGuiFeature { if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return; GeneralRoomProcessor grp = (GeneralRoomProcessor) dungeonRoom.getRoomProcessor(); - double scale = FeatureMechanicBrowse.this.<Float>getParameter("scale").getValue(); + double scale = FeatureMechanicBrowse.this.<Double>getParameter("scale").getValue(); GlStateManager.scale(scale, scale, 1.0); GUIPosition bigDim = getFeatureRect(); @@ -157,9 +159,9 @@ public class FeatureMechanicBrowse extends RawRenderingGuiFeature { public void getTooltipForEditor(List<Widget> widgets) { super.getTooltipForEditor(widgets); -// mPanels.add(new MPassiveLabelAndElement("Scale", new MFloatSelectionButton(FeatureMechanicBrowse.this.<Float>getParameter("scale").getValue()) {{ +// mPanels.add(new MPassiveLabelAndElement("Scale", new MFloatSelectionButton(FeatureMechanicBrowse.this.<Double>getParameter("scale").getValue()) {{ // setOnUpdate(() ->{ -// FeatureMechanicBrowse.this.<Float>getParameter("scale").setValue(this.getData()); +// FeatureMechanicBrowse.this.<Double>getParameter("scale").setValue(this.getData()); // }); } // })); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverBox.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverBox.java index f1e5bc98..16cf55b8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverBox.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverBox.java @@ -18,10 +18,11 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.solvers; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.ParameterItem; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.config.types.TCAColor; import kr.syeyoung.dungeonsguide.mod.config.types.TCBoolean; -import kr.syeyoung.dungeonsguide.mod.config.types.TCFloat; +import kr.syeyoung.dungeonsguide.mod.config.types.TCDouble; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; @@ -33,7 +34,8 @@ public class FeatureSolverBox extends SimpleFeature { this.parameters = new LinkedHashMap<>(); addParameter("disableText", new FeatureParameter<Boolean>("disableText", "Box Puzzle Solver Disable text", "Disable 'Type recalc to recalculate solution' showing up on top left.\nYou can still type recalc to recalc solution after disabling this feature", false, TCBoolean.INSTANCE)); addParameter("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the solution line", new AColor(0xFF00FF00, true), TCAColor.INSTANCE)); - addParameter("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0f, TCFloat.INSTANCE)); + addParameter("lineWidth", new FeatureParameter<Double>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0, TCDouble.INSTANCE) + .setWidgetGenerator((param) -> new ParameterItem(param, new TCDouble.DoubleEditWidget(param, 0.1, Double.POSITIVE_INFINITY)))); addParameter("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the target button", new AColor(0x5500FFFF, true), TCAColor.INSTANCE)); addParameter("textColor1", new FeatureParameter<AColor>("textColor1", "Text Color", "Color of the text (next step)", new AColor(0xFF00FF00, true), TCAColor.INSTANCE)); @@ -42,8 +44,8 @@ public class FeatureSolverBox extends SimpleFeature { public AColor getLineColor() { return this.<AColor>getParameter("lineColor").getValue(); } - public float getLineWidth() { - return this.<Float>getParameter("lineWidth").getValue(); + public double getLineWidth() { + return this.<Double>getParameter("lineWidth").getValue(); } public boolean disableText() { return this.<Boolean>getParameter("disableText").getValue(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverIcefill.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverIcefill.java index f9415f75..2dacf1da 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverIcefill.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverIcefill.java @@ -18,9 +18,10 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.solvers; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.ParameterItem; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.config.types.TCAColor; -import kr.syeyoung.dungeonsguide.mod.config.types.TCFloat; +import kr.syeyoung.dungeonsguide.mod.config.types.TCDouble; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; @@ -31,12 +32,13 @@ public class FeatureSolverIcefill extends SimpleFeature { super("Dungeon.Solvers.Floor 3+", "Icepath (Advanced)", "Calculates solution for icepath puzzle and displays it to user", "solver.icepath"); this.parameters = new LinkedHashMap<>(); addParameter("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the solution line", new AColor(0xFF00FF00, true), TCAColor.INSTANCE)); - addParameter("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0f, TCFloat.INSTANCE)); + addParameter("lineWidth", new FeatureParameter<Double>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0, TCDouble.INSTANCE) + .setWidgetGenerator((param) -> new ParameterItem(param, new TCDouble.DoubleEditWidget(param, 0.1, Double.POSITIVE_INFINITY)))); } public AColor getLineColor() { return this.<AColor>getParameter("lineColor").getValue(); } - public float getLineWidth() { - return this.<Float>getParameter("lineWidth").getValue(); + public double getLineWidth() { + return this.<Double>getParameter("lineWidth").getValue(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverSilverfish.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverSilverfish.java index 053f452b..eb7f543e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverSilverfish.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverSilverfish.java @@ -18,9 +18,10 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.solvers; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.ParameterItem; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.config.types.TCAColor; -import kr.syeyoung.dungeonsguide.mod.config.types.TCFloat; +import kr.syeyoung.dungeonsguide.mod.config.types.TCDouble; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; @@ -31,16 +32,17 @@ public class FeatureSolverSilverfish extends SimpleFeature { super("Dungeon.Solvers.Floor 3+", "Silverfish (Advanced)", "Actively calculates solution for silverfish puzzle and displays it to user", "solver.silverfish"); this.parameters = new LinkedHashMap<>(); addParameter("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the solution line", new AColor(0xFF00FF00, true), TCAColor.INSTANCE, nval -> lineColor = nval)); - addParameter("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0f, TCFloat.INSTANCE, nval -> lineWidth = nval)); + addParameter("lineWidth", new FeatureParameter<Double>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0, TCDouble.INSTANCE, nval -> lineWidth = nval) + .setWidgetGenerator((param) -> new ParameterItem(param, new TCDouble.DoubleEditWidget(param, 0.1, Double.POSITIVE_INFINITY)))); } AColor lineColor; - Float lineWidth; + Double lineWidth; public AColor getLineColor() { return lineColor; } - public float getLineWidth() { + public double getLineWidth() { return lineWidth; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java index 90ef0ffe..5c2ff8ff 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java @@ -18,6 +18,7 @@ package kr.syeyoung.dungeonsguide.mod.features.text; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.ParameterItem; import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location2.MarkerProvider; import kr.syeyoung.dungeonsguide.mod.config.types.*; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; @@ -49,7 +50,8 @@ public abstract class TextHUDFeature extends AbstractHUDFeature implements Style addParameter("textStylesNEW", new FeatureParameter<List<TextStyle>>("textStylesNEW", "", "", new ArrayList<TextStyle>(), TCTextStyleList.INSTANCE) .setWidgetGenerator((param) -> new CompatLayer(new PanelTextParameterConfig(TextHUDFeature.this)))); addParameter("alignment", new FeatureParameter<RichText.TextAlign>("alignment", "Alignment", "Alignment", RichText.TextAlign.LEFT, new TCEnum<>(RichText.TextAlign.values()), richText::setAlign)); - addParameter("scale", new FeatureParameter<Float>("scale", "Scale", "Scale", 1.0f, TCFloat.INSTANCE)); + addParameter("scale", new FeatureParameter<Double>("scale", "Scale", "Scale", 1.0, TCDouble.INSTANCE) + .setWidgetGenerator((param) -> new ParameterItem(param, new TCDouble.DoubleEditWidget(param, 0.1, Double.POSITIVE_INFINITY)))); } @Override @@ -77,7 +79,7 @@ public abstract class TextHUDFeature extends AbstractHUDFeature implements Style List<StyledText> asd = getText(); ParentDelegatingTextStyle defaultStyle = ParentDelegatingTextStyle.ofDefault(); - defaultStyle.setSize((double) (this.<Float>getParameter("scale").getValue() * 8)); + defaultStyle.setSize((double) (this.<Double>getParameter("scale").getValue() * 8)); TextSpan span = new TextSpan(defaultStyle, ""); @@ -100,7 +102,7 @@ public abstract class TextHUDFeature extends AbstractHUDFeature implements Style @Override public void drawDemo(float partialTicks) { List<StyledText> asd = getDummyText(); - double scale = this.<Float>getParameter("scale").getValue(); + double scale = this.<Double>getParameter("scale").getValue(); GlStateManager.scale(scale, scale, 0); StyledTextRenderer.drawTextWithStylesAssociated(asd, 0, 0, 100, getStylesMap(), @@ -146,7 +148,7 @@ public abstract class TextHUDFeature extends AbstractHUDFeature implements Style ); ParentDelegatingTextStyle defaultStyle = ParentDelegatingTextStyle.ofDefault(); - defaultStyle.setSize((double) (hudFeature.<Float>getParameter("scale").getValue() * 8)); + defaultStyle.setSize((double) (hudFeature.<Double>getParameter("scale").getValue() * 8)); TextSpan span = new TextSpan(defaultStyle, ""); @@ -220,9 +222,9 @@ public abstract class TextHUDFeature extends AbstractHUDFeature implements Style // }); // // mPanels.add(new MPassiveLabelAndElement("Alignment", mStringSelectionButton)); -// mPanels.add(new MPassiveLabelAndElement("Scale", new MFloatSelectionButton(TextHUDFeature.this.<Float>getParameter("scale").getValue()) {{ +// mPanels.add(new MPassiveLabelAndElement("Scale", new MFloatSelectionButton(TextHUDFeature.this.<Double>getParameter("scale").getValue()) {{ // setOnUpdate(() ->{ -// TextHUDFeature.this.<Float>getParameter("scale").setValue(this.getData()); +// TextHUDFeature.this.<Double>getParameter("scale").setValue(this.getData()); // }); } // })); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/GlobalHUDScale.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/GlobalHUDScale.java index 1feab6e3..13a7286b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/GlobalHUDScale.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/GlobalHUDScale.java @@ -49,7 +49,7 @@ public class GlobalHUDScale extends Widget implements Layouter, Renderer { private double getScale() { boolean useMc = FeatureRegistry.GLOBAL_HUD_SCALE.<Boolean>getParameter("mc").getValue(); if (useMc) return (double) new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor(); - else return FeatureRegistry.GLOBAL_HUD_SCALE.<Float>getParameter("scale").getValue(); + else return FeatureRegistry.GLOBAL_HUD_SCALE.<Double>getParameter("scale").getValue(); } private double scale; |