aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-02-06 14:43:37 +0900
committersyeyoung <cyong06@naver.com>2021-02-06 14:43:37 +0900
commite7d6517b2e1fb4aa7a5993e53739006a3fca39c8 (patch)
treeab097980bcd8809c2bcfa55b832367fd44f38036
parent5f51b33a4f19454072c92638e040647d4a3f6f38 (diff)
downloadSkyblock-Dungeons-Guide-e7d6517b2e1fb4aa7a5993e53739006a3fca39c8.tar.gz
Skyblock-Dungeons-Guide-e7d6517b2e1fb4aa7a5993e53739006a3fca39c8.tar.bz2
Skyblock-Dungeons-Guide-e7d6517b2e1fb4aa7a5993e53739006a3fca39c8.zip
THE period to gui overhaul
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java68
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java11
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java3
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java72
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java51
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java13
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java16
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java90
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java40
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java1
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java2
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java225
17 files changed, 508 insertions, 100 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java
index 72cbf4b9..6906f615 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java
@@ -1,8 +1,11 @@
package kr.syeyoung.dungeonsguide.config.guiconfig;
+import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.features.FeatureParameter;
import kr.syeyoung.dungeonsguide.gui.MPanel;
+import kr.syeyoung.dungeonsguide.gui.elements.MEditableAColor;
+import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton;
import kr.syeyoung.dungeonsguide.roomedit.Parameter;
import kr.syeyoung.dungeonsguide.gui.elements.MButton;
import kr.syeyoung.dungeonsguide.gui.elements.MLabel;
@@ -40,25 +43,52 @@ public class MParameter extends MPanel {
this.label.setText(parameter.getName());
{
- MButton button = new MButton();
- button.setText("Edit");
- button.setOnActionPerformed(new Runnable() {
- @Override
- public void run() {
- final GuiParameterValueEdit guiParameterValueEdit = new GuiParameterValueEdit(parameter.getValue(), config2);
- guiParameterValueEdit.setOnUpdate(new Runnable() {
- @Override
- public void run() {
- Parameter parameter1 = guiParameterValueEdit.getParameter();
- parameter.setValue(parameter1.getNewData());
- label2.setText(parameter.getValue().toString());
- }
- });
- Minecraft.getMinecraft().displayGuiScreen(guiParameterValueEdit);
- }
- });
- addons.add(button);
- add(button);
+ if (parameter.getValue_type().equalsIgnoreCase("boolean")) {
+ final MToggleButton button = new MToggleButton();
+ button.setOnToggle(new Runnable() {
+ @Override
+ public void run() {
+ parameter.setValue(button.isEnabled());
+ label2.setText(parameter.getValue().toString());
+ }
+ });
+ button.setEnabled((Boolean) parameter.getValue());
+ addons.add(button);
+ add(button);
+ } else if (parameter.getValue_type().equalsIgnoreCase("acolor")) {
+ final MEditableAColor button = new MEditableAColor();
+ button.setEnableEdit(true);
+ button.setOnUpdate(new Runnable() {
+ @Override
+ public void run() {
+ parameter.setValue(button.getColor());
+ label2.setText(parameter.getValue().toString());
+ }
+ });
+ button.setColor((AColor) parameter.getValue());
+ addons.add(button);
+ add(button);
+ } else {
+ MButton button = new MButton();
+ button.setText("Edit");
+ button.setOnActionPerformed(new Runnable() {
+ @Override
+ public void run() {
+ final GuiParameterValueEdit guiParameterValueEdit = new GuiParameterValueEdit(parameter.getValue(), config2);
+ guiParameterValueEdit.setOnUpdate(new Runnable() {
+ @Override
+ public void run() {
+ Parameter parameter1 = guiParameterValueEdit.getParameter();
+ parameter.setValue(parameter1.getNewData());
+ label2.setText(parameter.getValue().toString());
+ }
+ });
+ Minecraft.getMinecraft().displayGuiScreen(guiParameterValueEdit);
+ }
+ });
+ addons.add(button);
+ add(button);
+ }
}
{
MLabel button = new MLabel();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java
index bf1de6b5..17525276 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java
@@ -18,4 +18,15 @@ public class AColor extends Color {
public AColor(int rgba, boolean hasalpha) {
super(rgba, hasalpha);
}
+
+ @Override
+ public String toString() {
+ return "AColor{" +
+ ", r="+getRed()+
+ ", g="+getGreen()+
+ ", b="+getBlue()+
+ ", a="+getAlpha()+
+ ", chromaSpeed=" + chromaSpeed +
+ '}';
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java
index 4965b3bd..44251237 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java
@@ -17,6 +17,8 @@ public class TCTextStyle implements TypeConverter<TextStyle> {
public TextStyle deserialize(JsonElement element) {
TextStyle textStyle = new TextStyle();
textStyle.setColor(TypeConverterRegistry.getTypeConverter("acolor", AColor.class).deserialize(element.getAsJsonObject().get("color")));
+ textStyle.setBackground(element.getAsJsonObject().has("background") ? TypeConverterRegistry.getTypeConverter("acolor", AColor.class).deserialize(element.getAsJsonObject().get("background"))
+ : new AColor(0x00777777, true));
textStyle.setGroupName(element.getAsJsonObject().get("group").getAsString());
return textStyle;
}
@@ -25,6 +27,7 @@ public class TCTextStyle implements TypeConverter<TextStyle> {
public JsonElement serialize(TextStyle element) {
JsonObject jsonObject = new JsonObject();
jsonObject.add("color", TypeConverterRegistry.getTypeConverter("acolor", AColor.class).serialize(element.getColor()));
+ jsonObject.add("background", TypeConverterRegistry.getTypeConverter("acolor", AColor.class).serialize(element.getBackground()));
jsonObject.addProperty("group", element.getGroupName());
return jsonObject;
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java
index 229c4251..a2ab97d3 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java
@@ -6,56 +6,86 @@ import kr.syeyoung.dungeonsguide.e;
import kr.syeyoung.dungeonsguide.features.FeatureParameter;
import kr.syeyoung.dungeonsguide.features.GuiFeature;
import kr.syeyoung.dungeonsguide.features.listener.ChatListener;
+import kr.syeyoung.dungeonsguide.features.text.StyledText;
+import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature;
+import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn;
import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.HealthData;
import kr.syeyoung.dungeonsguide.utils.TextUtils;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.util.ChatComponentText;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import scala.actors.threadpool.Arrays;
import java.awt.*;
import java.awt.font.TextHitInfo;
+import java.util.ArrayList;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.List;
import java.util.regex.Pattern;
-public class FeatureBossHealth extends GuiFeature {
+public class FeatureBossHealth extends TextHUDFeature {
public FeatureBossHealth() {
super("Bossfight", "Display Boss Health(s)", "Show the health of boss and minibosses in bossfight (Guardians, Priests..)", "bossfight.health", false, getFontRenderer().getStringWidth("The Professor: 4242m"), getFontRenderer().FONT_HEIGHT * 5);
this.setEnabled(true);
- parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.orange, "color"));
parameters.put("totalHealth", new FeatureParameter<Boolean>("totalHealth", "show total health", "Show total health along with current health", false, "boolean"));
parameters.put("formatHealth", new FeatureParameter<Boolean>("formatHealth", "format health", "1234568 -> 1m", true, "boolean"));
parameters.put("ignoreInattackable", new FeatureParameter<Boolean>("ignoreInattackable", "Don't show health of in-attackable enemy", "For example, do not show guardians health when they're not attackable", false, "boolean"));
}
SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+
+
+ @Override
+ public boolean doesScaleWithHeight() {
+ return false;
+ }
+
@Override
- public void drawHUD(float partialTicks) {
- if (!skyblockStatus.isOnDungeon()) return;
- DungeonContext context = skyblockStatus.getContext();
- if (context == null) return;
- if (context.getBossfightProcessor() == null) return;
- List<HealthData> healths = context.getBossfightProcessor().getHealths();
- int i = 0;
- FontRenderer fr = getFontRenderer();
+ public boolean isHUDViewable() {
+ return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() != null;
+ }
+
+ @Override
+ public java.util.List<String> getUsedTextStyle() {
+ return Arrays.asList(new String[] {
+ "title", "separator", "health", "separator2", "maxHealth"
+ });
+ }
+
+ @Override
+ public java.util.List<StyledText> getDummyText() {
+ List<StyledText> actualBit = new ArrayList<StyledText>();
+ addLine(new HealthData("The Professor", 3300000, 5000000, false), actualBit);
+ addLine(new HealthData("Chaos Guardian", 500000, 2000000, true), actualBit);
+ addLine(new HealthData("Healing Guardian", 1000000, 3000000, true), actualBit);
+ addLine(new HealthData("Laser Guardian", 5000000, 5000000, true), actualBit);
+ addLine(new HealthData("Giant", 10000000, 20000000, false), actualBit);
+ return actualBit;
+ }
+
+ public void addLine(HealthData data, List<StyledText> actualBit) {
boolean format = this.<Boolean>getParameter("formatHealth").getValue();
boolean total = this.<Boolean>getParameter("totalHealth").getValue();
boolean ignore = this.<Boolean>getParameter("ignoreInattackable").getValue();
- for (HealthData heal : healths) {
- if (ignore && !heal.isAttackable()) continue;
- fr.drawString(heal.getName() + ": " + (format ? TextUtils.format(heal.getHealth()) : heal.getHealth()) + (total ? "/"+(format ? TextUtils.format(heal.getMaxHealth()) : heal.getMaxHealth()) : ""), 0, i, this.<Color>getParameter("color").getValue().getRGB());
- i += 8;
+ if (ignore && !data.isAttackable()) return;
+
+ actualBit.add(new StyledText(data.getName(),"title"));
+ actualBit.add(new StyledText(": ","separator"));
+ actualBit.add(new StyledText( (format ? TextUtils.format(data.getHealth()) : data.getHealth()) + (total ? "" : "\n"),"health"));
+ if (total) {
+ actualBit.add(new StyledText("/", "separator2"));
+ actualBit.add(new StyledText( (format ? TextUtils.format(data.getMaxHealth()) : data.getMaxHealth()) +"\n","maxHealth"));
}
}
@Override
- public void drawDemo(float partialTicks) {
- FontRenderer fr = getFontRenderer();
- fr.drawString("The Professor: 3.3m", 0,0, this.<Color>getParameter("color").getValue().getRGB());
- fr.drawString("Chaos Guardian: 500k", 0,8, this.<Color>getParameter("color").getValue().getRGB());
- fr.drawString("Healing Guardian: 1m", 0,16, this.<Color>getParameter("color").getValue().getRGB());
- fr.drawString("Laser Guardian: 5m", 0,24, this.<Color>getParameter("color").getValue().getRGB());
- fr.drawString("Giant: 10m", 0,32, this.<Color>getParameter("color").getValue().getRGB());
+ public java.util.List<StyledText> getText() {
+ List<StyledText> actualBit = new ArrayList<StyledText>();
+ List<HealthData> healths = skyblockStatus.getContext().getBossfightProcessor().getHealths();
+ for (HealthData heal : healths) {
+ addLine(heal, actualBit);
}
+ return actualBit;
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java
index 88d6998d..8a1a1dcc 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java
@@ -36,7 +36,7 @@ public class FeatureBoxRealLivid extends SimpleFeature implements WorldRenderLis
if (!(skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorLivid)) return;
EntityOtherPlayerMP playerMP = ((BossfightProcessorLivid) skyblockStatus.getContext().getBossfightProcessor()).getRealLivid();
- Color c = this.<Color>getParameter("color").getValue();
+ AColor c = this.<AColor>getParameter("color").getValue();
RenderUtils.highlightBox(playerMP, AxisAlignedBB.fromBounds(-0.4,-1.5,-0.4,0.4,0,0.4), c, partialTicks, true);
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java
index c62ce149..30be7430 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java
@@ -5,36 +5,59 @@ import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
import kr.syeyoung.dungeonsguide.e;
import kr.syeyoung.dungeonsguide.features.FeatureParameter;
import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.features.text.StyledText;
+import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature;
import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn;
import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.HealthData;
import kr.syeyoung.dungeonsguide.utils.TextUtils;
import net.minecraft.client.gui.FontRenderer;
+import scala.actors.threadpool.Arrays;
import java.awt.*;
+import java.util.ArrayList;
import java.util.List;
-public class FeatureThornBearPercentage extends GuiFeature {
+public class FeatureThornBearPercentage extends TextHUDFeature {
public FeatureThornBearPercentage() {
super("Bossfight", "Display Spirit Bear Summon Percentage", "Displays spirit bear summon percentage in hud", "bossfight.spiritbear", true, getFontRenderer().getStringWidth("Spirit Bear: 100%"), getFontRenderer().FONT_HEIGHT);
this.setEnabled(true);
- parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.orange, "color"));
- }
+ }
SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+
+ private static final java.util.List<StyledText> dummyText= new ArrayList<StyledText>();
+ static {
+ dummyText.add(new StyledText("Spirit Bear","title"));
+ dummyText.add(new StyledText(": ","separator"));
+ dummyText.add(new StyledText("50","number"));
+ dummyText.add(new StyledText("%","unit"));
+ }
+ @Override
+ public boolean isHUDViewable() {
+ return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn;
+ }
+
@Override
- public void drawHUD(float partialTicks) {
- if (!skyblockStatus.isOnDungeon()) return;
- DungeonContext context = skyblockStatus.getContext();
- if (context == null) return;
- if (!(context.getBossfightProcessor() instanceof BossfightProcessorThorn)) return;
- int percentage = (int) (((BossfightProcessorThorn) context.getBossfightProcessor()).calculatePercentage() * 100);
- FontRenderer fr = getFontRenderer();
- fr.drawString("Spirit Bear: "+percentage+"%", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ public java.util.List<String> getUsedTextStyle() {
+ return Arrays.asList(new String[] {
+ "title", "separator", "number", "unit"
+ });
}
@Override
- public void drawDemo(float partialTicks) {
- FontRenderer fr = getFontRenderer();
- fr.drawString("Spirit Bear: 50%", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ public java.util.List<StyledText> getDummyText() {
+ return dummyText;
}
+
+ @Override
+ public java.util.List<StyledText> getText() {
+ int percentage = (int) (((BossfightProcessorThorn) skyblockStatus.getContext().getBossfightProcessor()).calculatePercentage() * 100);
+ List<StyledText> actualBit = new ArrayList<StyledText>();
+ actualBit.add(new StyledText("Spirit Bear","title"));
+ actualBit.add(new StyledText(": ","separator"));
+ actualBit.add(new StyledText(percentage+"","number"));
+ actualBit.add(new StyledText("%","unit"));
+ return actualBit;
+ }
+
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java
index a4a144e5..1786e7cf 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java
@@ -43,7 +43,7 @@ public class FeatureBoxSkelemaster extends SimpleFeature implements WorldRenderL
return input.getName().contains("Skeleton Master");
}
});
- Color c = this.<Color>getParameter("color").getValue();
+ AColor c = this.<AColor>getParameter("color").getValue();
for (EntityArmorStand entitySkeleton : skeletonList) {
RenderUtils.highlightBox(entitySkeleton, c, partialTicks, true);
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java
index 64176d71..670ad077 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java
@@ -42,7 +42,7 @@ public class FeatureBoxStarMobs extends SimpleFeature implements WorldRenderList
return input.getName().contains("✯");
}
});
- Color c = this.<Color>getParameter("color").getValue();
+ AColor c = this.<AColor>getParameter("color").getValue();
for (EntityArmorStand entitySkeleton : skeletonList) {
RenderUtils.highlightBox(entitySkeleton, c, partialTicks, true);
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java
index 64bb3744..6f824724 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java
@@ -39,6 +39,11 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener
}
@Override
+ public boolean doesScaleWithHeight() {
+ return false;
+ }
+
+ @Override
public List<String> getUsedTextStyle() {
return Arrays.asList(new String[] {
"username", "separator", "deaths", "total", "totalDeaths"
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java
index 15f0baaf..4b8cae3b 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java
@@ -63,11 +63,10 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener,
parameters.put("showtotalsecrets", new FeatureParameter<Boolean>("showtotalsecrets", "Show Total secrets in the room", "Option to overlay total secrets in the specific room", true, "boolean"));
parameters.put("playerheadscale", new FeatureParameter<Float>("playerheadscale", "Player head scale", "Scale factor of player heads, defaults to 1", 1.0f, "float"));
parameters.put("textScale", new FeatureParameter<Float>("textScale", "Text scale", "Scale factor of texts on map, defaults to 1", 1.0f, "float"));
+
parameters.put("border_color", new FeatureParameter<AColor>("border_color", "Color of the border", "Same as name", new AColor(255,255,255,255), "acolor"));
parameters.put("background_color", new FeatureParameter<AColor>("background_color", "Color of the background", "Same as name", new AColor(0x22000000, true), "acolor"));
- parameters.put("chromaborder", new FeatureParameter<Boolean>("chromaborder", "Chroma border", "Rainbow!!! (Overrides border color option)", false, "boolean"));
parameters.put("player_color", new FeatureParameter<AColor>("player_color", "Color of the player border", "Same as name", new AColor(255,255,255,0), "acolor"));
- parameters.put("player_chroma", new FeatureParameter<Boolean>("player_chroma", "Chroma border for player", "Rainbow!!! (Overrides border color option)", false, "boolean"));
}
SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
@@ -113,7 +112,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener,
DungeonContext context = skyblockStatus.getContext();
MapProcessor mapProcessor = context.getMapProcessor();
MapData mapData = mapProcessor.getLastMapData2();
- Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, this.<AColor>getParameter("background_color").getValue().getRGB());
+ Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, RenderUtils.getColorAt(getFeatureRect().x, getFeatureRect().y, this.<AColor>getParameter("background_color").getValue()));
GlStateManager.color(1,1,1,1);
GlStateManager.pushMatrix();;
if (mapData == null) {
@@ -123,7 +122,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener,
}
GlStateManager.popMatrix();
GL11.glLineWidth(2);
- RenderUtils.drawUnfilledBox(0,0,getFeatureRect().width, getFeatureRect().height, this.<AColor>getParameter("border_color").getValue().getRGB(), this.<Boolean>getParameter("chromaborder").getValue());
+ RenderUtils.drawUnfilledBox(0,0,getFeatureRect().width, getFeatureRect().height, this.<AColor>getParameter("border_color").getValue());
}
@Override
@@ -132,11 +131,11 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener,
drawHUD(partialTicks);
return;
}
- Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, this.<AColor>getParameter("background_color").getValue().getRGB());
+ Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, RenderUtils.getColorAt(getFeatureRect().x, getFeatureRect().y, this.<AColor>getParameter("background_color").getValue()));
FontRenderer fr = getFontRenderer();
fr.drawString("Please join a dungeon to see preview", getFeatureRect().width / 2 - fr.getStringWidth("Please join a dungeon to see preview") / 2, getFeatureRect().height / 2 - fr.FONT_HEIGHT / 2, 0xFFFFFFFF);
GL11.glLineWidth(2);
- RenderUtils.drawUnfilledBox(0,0,getFeatureRect().width, getFeatureRect().height, this.<AColor>getParameter("border_color").getValue().getRGB(), this.<Boolean>getParameter("chromaborder").getValue());
+ RenderUtils.drawUnfilledBox(0,0,getFeatureRect().width, getFeatureRect().height, this.<AColor>getParameter("border_color").getValue());
}
public void renderMap(float partialTicks, MapProcessor mapProcessor, MapData mapData, DungeonContext context){
@@ -212,7 +211,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener,
GlStateManager.scale(s,s,0);
Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, (float) l2, 8, i3, 8, 8, 64.0F, 64.0F);
GL11.glLineWidth(1);
- RenderUtils.drawUnfilledBox(-4,-4,4, 4, this.<AColor>getParameter("player_color").getValue().getRGB(), this.<Boolean>getParameter("player_chroma").getValue());
+ RenderUtils.drawUnfilledBox(-4,-4,4, 4, this.<AColor>getParameter("player_color").getValue());
}
GlStateManager.popMatrix();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java
index ffcfbfa8..17a41e5b 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java
@@ -51,22 +51,6 @@ public class FeatureWarnLowHealth extends TextHUDFeature {
});
}
- @Override
- public void drawDemo(float partialTicks) {
- FontRenderer fr = getFontRenderer();
- double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
- GlStateManager.scale(scale, scale, 0);
- super.drawDemo(partialTicks);
- }
-
- @Override
- public void drawHUD(float partialTicks) {
- FontRenderer fr = getFontRenderer();
- double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
- GlStateManager.scale(scale, scale, 0);
- super.drawHUD(partialTicks);
- }
-
private static final java.util.List<StyledText> dummyText= new ArrayList<StyledText>();
static {
dummyText.add(new StyledText("DungeonsGuide","title"));
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java
index 6595aee4..06ac0fca 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java
@@ -34,6 +34,7 @@ public class PanelTextParameterConfig extends MPanel {
private TextHUDFeature feature;
private MEditableAColor currentColor;
+ private MEditableAColor backgroundColor;
@Override
public void onBoundsUpdate() {
@@ -63,12 +64,28 @@ public class PanelTextParameterConfig extends MPanel {
}
});
add(currentColor);
+ backgroundColor = new MEditableAColor();
+ backgroundColor.setColor(new AColor(0xff555555, true));
+ backgroundColor.setEnableEdit(false);
+ backgroundColor.setSize(new Dimension(15, 10));
+ backgroundColor.setBounds(new Rectangle(415 , 14, 15, 10));
+ backgroundColor.setOnUpdate(new Runnable() {
+ @Override
+ public void run() {
+ for (String se:selected)
+ feature.getStylesMap().get(se).setBackground(backgroundColor.getColor());
+ }
+ });
+ add(backgroundColor);
+
+
}
private Set<String> selected = new HashSet<String>();
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
+
GlStateManager.pushMatrix();
int width = 200, height = 100;
@@ -78,23 +95,28 @@ public class PanelTextParameterConfig extends MPanel {
Rectangle clip = new Rectangle(scissor.x + 5, scissor.y + 5, width, height);
clip(new ScaledResolution(Minecraft.getMinecraft()), clip.x, clip.y, clip.width, clip.height);
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(offsetX + 5, offsetY + 5, 0);
+ GlStateManager.scale(scale, scale, 0);
+
+
List<StyledText> texts = feature.getDummyText();
Map<String, TextStyle> styles = feature.getStylesMap();
- List<TextHUDFeature.StyleTextAssociated> calc = feature.calculate(texts, 5,5, styles);
+ List<TextHUDFeature.StyleTextAssociated> calc = feature.drawTextWithStylesAssociated(texts, 0,0, styles);
boolean bool =clip.contains(absMousex, absMousey);
for (TextHUDFeature.StyleTextAssociated calc3: calc) {
if (selected.contains(calc3.getStyledText().getGroup())) {
- Gui.drawRect(calc3.getRectangle().x, calc3.getRectangle().y, calc3.getRectangle().x + calc3.getRectangle().width, calc3.getRectangle().y + calc3.getRectangle().height, 0xFF44A800);
- } else if (bool && calc3.getRectangle().contains(relMousex0, relMousey0)) {
+ Gui.drawRect(calc3.getRectangle().x, calc3.getRectangle().y, calc3.getRectangle().x + calc3.getRectangle().width, calc3.getRectangle().y + calc3.getRectangle().height, 0x4244A800);
+ } else if (bool && calc3.getRectangle().contains((relMousex0-5 -offsetX) * scale , (relMousey0 - 5 - offsetY) * scale)) {
for (TextHUDFeature.StyleTextAssociated calc2 : calc) {
if (calc2.getStyledText().getGroup().equals(calc3.getStyledText().getGroup()))
- Gui.drawRect(calc2.getRectangle().x, calc2.getRectangle().y, calc2.getRectangle().x + calc2.getRectangle().width, calc2.getRectangle().y + calc2.getRectangle().height, 0xFF777777);
+ Gui.drawRect(calc2.getRectangle().x, calc2.getRectangle().y, calc2.getRectangle().x + calc2.getRectangle().width, calc2.getRectangle().y + calc2.getRectangle().height, 0x55777777);
}
}
}
- feature.drawTextWithStylesAssociated(texts, 5,5, styles);
clip(new ScaledResolution(Minecraft.getMinecraft()), scissor.x, scissor.y, scissor.width, scissor.height);
+ GlStateManager.popMatrix();
GlStateManager.translate(5, height + 7, 0);
GlStateManager.scale(0.5,0.5,0);
@@ -109,19 +131,27 @@ public class PanelTextParameterConfig extends MPanel {
fr.drawString("Selected Groups: "+selected, 0, 0, 0xFFBFBFBF);
GlStateManager.popMatrix();
fr.drawString("Text Color: ", 0, 10, 0xFFFFFFFF);
+ fr.drawString("Background Color: ", 100, 10, 0xFFFFFFFF);
GlStateManager.popMatrix();
}
+ private int offsetX = 0;
+ private int offsetY = 0;
+ private float scale = 1;
+
+ private int lastX;
+ private int lastY;
+ private boolean dragStart = false;
@Override
public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
List<StyledText> texts = feature.getDummyText();
Map<String, TextStyle> styles = feature.getStylesMap();
boolean existed = selected.isEmpty();
boolean found = false;
- List<TextHUDFeature.StyleTextAssociated> calc = feature.calculate(texts, 5,5, styles);
+ List<TextHUDFeature.StyleTextAssociated> calc = feature.calculate(texts, 0,0, styles);
for (TextHUDFeature.StyleTextAssociated calc3: calc) {
- if (calc3.getRectangle().contains(relMouseX, relMouseY)) {
+ if (calc3.getRectangle().contains((relMouseX-5 -offsetX) * scale , (relMouseY - 5 - offsetY) * scale)) {
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
if (!selected.contains(calc3.getStyledText().getGroup()))
selected.add(calc3.getStyledText().getGroup());
@@ -137,16 +167,56 @@ public class PanelTextParameterConfig extends MPanel {
if (!found && !(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) && relMouseX >= 5 && relMouseX <= 205 && relMouseY >= 5 && relMouseY <= 105) {
selected.clear();
+ dragStart = true;
+ lastX = absMouseX;
+ lastY = absMouseY;
}
currentColor.setEnableEdit(selected.size() != 0);
+ backgroundColor.setEnableEdit(selected.size() != 0);
if (existed != selected.isEmpty()) {
- if (selected.size() != 0)
+ if (selected.size() != 0) {
currentColor.setColor(styles.get(selected.iterator().next()).getColor());
- else
+ backgroundColor.setColor(styles.get(selected.iterator().next()).getBackground());
+ } else {
currentColor.setColor(new AColor(0xff555555, true));
+ backgroundColor.setColor(new AColor(0xff555555, true));
+ }
}
- if (selected.size() == 1)
+ if (selected.size() == 1) {
currentColor.setColor(styles.get(selected.iterator().next()).getColor());
+ backgroundColor.setColor(styles.get(selected.iterator().next()).getBackground());
+ }
+ }
+
+ @Override
+ public void mouseReleased(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int state) {
+ dragStart = false;
+ }
+
+ @Override
+ public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) {
+ if (dragStart) {
+ offsetX += absMouseX - lastX;
+ offsetY += absMouseY - lastY;
+ lastX = absMouseX;
+ lastY = absMouseY;
+
+ if (offsetX < 0) offsetX = 0;
+ if (offsetY < 0) offsetY =0;
+ }
+ }
+
+ @Override
+ public void mouseScrolled(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) {
+ if ( relMouseX0 >= 5 && relMouseX0 <= 205 && relMouseY0 >= 5 && relMouseY0 <= 105) {
+ if (scrollAmount > 0) {
+ scale += 0.1;
+ } else if (scrollAmount < 0) {
+ scale -= 0.1;
+ }
+ if (scale < 0.1) scale = 0.1f;
+ if (scale > 5) scale = 5.0f;
+ }
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java
index a7502a7f..4bfb9041 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java
@@ -14,6 +14,8 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.renderer.GlStateManager;
import scala.actors.threadpool.Arrays;
import java.awt.*;
@@ -28,16 +30,46 @@ public abstract class TextHUDFeature extends GuiFeature {
@Override
public void drawHUD(float partialTicks) {
+ if (isHUDViewable()) {
+ List<StyledText> asd = getText();
- if (isHUDViewable())
+ if (doesScaleWithHeight()) {
+ FontRenderer fr = getFontRenderer();
+ double scale = getFeatureRect().getHeight() / (fr.FONT_HEIGHT* countLines(asd));
+ GlStateManager.scale(scale, scale, 0);
+ }
drawTextWithStylesAssociated(getText(), 0, 0, getStylesMap());
+ }
+ }
+
+ public boolean doesScaleWithHeight() {
+ return true;
}
@Override
public void drawDemo(float partialTicks) {
+ List<StyledText> asd = getDummyText();
+ if (doesScaleWithHeight()) {
+ FontRenderer fr = getFontRenderer();
+ double scale = getFeatureRect().getHeight() / (fr.FONT_HEIGHT * countLines(asd));
+ GlStateManager.scale(scale, scale, 0);
+ }
drawTextWithStylesAssociated(getDummyText(), 0, 0, getStylesMap());
}
+ public int countLines(List<StyledText> texts) {
+ StringBuilder things = new StringBuilder();
+ for (StyledText text : texts) {
+ things.append(text.getText());
+ }
+ String things2 = things.toString().trim();
+ int lines = 1;
+ for (char c : things2.toString().toCharArray()) {
+ if (c == '\n') lines++;
+ }
+ return lines;
+ }
+
public abstract boolean isHUDViewable();
public abstract List<String> getUsedTextStyle();
@@ -59,7 +91,7 @@ public abstract class TextHUDFeature extends GuiFeature {
}
for (String str : getUsedTextStyle()) {
if (!res.containsKey(str))
- res.put(str, new TextStyle(str, new AColor(0xffffffff, true)));
+ res.put(str, new TextStyle(str, new AColor(0xffffffff, true), new AColor(0x00777777, true)));
}
stylesMap = res;
}
@@ -141,6 +173,8 @@ public abstract class TextHUDFeature extends GuiFeature {
if (stopDraw)
return new Dimension(fr.getStringWidth(content), fr.FONT_HEIGHT);
+ Gui.drawRect(x,y, x+fr.getStringWidth(content), y + fr.FONT_HEIGHT, RenderUtils.getColorAt(x,y, style.getBackground()));
+
if (!style.getColor().isChroma()) {
fr.drawString(content, x, y, style.getColor().getRGB());
return new Dimension(fr.getStringWidth(content), fr.FONT_HEIGHT);
@@ -148,7 +182,7 @@ public abstract class TextHUDFeature extends GuiFeature {
char[] charArr = content.toCharArray();
int width = 0;
for (int i = 0; i < charArr.length; i++) {
- fr.drawString(String.valueOf(charArr[i]), x + width, y, RenderUtils.getChromaColorAt(x + width, y, style.getColor().getChromaSpeed()));
+ fr.drawString(String.valueOf(charArr[i]), x + width, y, RenderUtils.getColorAt(x + width, y, style.getColor()));
width += fr.getCharWidth(charArr[i]);
}
return new Dimension(width, fr.FONT_HEIGHT);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java
index 2353cd11..0df4c9a5 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java
@@ -13,4 +13,5 @@ import java.awt.*;
public class TextStyle {
private String groupName;
private AColor color;
+ private AColor background;
}
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 61b506c3..fb4ba784 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java
@@ -45,10 +45,7 @@ public class MEditableAColor extends MPanel {
int x = (rectangle.width - getSize().width) / 2;
int y = (rectangle.height - getSize().height) / 2;
- if (color.isChroma())
- Gui.drawRect(x,y,x+getSize().width,y+getSize().height, RenderUtils.getChromaColorAt(absMousex - relMousex0, absMousey - relMousey0, color.getChromaSpeed()));
- else
- Gui.drawRect(x,y,x+getSize().width,y+getSize().height, getColor().getRGB());
+ 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);
Gui.drawRect(x,y,x+1,y+getSize().height, 0xff333333);
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 fd4d49dc..360b4f0c 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java
@@ -82,7 +82,7 @@ public class MPortableColorEdit extends MPanel {
GL11.glBegin(GL11.GL_TRIANGLES);
- rgb = RenderUtils.getChromaColorAt(0,0, chromaSpeed);
+ rgb = RenderUtils.getChromaColorAt(0,0, chromaSpeed, hsv[1], hsv[2], alpha);
r = (rgb >> 16 & 255) / 255.0f;
g = (rgb >> 8 & 255) / 255.0f;
b = (rgb & 255) / 255.0f;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
index 91a03662..025d5890 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
@@ -1,5 +1,6 @@
package kr.syeyoung.dungeonsguide.utils;
+import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityOtherPlayerMP;
@@ -70,9 +71,70 @@ public class RenderUtils {
GlStateManager.disableBlend();
}
- public static int getChromaColorAt(int x, int y, float speed) {
+
+ public static void drawUnfilledBox(int left, int top, int right, int bottom, AColor color)
+ {
+ if (left < right)
+ {
+ int i = left;
+ left = right;
+ right = i;
+ }
+
+ if (top < bottom)
+ {
+ int j = top;
+ top = bottom;
+ bottom = j;
+ }
+
+ float f3 = (float)(color.getRGB() >> 24 & 255) / 255.0F;
+ float f = (float)(color.getRGB() >> 16 & 255) / 255.0F;
+ float f1 = (float)(color.getRGB() >> 8 & 255) / 255.0F;
+ float f2 = (float)(color.getRGB() & 255) / 255.0F;
+ if (!color.isChroma() && f3 == 0) return;
+ Tessellator tessellator = Tessellator.getInstance();
+ WorldRenderer worldrenderer = tessellator.getWorldRenderer();
+ GlStateManager.enableBlend();
+ GlStateManager.disableTexture2D();
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
+ if (!color.isChroma()) {
+ GlStateManager.color(f, f1, f2, f3);
+ worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION);
+ worldrenderer.pos((double) left, (double) bottom, 0.0D).endVertex();
+ worldrenderer.pos((double) right, (double) bottom, 0.0D).endVertex();
+ worldrenderer.pos((double) right, (double) top, 0.0D).endVertex();
+ worldrenderer.pos((double) left, (double) top, 0.0D).endVertex();
+ } else {
+ worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);
+ ;
+ GlStateManager.shadeModel(GL11.GL_SMOOTH);
+ color(worldrenderer.pos((double) left, (double) bottom, 0.0D), getColorAt(left, bottom, color)).endVertex();
+ color(worldrenderer.pos((double) right, (double) bottom, 0.0D), getColorAt(right, bottom, color)).endVertex();
+ color(worldrenderer.pos((double) right, (double) top, 0.0D), getColorAt(right, top, color)).endVertex();
+ color(worldrenderer.pos((double) left, (double) top, 0.0D), getColorAt(left, top, color)).endVertex();
+ }
+ tessellator.draw();
+ GlStateManager.enableTexture2D();
+ GlStateManager.disableBlend();
+ }
+
+ public static int getChromaColorAt(int x, int y, float speed, float s, float b, float alpha) {
double blah = ((double)(speed) * (System.currentTimeMillis() / 2)) % 360;
- return Color.HSBtoRGB((float) (((blah - (x * x + y * y) / 50.0f) % 360) / 360.0f), 1,1);
+ return (Color.HSBtoRGB((float) (((blah - (x + y) / 2.0f) % 360) / 360.0f), s,b) & 0xffffff)
+ | (((int)(alpha * 255)<< 24) & 0xff000000);
+ }
+ public static int getColorAt(double x, double y, 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) / 2.0f) % 360) / 360.0f), hsv[1],hsv[2]) & 0xffffff)
+ | ((color.getAlpha() << 24) & 0xff000000);
}
public static WorldRenderer color(WorldRenderer worldRenderer, int color ){
@@ -309,6 +371,82 @@ public class RenderUtils {
}
+ public static void highlightBox(Entity entity, AxisAlignedBB axisAlignedBB, AColor c, float partialTicks, boolean depth) {
+ Entity viewing_from = Minecraft.getMinecraft().getRenderViewEntity();
+
+ double x_fix = viewing_from.lastTickPosX + ((viewing_from.posX - viewing_from.lastTickPosX) * partialTicks);
+ double y_fix = viewing_from.lastTickPosY + ((viewing_from.posY - viewing_from.lastTickPosY) * partialTicks);
+ double z_fix = viewing_from.lastTickPosZ + ((viewing_from.posZ - viewing_from.lastTickPosZ) * partialTicks);
+
+ GlStateManager.pushMatrix();
+ GlStateManager.pushAttrib();
+ GlStateManager.translate(-x_fix, -y_fix, -z_fix);
+
+ GlStateManager.disableLighting();
+ GlStateManager.enableBlend();
+ GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GlStateManager.disableTexture2D();
+
+ if (!depth) {
+ GlStateManager.disableDepth();
+ GlStateManager.depthMask(false);
+ }
+ int rgb = RenderUtils.getColorAt(entity.posX * 10,entity.posY * 10,c);
+ GlStateManager.color(((rgb >> 16) &0XFF)/ 255.0f, ((rgb>>8) &0XFF)/ 255.0f, (rgb & 0xff)/ 255.0f, ((rgb >> 24) & 0xFF) / 255.0f);
+
+
+ GlStateManager.translate(-0.4 + entity.posX, entity.posY, -0.4 + entity.posZ);
+
+ double x = 0.8;
+ double y = 1.5;
+ double z = 0.8;
+ GL11.glBegin(GL11.GL_QUADS);
+ GL11.glVertex3d(0, 0, 0);
+ GL11.glVertex3d(0, 0, z);
+ GL11.glVertex3d(0, y, z);
+ GL11.glVertex3d(0, y, 0); // TOP LEFT / BOTTOM LEFT / TOP RIGHT/ BOTTOM RIGHT
+
+ GL11.glVertex3d(x, 0, z);
+ GL11.glVertex3d(x, 0, 0);
+ GL11.glVertex3d(x, y, 0);
+ GL11.glVertex3d(x, y, z);
+
+ GL11.glVertex3d(0, y, z);
+ GL11.glVertex3d(0, 0, z);
+ GL11.glVertex3d(x, 0, z);
+ GL11.glVertex3d(x, y, z); // TOP LEFT / BOTTOM LEFT / TOP RIGHT/ BOTTOM RIGHT
+
+ GL11.glVertex3d(0, 0, 0);
+ GL11.glVertex3d(0, y, 0);
+ GL11.glVertex3d(x, y, 0);
+ GL11.glVertex3d(x, 0, 0);
+
+ GL11.glVertex3d(0,y,0);
+ GL11.glVertex3d(0,y,z);
+ GL11.glVertex3d(x,y,z);
+ GL11.glVertex3d(x,y,0);
+
+ GL11.glVertex3d(0,0,z);
+ GL11.glVertex3d(0,0,0);
+ GL11.glVertex3d(x,0,0);
+ GL11.glVertex3d(x,0,z);
+
+
+
+ GL11.glEnd();
+
+
+ if (!depth) {
+ GlStateManager.disableDepth();
+ GlStateManager.depthMask(true);
+ }
+ GlStateManager.enableTexture2D();
+ GlStateManager.disableBlend();
+ GlStateManager.enableLighting();
+ GlStateManager.popMatrix();
+ GlStateManager.popAttrib();
+ }
+
public static void highlightBox(Entity entity, AxisAlignedBB axisAlignedBB, Color c, float partialTicks, boolean depth) {
Entity viewing_from = Minecraft.getMinecraft().getRenderViewEntity();
@@ -462,6 +600,89 @@ public class RenderUtils {
//...
}
+
+ public static void highlightBox(Entity entity, AColor c, float partialTicks, boolean depth) {
+ Entity viewing_from = Minecraft.getMinecraft().getRenderViewEntity();
+
+ double x_fix = viewing_from.lastTickPosX + ((viewing_from.posX - viewing_from.lastTickPosX) * partialTicks);
+ double y_fix = viewing_from.lastTickPosY + ((viewing_from.posY - viewing_from.lastTickPosY) * partialTicks);
+ double z_fix = viewing_from.lastTickPosZ + ((viewing_from.posZ - viewing_from.lastTickPosZ) * partialTicks);
+
+ GlStateManager.pushMatrix();
+ GlStateManager.pushAttrib();
+ GlStateManager.translate(-x_fix, -y_fix, -z_fix);
+
+ GlStateManager.disableLighting();
+ GlStateManager.enableBlend();
+ GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GlStateManager.disableTexture2D();
+
+ if (!depth) {
+ GlStateManager.disableDepth();
+ GlStateManager.depthMask(false);
+ }
+
+ int rgb = RenderUtils.getColorAt(entity.posX % 20,entity.posY % 20,c);
+ GlStateManager.color(((rgb >> 16) &0XFF)/ 255.0f, ((rgb>>8) &0XFF)/ 255.0f, (rgb & 0xff)/ 255.0f, ((rgb >> 24) & 0xFF) / 255.0f);
+
+ AxisAlignedBB axisAlignedBB = AxisAlignedBB.fromBounds(-0.4,-1.5,-0.4,0.4,0,0.4);
+
+
+ GlStateManager.translate(-0.4 + entity.posX, -1.5 + entity.posY, -0.4 + entity.posZ);
+
+ double x = 0.8;
+ double y = 1.5;
+ double z = 0.8;
+ GL11.glBegin(GL11.GL_QUADS);
+ GL11.glVertex3d(0, 0, 0);
+ GL11.glVertex3d(0, 0, z);
+ GL11.glVertex3d(0, y, z);
+ GL11.glVertex3d(0, y, 0); // TOP LEFT / BOTTOM LEFT / TOP RIGHT/ BOTTOM RIGHT
+
+ GL11.glVertex3d(x, 0, z);
+ GL11.glVertex3d(x, 0, 0);
+ GL11.glVertex3d(x, y, 0);
+ GL11.glVertex3d(x, y, z);
+
+ GL11.glVertex3d(0, y, z);
+ GL11.glVertex3d(0, 0, z);
+ GL11.glVertex3d(x, 0, z);
+ GL11.glVertex3d(x, y, z); // TOP LEFT / BOTTOM LEFT / TOP RIGHT/ BOTTOM RIGHT
+
+ GL11.glVertex3d(0, 0, 0);
+ GL11.glVertex3d(0, y, 0);
+ GL11.glVertex3d(x, y, 0);
+ GL11.glVertex3d(x, 0, 0);
+
+ GL11.glVertex3d(0,y,0);
+ GL11.glVertex3d(0,y,z);
+ GL11.glVertex3d(x,y,z);
+ GL11.glVertex3d(x,y,0);
+
+ GL11.glVertex3d(0,0,z);
+ GL11.glVertex3d(0,0,0);
+ GL11.glVertex3d(x,0,0);
+ GL11.glVertex3d(x,0,z);
+
+
+
+ GL11.glEnd();
+
+
+ if (!depth) {
+ GlStateManager.disableDepth();
+ GlStateManager.depthMask(true);
+ }
+ GlStateManager.enableTexture2D();
+ GlStateManager.disableBlend();
+ GlStateManager.enableLighting();
+ GlStateManager.popMatrix();
+ GlStateManager.popAttrib();
+
+
+//...
+
+ }
public static void drawTextAtWorld(String text, float x, float y, float z, int color, float scale, boolean increase, boolean renderBlackBox, float partialTicks) {
float lScale = scale;