aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-05-15 19:52:43 +0900
committersyeyoung <cyong06@naver.com>2021-05-15 19:52:43 +0900
commite0a46c19ab3e1cab3f3b2f2696094930348f2575 (patch)
tree8c0bd56042c8487fe415ed00225f1fd11aa31362 /src/main/java/kr/syeyoung
parent1067d2162b54ce172e3dbfce2e80f3532374eb21 (diff)
downloadSkyblock-Dungeons-Guide-e0a46c19ab3e1cab3f3b2f2696094930348f2575.tar.gz
Skyblock-Dungeons-Guide-e0a46c19ab3e1cab3f3b2f2696094930348f2575.tar.bz2
Skyblock-Dungeons-Guide-e0a46c19ab3e1cab3f3b2f2696094930348f2575.zip
Chroma lines
Diffstat (limited to 'src/main/java/kr/syeyoung')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java22
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java6
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java3
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathLeftProcessor.java3
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathRightProcessor.java3
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java5
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java3
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java32
8 files changed, 58 insertions, 19 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
index d6a45487..8415d2b7 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
@@ -23,6 +23,7 @@ import kr.syeyoung.dungeonsguide.DungeonsGuide;
import kr.syeyoung.dungeonsguide.SkyblockStatus;
import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig;
import kr.syeyoung.dungeonsguide.config.guiconfig.GuiGuiLocationConfig;
+import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute;
import kr.syeyoung.dungeonsguide.dungeon.mechanics.*;
@@ -58,13 +59,13 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis
public FeatureMechanicBrowse() {
super("Secret","Mechanic(Secret) Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300);
- parameters.put("linecolor", new FeatureParameter<Color>("linecolor", "Color", "Color of Pathfind line", Color.green, "color"));
+ parameters.put("linecolor2", new FeatureParameter<AColor>("linecolor2", "Color", "Color of Pathfind line", new AColor(0xFF00FF00, true), "acolor"));
parameters.put("linethickness", new FeatureParameter<Float>("linethickness", "Thickness", "Thickness of Pathfind line", 1.0f, "float"));
parameters.put("refreshrate", new FeatureParameter<Integer>("refreshrate", "Line Refreshrate", "How many ticks per line refresh?", 10, "integer"));
}
- public Color getColor() {
- return this.<Color>getParameter("linecolor").getValue();
+ public AColor getColor() {
+ return this.<AColor>getParameter("linecolor2").getValue();
}
public float getThickness() {
return this.<Float>getParameter("linethickness").getValue();
@@ -218,15 +219,18 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis
GlStateManager.popMatrix();
if (selected != -1) {
- clip(new ScaledResolution(Minecraft.getMinecraft()), feature.x + feature.width, feature.y + fr.FONT_HEIGHT + 5, feature.width , feature.height - fr.FONT_HEIGHT - 6);
- GlStateManager.translate(feature.width, selected * fr.FONT_HEIGHT, 0);
+
+ boolean overFlows = new ScaledResolution(Minecraft.getMinecraft()).getScaledWidth() < feature.x + feature.width;
+
+ clip(new ScaledResolution(Minecraft.getMinecraft()), overFlows ? feature.x - feature.width : feature.width, feature.y + fr.FONT_HEIGHT + 5, feature.width , feature.height - fr.FONT_HEIGHT - 6);
+ GlStateManager.translate(overFlows ? - feature.width : feature.width, selected * fr.FONT_HEIGHT, 0);
Gui.drawRect(0, 0, feature.width, fr.FONT_HEIGHT * possibleStates.size() + 4, 0xFF444444);
Gui.drawRect(-1, 1, feature.width - 1, fr.FONT_HEIGHT * possibleStates.size() + 3, 0xFF262626);
GlStateManager.translate(2,2, 0);
- Point popupStart = new Point(feature.x + feature.width, (selected + 1) * fr.FONT_HEIGHT +6 + feature.y - dy + 2);
+ Point popupStart = new Point(overFlows ? feature.x - feature.width : feature.x + feature.width, (selected + 1) * fr.FONT_HEIGHT +6 + feature.y - dy + 2);
for (int i = 0; i < possibleStates.size(); i++) {
- if (new Rectangle(feature.x + feature.width, popupStart.y + i * fr.FONT_HEIGHT, feature.width, fr.FONT_HEIGHT).contains(mouseX, mouseY)) {
+ if (new Rectangle(overFlows ? feature.x - feature.width : feature.width, popupStart.y + i * fr.FONT_HEIGHT, feature.width, fr.FONT_HEIGHT).contains(mouseX, mouseY)) {
Gui.drawRect(-2, i * fr.FONT_HEIGHT, feature.width - 3, i * fr.FONT_HEIGHT + fr.FONT_HEIGHT - 1, 0xFF555555);
}
GlStateManager.enableBlend();
@@ -383,7 +387,9 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis
Rectangle feature = getFeatureRect().getRectangle();
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- Point popupStart = new Point(feature.x + feature.width, (selected + 1) * fr.FONT_HEIGHT +6 + feature.y - dy);
+ boolean overFlows = new ScaledResolution(Minecraft.getMinecraft()).getScaledWidth() < feature.x + feature.width;
+
+ Point popupStart = new Point(overFlows ? feature.x - feature.width : feature.x + feature.width, (selected + 1) * fr.FONT_HEIGHT +6 + feature.y - dy);
if (feature.contains(mouseX, mouseY)) {
mouseInputEvent.setCanceled(true);
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 775e299a..f47f1fd0 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java
@@ -26,6 +26,9 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import net.minecraft.client.gui.Gui;
+import net.minecraft.client.renderer.GlStateManager;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL14;
import java.awt.*;
@@ -63,6 +66,9 @@ public class MEditableAColor extends MPanel {
int x = (rectangle.width - getSize().width) / 2;
int y = (rectangle.height - getSize().height) / 2;
+ GlStateManager.enableBlend();
+ GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
Gui.drawRect(x,y,x+getSize().width,y+getSize().height, RenderUtils.getColorAt(absMousex - relMousex0, absMousey - relMousey0, color));
Gui.drawRect(x,y,x+getSize().width,y+1, 0xff333333);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java
index aeb44d82..2236d876 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java
@@ -20,6 +20,7 @@ package kr.syeyoung.dungeonsguide.roomprocessor;
import com.google.common.base.Predicate;
import kr.syeyoung.dungeonsguide.config.Config;
+import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
@@ -142,7 +143,7 @@ public class RoomProcessorIcePath extends GeneralRoomProcessor {
super.drawWorld(partialTicks);
if (!FeatureRegistry.SOLVER_SILVERFISH.isEnabled()) return;
if (!err)
- RenderUtils.drawLines(solution, new Color(0,255,0, 255), partialTicks, false);
+ RenderUtils.drawLines(solution, new AColor(0,255,0, 255),1, partialTicks, false);
}
public Point getPointOfSilverFishOnMap(BlockPos blockPos) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathLeftProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathLeftProcessor.java
index 6cd4d061..f0fd566f 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathLeftProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathLeftProcessor.java
@@ -18,6 +18,7 @@
package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.goldenpath;
+import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver;
import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber;
import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor;
@@ -105,7 +106,7 @@ public class GoldenPathLeftProcessor extends GeneralDefuseChamberProcessor {
@Override
public void drawWorld(float partialTicks) {
super.drawWorld(partialTicks);
- RenderUtils.drawLines(blocksolution, Color.blue, partialTicks, false);
+ RenderUtils.drawLines(blocksolution, new AColor(0,0,255,0), 1,partialTicks, false);
}
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathRightProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathRightProcessor.java
index 50ef81eb..8028609f 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathRightProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathRightProcessor.java
@@ -18,6 +18,7 @@
package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.goldenpath;
+import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver;
import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber;
import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor;
@@ -63,7 +64,7 @@ public class GoldenPathRightProcessor extends GeneralDefuseChamberProcessor {
super.drawWorld(partialTicks);
RenderUtils.drawTextAtWorld(blocksolution.size() == 0 ? "Answer not received yet. Visit left room to obtain solution" : "" , center.getX()+ 0.5f, center.getY(), center.getZ()+ 0.5f, 0xFFFFFFFF, 0.03F, false, false, partialTicks);
- RenderUtils.drawLines(blocksolution, Color.blue, partialTicks, false);
+ RenderUtils.drawLines(blocksolution, new AColor(0,0,255,0),1, partialTicks, false);
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java
index 71e9bab4..a34861c9 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java
@@ -19,6 +19,7 @@
package kr.syeyoung.dungeonsguide.roomprocessor.boxpuzzle;
import kr.syeyoung.dungeonsguide.config.Config;
+import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
@@ -362,11 +363,11 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor {
}
if (pathFound != null) {
- RenderUtils.drawLines(pathFound, new Color(0, 255, 0, 255), partialTicks, true);
+ RenderUtils.drawLines(pathFound, new AColor(0, 255, 0, 255),1, partialTicks, true);
}
} else {
if (totalPath != null) {
- RenderUtils.drawLines(totalPath, new Color(0, 255, 0, 255), partialTicks, false);
+ RenderUtils.drawLines(totalPath, new AColor(0, 255, 0, 255),1, partialTicks, false);
}
if (totalPushedBlocks != null) {
for (int i = 0; i < totalPushedBlocks.size(); i++) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java
index 7f7ede4e..bee05228 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java
@@ -19,6 +19,7 @@
package kr.syeyoung.dungeonsguide.roomprocessor.icefill;
import kr.syeyoung.dungeonsguide.config.Config;
+import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
@@ -109,7 +110,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, new Color(0,255,0, 255), partialTicks, true);
+ RenderUtils.drawLines(solution, new AColor(0,255,0, 255), 1, partialTicks, true);
}
public static class Generator implements RoomProcessorGenerator<RoomProcessorIcePath2> {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
index 204ed360..9a765191 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
@@ -332,6 +332,18 @@ public class RenderUtils {
return (Color.HSBtoRGB((float) (((blah - (x + y) / 2.0f) % 360) / 360.0f), hsv[1],hsv[2]) & 0xffffff)
| ((color.getAlpha() << 24) & 0xff000000);
}
+ public static int getColorAt(double x, double y,double z, AColor color) {
+ if (!color.isChroma())
+ return color.getRGB();
+
+ double blah = ((double)(color.getChromaSpeed()) * (System.currentTimeMillis() / 2)) % 360;
+ float[] hsv = new float[3];
+ Color.RGBtoHSB(color.getRed(), color.getBlue(), color.getGreen(), hsv);
+
+
+ return (Color.HSBtoRGB((float) (((blah - ((x + y+z) / 2.0f) % 360)) / 360.0f), hsv[1],hsv[2]) & 0xffffff)
+ | ((color.getAlpha() << 24) & 0xff000000);
+ }
public static WorldRenderer color(WorldRenderer worldRenderer, int color ){
return worldRenderer.color(((color >> 16) & 0xFF) / 255.0f, ((color >> 8) & 0xFF) / 255.0f, (color &0xFF) / 255.0f, ((color >> 24) & 0xFF) / 255.0f);
@@ -450,7 +462,7 @@ public class RenderUtils {
GlStateManager.popMatrix();
}
- public static void drawLines(List<BlockPos> poses, Color colour, float partialTicks, boolean depth) {
+ public static void drawLines(List<BlockPos> poses, AColor colour, float thickness, float partialTicks, boolean depth) {
Entity render = Minecraft.getMinecraft().getRenderViewEntity();
WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer();
@@ -463,17 +475,25 @@ public class RenderUtils {
GlStateManager.disableTexture2D();
GlStateManager.enableBlend();
GlStateManager.disableAlpha();
- GL11.glLineWidth(2);
+ GL11.glLineWidth(thickness);
if (!depth) {
GlStateManager.disableDepth();
GlStateManager.depthMask(false);
}
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue()/ 255f, colour.getAlpha() / 255f);
- worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
+// GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue()/ 255f, colour.getAlpha() / 255f);
+ GlStateManager.color(1,1,1,1);
+ worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
+ int num = 0;
for (BlockPos pos:poses) {
- worldRenderer.pos(pos.getX() +0.5, pos.getY() +0.5, pos.getZ() +0.5).endVertex();
+ int i = getColorAt(num++ * 10,0, colour);
+ worldRenderer.pos(pos.getX() +0.5, pos.getY() +0.5, pos.getZ() +0.5).color(
+ ((i >> 16) &0xFF)/255.0f,
+ ((i >> 8) &0xFF)/255.0f,
+ (i &0xFF)/255.0f,
+ ((i >> 24) &0xFF)/255.0f
+ ).endVertex();
}
Tessellator.getInstance().draw();
@@ -487,9 +507,11 @@ public class RenderUtils {
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.popMatrix();
+ GL11.glLineWidth(1);
}
public static void drawLines(List<BlockPos> poses, Color colour, float thickness, float partialTicks, boolean depth) {
+ if (colour instanceof AColor) drawLines(poses, (AColor)colour, thickness, partialTicks,depth);
Entity render = Minecraft.getMinecraft().getRenderViewEntity();
WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer();