diff options
author | syeyoung <cyong06@naver.com> | 2021-02-26 02:01:03 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-26 02:01:03 +0900 |
commit | ab5dc44e4f57d5f11da64f360e65e21866eb2f6a (patch) | |
tree | f0eba665fed9dd754155d52232bfaeef274f4c5b /src/main/java/kr/syeyoung/dungeonsguide | |
parent | 3fbf9d1a6810485279ec3eed0378614a59a2315c (diff) | |
download | Skyblock-Dungeons-Guide-ab5dc44e4f57d5f11da64f360e65e21866eb2f6a.tar.gz Skyblock-Dungeons-Guide-ab5dc44e4f57d5f11da64f360e65e21866eb2f6a.tar.bz2 Skyblock-Dungeons-Guide-ab5dc44e4f57d5f11da64f360e65e21866eb2f6a.zip |
HEX in color editor
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide')
7 files changed, 63 insertions, 26 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index 9d87c25d..a1fff77a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -41,29 +41,29 @@ public class FeatureRegistry { } public static final SimpleFeature DEBUG = register(new SimpleFeature("hidden", "Debug", "Toggles debug mode", "debug", false)); - public static final SimpleFeature ADVANCED_ROOMEDIT = register(new SimpleFeature("advanced", "Room Edit", "Allow editing dungeon rooms\n\nWarning: using this feature can break or freeze your Minecraft\nThis is only for advanced users only", "advanced.roomedit", false)); + public static final SimpleFeature ADVANCED_ROOMEDIT = register(new SimpleFeature("Advanced", "Room Edit", "Allow editing dungeon rooms\n\nWarning: using this feature can break or freeze your Minecraft\nThis is only for advanced users only", "advanced.roomedit", false)); public static final FeatureRoomDebugInfo ADVANCED_DEBUG_ROOM = register(new FeatureRoomDebugInfo()); public static final FeatureDebuggableMap ADVANCED_DEBUGGABLE_MAP = register(new FeatureDebuggableMap()); public static final FeatureRoomCoordDisplay ADVANCED_COORDS = register(new FeatureRoomCoordDisplay()); - public static final SimpleFeature SOLVER_RIDDLE = register(new SimpleFeature("solver", "Riddle Puzzle (3 weirdo) Solver", "Highlights the correct box after clicking on all 3 weirdos", "solver.riddle")); - public static final SimpleFeature SOLVER_KAHOOT = register(new SimpleFeature("solver", "Trivia Puzzle (Omnicrescent) Solver", "Highlights the correct solution for trivia puzzle", "solver.trivia")); - public static final SimpleFeature SOLVER_BLAZE = register(new SimpleFeature("solver", "Blaze Puzzle Solver", "Highlights the blaze that needs to be killed in an blaze room", "solver.blaze")); - public static final SimpleFeature SOLVER_TICTACTOE = register(new SimpleFeature("solver", "Tictactoe Solver", "Shows the best move that could be taken by player in the tictactoe room", "solver.tictactoe")); - public static final SimpleFeature SOLVER_ICEPATH = register(new SimpleFeature("solver", "Icepath Puzzle Solver (Advanced)", "Calculates solution for icepath puzzle and displays it to user", "solver.icepath")); - public static final SimpleFeature SOLVER_SILVERFISH = register(new SimpleFeature("solver", "Silverfish Puzzle Solver (Advanced)", "Actively calculates solution for silverfish puzzle and displays it to user", "solver.silverfish")); - public static final SimpleFeature SOLVER_WATERPUZZLE = register(new SimpleFeature("solver", "Waterboard Puzzle Solver (Advanced)", "Calculates solution for waterboard puzzle and displays it to user", "solver.waterboard")); - public static final SimpleFeature SOLVER_BOX = register(new SimpleFeature("solver", "Box Puzzle Solver (Advanced)", "Calculates solution for box puzzle room, and displays it to user", "solver.box")); - public static final SimpleFeature SOLVER_CREEPER = register(new SimpleFeature("solver", "Creeper Puzzle Solver", "Draws line between prismarine lamps in creeper room", "solver.creeper")); - public static final SimpleFeature SOLVER_TELEPORT = register(new SimpleFeature("solver", "Teleport Puzzle Solver", "Shows teleport pads you've visited in a teleport maze room", "solver.teleport")); - public static final SimpleFeature SOLVER_BOMBDEFUSE = register(new SimpleFeature("solver", "Bomb Defuse Puzzle Solver", "Communicates with others dg using key 'F' for solutions and displays it", "solver.bombdefuse")); + public static final SimpleFeature SOLVER_RIDDLE = register(new SimpleFeature("Solver", "Riddle Puzzle (3 weirdo) Solver", "Highlights the correct box after clicking on all 3 weirdos", "solver.riddle")); + public static final SimpleFeature SOLVER_KAHOOT = register(new SimpleFeature("Solver", "Trivia Puzzle (Omnicrescent) Solver", "Highlights the correct solution for trivia puzzle", "solver.trivia")); + public static final SimpleFeature SOLVER_BLAZE = register(new SimpleFeature("Solver", "Blaze Puzzle Solver", "Highlights the blaze that needs to be killed in an blaze room", "solver.blaze")); + public static final SimpleFeature SOLVER_TICTACTOE = register(new SimpleFeature("Solver", "Tictactoe Solver", "Shows the best move that could be taken by player in the tictactoe room", "solver.tictactoe")); + public static final SimpleFeature SOLVER_ICEPATH = register(new SimpleFeature("Solver", "Icepath Puzzle Solver (Advanced)", "Calculates solution for icepath puzzle and displays it to user", "solver.icepath")); + public static final SimpleFeature SOLVER_SILVERFISH = register(new SimpleFeature("Solver", "Silverfish Puzzle Solver (Advanced)", "Actively calculates solution for silverfish puzzle and displays it to user", "solver.silverfish")); + public static final SimpleFeature SOLVER_WATERPUZZLE = register(new SimpleFeature("Solver", "Waterboard Puzzle Solver (Advanced)", "Calculates solution for waterboard puzzle and displays it to user", "solver.waterboard")); + public static final SimpleFeature SOLVER_BOX = register(new SimpleFeature("Solver", "Box Puzzle Solver (Advanced)", "Calculates solution for box puzzle room, and displays it to user", "solver.box")); + public static final SimpleFeature SOLVER_CREEPER = register(new SimpleFeature("Solver", "Creeper Puzzle Solver", "Draws line between prismarine lamps in creeper room", "solver.creeper")); + public static final SimpleFeature SOLVER_TELEPORT = register(new SimpleFeature("Solver", "Teleport Puzzle Solver", "Shows teleport pads you've visited in a teleport maze room", "solver.teleport")); + public static final SimpleFeature SOLVER_BOMBDEFUSE = register(new SimpleFeature("Solver", "Bomb Defuse Puzzle Solver", "Communicates with others dg using key 'F' for solutions and displays it", "solver.bombdefuse")); public static final FeatureTooltipDungeonStat ETC_DUNGEONSTAT = register(new FeatureTooltipDungeonStat()); public static final FeatureTooltipPrice ETC_PRICE = register(new FeatureTooltipPrice()); public static final FeatureCooldownCounter ETC_COOLDOWN = register(new FeatureCooldownCounter()); public static final SimpleFeature ETC_REMOVE_REPARTY = register(new SimpleFeature("ETC", "Remove Reparty Command From DG", "/dg reparty will still work, Auto reparty will still work\nRequires Restart to get applied", "qol.noreparty")); - public static final SimpleFeature FIX_SPIRIT_BOOTS = register(new SimpleFeature("fixes", "Spirit Boots Fixer", "Fix Spirit boots messing up with inventory", "fixes.spirit", true)); + public static final SimpleFeature FIX_SPIRIT_BOOTS = register(new SimpleFeature("Fixes", "Spirit Boots Fixer", "Fix Spirit boots messing up with inventory", "fixes.spirit", true)); public static final FeatureDisableMessage FIX_MESSAGES = register(new FeatureDisableMessage()); public static final FeatureCopyMessages ETC_COPY_MSG = register(new FeatureCopyMessages()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java index ffbf6f37..97c3f7db 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java @@ -25,7 +25,7 @@ import java.awt.*; public class FeatureDebuggableMap extends GuiFeature { public FeatureDebuggableMap() { - super("advanced", "Display Debug info included map", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.map", true, 128, 128); + super("Advanced", "Display Debug info included map", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.map", true, 128, 128); this.setEnabled(false); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java index ba107312..ada1e3ef 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java @@ -20,7 +20,7 @@ import java.awt.*; public class FeatureRoomCoordDisplay extends GuiFeature { public FeatureRoomCoordDisplay() { - super("advanced", "Display Coordinate Relative to the Dungeon Room and room's rotation", "X: 0 Y: 3 Z: 5 Facing: Z+" , "advanced.coords", false, getFontRenderer().getStringWidth("X: 48 Y: 100 Z: 48 Facing: Z+"), 10); + super("Advanced", "Display Coordinate Relative to the Dungeon Room and room's rotation", "X: 0 Y: 3 Z: 5 Facing: Z+" , "advanced.coords", false, getFontRenderer().getStringWidth("X: 48 Y: 100 Z: 48 Facing: Z+"), 10); this.setEnabled(false); parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.yellow, "color")); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java index 3fc92f8f..16016e05 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java @@ -23,7 +23,7 @@ import java.util.regex.Pattern; public class FeatureRoomDebugInfo extends GuiFeature { public FeatureRoomDebugInfo() { - super("advanced", "Display Room Debug Info", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.roominfo", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6); + super("Advanced", "Display Room Debug Info", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.roominfo", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6); this.setEnabled(false); parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.white, "color")); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java index 2c562883..74f577ad 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java @@ -37,7 +37,7 @@ public class FeatureDisableMessage extends SimpleFeature implements ChatListener }; public FeatureDisableMessage() { - super("fixes", "Disable ability messages", "Do not let ability messages show up in chatbox\nclick on Edit for more precise settings", "fixes.messagedisable", true); + super("Fixes", "Disable ability messages", "Do not let ability messages show up in chatbox\nclick on Edit for more precise settings", "fixes.messagedisable", true); for (MessageData messageData : PRE_DEFINED) { this.parameters.put(messageData.key, new FeatureParameter<Boolean>(messageData.key, messageData.name, messageData.description, true, "boolean")); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java index 7c79c805..7a96264f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java @@ -60,13 +60,14 @@ public class MEditableAColor extends MPanel { portable = new MPortableColorEdit() { @Override public void update2() { + super.update2(); MEditableAColor.this.color = portable.getColor(); if (onUpdate != null) onUpdate.run(); } }; portable.setColor(color); - portable.setBounds(new Rectangle(relMouseX, relMouseY, 100, 60)); + portable.setBounds(new Rectangle(relMouseX, relMouseY, 100, 90)); add(portable); } else if (portable != null && !portable.getBounds().contains(relMouseX, relMouseY)) { remove(portable); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java index 360b4f0c..138846b8 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java @@ -13,6 +13,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.MathHelper; +import org.apache.commons.lang3.StringUtils; import org.lwjgl.opengl.GL11; import java.awt.*; @@ -26,12 +27,45 @@ public class MPortableColorEdit extends MPanel { @Getter private AColor color; + private MTextField textField; + + public MPortableColorEdit() { + textField = new MTextField() { + @Override + public void edit(String str) { + if (str.length() >= 7 && str.startsWith("#")) { + String color = str.substring(1); + try { + long colorInt = Long.parseLong(color, 16); + + Color.RGBtoHSB((int) (colorInt >> 16) & 0xFF, (int) (colorInt >> 8) & 0xFF, (int) colorInt & 0xFF, hsv); + if (color.length() >= 8) + alpha = ((int) ((colorInt >> 24) & 0xFF)) / 255.0f; + update2(); + } catch (Exception e) {} + } + } + }; + add(textField); + } + + @Override + public void onBoundsUpdate() { + super.onBoundsUpdate(); + + textField.setBounds(new Rectangle(5, getBounds().height - 25, getBounds().width - 10, 20)); + } + public void setColor(AColor color) { this.color = color; alpha = color.getAlpha() / 255.0f; chromaSpeed = color.isChroma() ? color.getChromaSpeed() : 0; Color.RGBtoHSB(color.getRed(), color.getBlue(), color.getGreen(), hsv); + + int rgb = Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]); + rgb = (rgb & 0xFFFFFF) | ((int)(alpha * 255) << 24); + textField.setText("#" + StringUtils.leftPad(Integer.toHexString(rgb).toUpperCase(), 8, '0')); } @Override @@ -40,7 +74,7 @@ public class MPortableColorEdit extends MPanel { Gui.drawRect(0,0,getSize().width,getSize().height, 0xff333333); Gui.drawRect(1,1,getSize().width-1,getSize().height-1, 0xffa1a1a1); - int width = getBounds().height- 10; + int width = getBounds().height- 35; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int shademodel = GL11.glGetInteger(GL11.GL_SHADE_MODEL); @@ -185,7 +219,7 @@ public class MPortableColorEdit extends MPanel { for (MPanel mPanel : getChildComponents()){ GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); - mPanel.render0(resolution, newPt, clip, absMousex, absMousey, relMousex, relMousey, partialTicks); + mPanel.render0(resolution, newPt, new Rectangle(newPt, new Dimension(getBounds().getSize())), absMousex, absMousey, relMousex, relMousey, partialTicks); GlStateManager.popAttrib(); GlStateManager.popMatrix(); } @@ -195,7 +229,7 @@ public class MPortableColorEdit extends MPanel { @Override public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - int width = getBounds().height- 10; + int width = getBounds().height- 35; float radius = width / 2f; float circleX = 5 + radius; float circleY = 5 + radius; @@ -240,7 +274,7 @@ public class MPortableColorEdit extends MPanel { @Override public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) { - int width = getBounds().height- 10; + int width = getBounds().height- 35; float radius = width / 2f; float circleX = 5 + radius; float circleY = 5 + radius; @@ -270,13 +304,15 @@ public class MPortableColorEdit extends MPanel { public void update() { - color = new AColor(Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0xffffff | (MathHelper.clamp_int((int)(alpha * 255), 0, 255) << 24), true); - color.setChromaSpeed(chromaSpeed); - color.setChroma(chromaSpeed != 0); + int rgb = Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]); + rgb = (rgb & 0xFFFFFF) | ((int)(alpha * 255) << 24); + textField.setText("#" + StringUtils.leftPad(Integer.toHexString(rgb).toUpperCase(), 8, '0')); update2(); } public void update2() { - + color = new AColor(Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0xffffff | (MathHelper.clamp_int((int)(alpha * 255), 0, 255) << 24), true); + color.setChromaSpeed(chromaSpeed); + color.setChroma(chromaSpeed != 0); } } |