aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java81
-rw-r--r--src/main/java/me/Danker/commands/DHelpCommand.java2
-rw-r--r--src/main/java/me/Danker/commands/DankerGuiCommand.java1
-rw-r--r--src/main/java/me/Danker/commands/ToggleCommand.java12
-rw-r--r--src/main/java/me/Danker/gui/PuzzleSolversGui.java20
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java2
-rw-r--r--src/main/java/me/Danker/utils/Utils.java93
7 files changed, 200 insertions, 11 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java
index 69f54cf..6665604 100644
--- a/src/main/java/me/Danker/DankersSkyblockMod.java
+++ b/src/main/java/me/Danker/DankersSkyblockMod.java
@@ -13,9 +13,14 @@ import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiChest;
+import net.minecraft.client.renderer.EntityRenderer;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntitySpider;
@@ -52,6 +57,8 @@ import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
+import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
+import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
@@ -62,12 +69,16 @@ import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent;
import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion;
+import net.minecraftforge.fml.relauncher.ReflectionHelper;
import org.apache.commons.lang3.time.StopWatch;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import java.awt.*;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.text.NumberFormat;
import java.util.List;
import java.util.*;
@@ -2812,6 +2823,9 @@ public class DankersSkyblockMod
@SubscribeEvent
public void onWorldRender(RenderWorldLastEvent event) {
+
+ Minecraft mc = Minecraft.getMinecraft();
+
if (ToggleCommand.blazeToggled) {
if (lowestBlaze != null) {
BlockPos stringPos = new BlockPos(lowestBlaze.posX, lowestBlaze.posY + 1, lowestBlaze.posZ);
@@ -2834,6 +2848,73 @@ public class DankersSkyblockMod
if (ToggleCommand.ticTacToeToggled && correctTicTacToeButton != null) {
Utils.draw3DBox(correctTicTacToeButton, 0x40FF40, event.partialTicks);
}
+
+ if(ToggleCommand.traceInactiveTerminalsToggled && Utils.inDungeons && ScoreboardHandler.getSidebarLines().stream().anyMatch(l->ScoreboardHandler.cleanSB(l).contains("The Catacombs (F7)"))) {
+ for (Entity e : mc.theWorld.getLoadedEntityList()) {
+ if (e instanceof EntityArmorStand) {
+ EntityArmorStand entity = (EntityArmorStand) e;
+ if(!e.hasCustomName()) continue;
+ if(!e.getCustomNameTag().contains("Inactive")) continue;
+
+ float distance = mc.thePlayer.getDistanceToEntity(entity);
+
+ float[] fractions = new float[]{0.0F, 0.5F, 1.0F};
+ Color[] colors = new Color[]{Color.RED, Color.YELLOW, Color.GREEN};
+ float progress = distance * 1.25F * 0.01F;
+
+ Color color = Utils.blendColors(fractions, colors, progress).brighter();
+ float width = 1.0f;
+ float partialTicks = event.partialTicks;
+
+ float r = ((float) 1 / 255) * color.getRed();
+ float g = ((float) 1 / 255) * color.getGreen();
+ float b = ((float) 1 / 255) * color.getBlue();
+ GL11.glPushMatrix();
+
+ GL11.glLoadIdentity();
+
+ Method orientCamera = ReflectionHelper.findMethod(EntityRenderer.class, mc.entityRenderer, new String[]{"orientCamera"}, float.class);
+ try {
+ //mc.entityRenderer.orientCamera(partialTicks);
+ orientCamera.invoke(mc.entityRenderer, partialTicks);
+ } catch (IllegalAccessException illegalAccessException) {
+ illegalAccessException.printStackTrace();
+ } catch (InvocationTargetException invocationTargetException) {
+ invocationTargetException.printStackTrace();
+ }
+
+ GL11.glDisable(2929);
+ GL11.glDisable(3553);
+ GL11.glEnable(3042);
+ GL11.glBlendFunc(770, 771);
+
+ GL11.glEnable(GL11.GL_LINE_SMOOTH);
+
+ double x = Utils.interpolate(entity.posX, entity.lastTickPosX, partialTicks) - mc.getRenderManager().viewerPosX;
+ double y = Utils.interpolate(entity.posY + entity.getEyeHeight(), entity.lastTickPosY + entity.getEyeHeight(), partialTicks) - mc.getRenderManager().viewerPosY;
+ double z = Utils.interpolate(entity.posZ, entity.lastTickPosZ, partialTicks) - mc.getRenderManager().viewerPosZ;
+
+ GL11.glLineWidth(width);
+
+ GL11.glBegin(GL11.GL_LINE_STRIP);
+ {
+ GL11.glColor3d(r, g, b);
+ GL11.glVertex3d(x, y, z);
+ GL11.glVertex3d(0.0, mc.thePlayer.getEyeHeight(), 0.0);
+ GL11.glEnd();
+ GL11.glDisable(GL11.GL_LINE_SMOOTH);
+
+ GL11.glDisable(3042);
+ GL11.glEnable(3553);
+ GL11.glEnable(2929);
+
+ GL11.glPopMatrix();
+ }
+
+ }
+ }
+ }
+
}
@SubscribeEvent
diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java
index b2f6824..8e998f2 100644
--- a/src/main/java/me/Danker/commands/DHelpCommand.java
+++ b/src/main/java/me/Danker/commands/DHelpCommand.java
@@ -34,7 +34,7 @@ public class DHelpCommand extends CommandBase {
EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" +
EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" +
EnumChatFormatting.GOLD + " /dsm" + EnumChatFormatting.AQUA + " - Opens the GUI for Danker's Skyblock Mod.\n" +
- EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/lividdagger/sceptremessages/midasstaffmessages/implosionmessages/healmessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/notifyslayerslain/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/watchermessage/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" +
+ EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/lividdagger/sceptremessages/midasstaffmessages/implosionmessages/healmessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/notifyslayerslain/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/watchermessage/traceinactiveterminals/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" +
EnumChatFormatting.GOLD + " /setkey <key>" + EnumChatFormatting.AQUA + " - Sets API key.\n" +
EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" +
EnumChatFormatting.GOLD + " /loot <zombie/spider/wolf/fishing/catacombs/mythological/> [winter/festival/spooky/f(1-7)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" +
diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java
index 7c9c2f0..a003762 100644
--- a/src/main/java/me/Danker/commands/DankerGuiCommand.java
+++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java
@@ -65,6 +65,7 @@ public class DankerGuiCommand extends CommandBase {
debug.append("[creeperpuzzle][").append(ToggleCommand.creeperToggled).append("]\n");
debug.append("[waterpuzzle][").append(ToggleCommand.waterToggled).append("]\n");
debug.append("[tictactoepuzzle][").append(ToggleCommand.ticTacToeToggled).append("]\n");
+ debug.append("[traceinactiveterminals][").append(ToggleCommand.traceInactiveTerminalsToggled).append("]\n");
debug.append("[startswithterminal][").append(ToggleCommand.startsWithToggled).append("]\n");
debug.append("[selectallterminal][").append(ToggleCommand.selectAllToggled).append("]\n");
debug.append("[clickinorderterminal][").append(ToggleCommand.clickInOrderToggled).append("]\n");
diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java
index 3b1c04d..d9d7024 100644
--- a/src/main/java/me/Danker/commands/ToggleCommand.java
+++ b/src/main/java/me/Danker/commands/ToggleCommand.java
@@ -48,6 +48,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
public static boolean waterToggled;
public static boolean ticTacToeToggled;
// Terminal Helpers
+ public static boolean traceInactiveTerminalsToggled;
public static boolean startsWithToggled;
public static boolean selectAllToggled;
public static boolean clickInOrderToggled;
@@ -70,7 +71,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
"aotd/lividdagger/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/" +
"outlinetext/midasstaffmessages/implosionmessages/healmessages/caketimer/lowhealthnotify/" +
"lividsolver/stopsalvagestarred/notifyslayerslain/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/" +
- "watchermessage/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>";
+ "watchermessage/traceinactiveterminals/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>";
}
@Override
@@ -87,7 +88,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
"expertiselore", "skill50display", "outlinetext", "midasstaffmessages",
"implosionmessages", "healmessages", "caketimer", "lowhealthnotify",
"lividsolver", "stopsalvagestarred", "notifyslayerslain", "threemanpuzzle", "oruopuzzle", "blazepuzzle",
- "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "startswithterminal",
+ "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "traceinactiveterminals", "startswithterminal",
"selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer",
"chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "list");
}
@@ -264,7 +265,12 @@ public class ToggleCommand extends CommandBase implements ICommand {
watcherReadyToggled = !watcherReadyToggled;
ConfigHandler.writeBooleanConfig("toggles", "WatcherReadyMessage", watcherReadyToggled);
player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display Watcher ready message has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + watcherReadyToggled + DankersSkyblockMod.MAIN_COLOUR + "."));
- break;
+ break;
+ case "traceinactiveterminals":
+ traceInactiveTerminalsToggled = !traceInactiveTerminalsToggled;
+ ConfigHandler.writeBooleanConfig("toggles", "TraceInactiveTerminals", traceInactiveTerminalsToggled);
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Trace inactive terminals has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + traceInactiveTerminalsToggled + DankersSkyblockMod.MAIN_COLOUR + "."));
+ break;
case "startswithterminal":
startsWithToggled = !startsWithToggled;
ConfigHandler.writeBooleanConfig("toggles", "StartsWithTerminal", startsWithToggled);
diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java
index 17eb433..693e6c4 100644
--- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java
+++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java
@@ -22,6 +22,7 @@ public class PuzzleSolversGui extends GuiScreen {
private GuiButton creeper;
private GuiButton water;
private GuiButton ticTacToe;
+ private GuiButton traceInactive;
private GuiButton startsWith;
private GuiButton selectAll;
private GuiButton clickOrder;
@@ -56,12 +57,14 @@ public class PuzzleSolversGui extends GuiScreen {
creeper = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Creeper Solver: " + Utils.getColouredBoolean(ToggleCommand.creeperToggled));
water = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Water Solver: " + Utils.getColouredBoolean(ToggleCommand.waterToggled));
ticTacToe = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled));
- startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled));
+ traceInactive = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Trace Inactive Terminals: " + Utils.getColouredBoolean(ToggleCommand.traceInactiveTerminalsToggled));
+
// Page 2
- selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled));
- clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled));
- blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled));
- itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled));
+ startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled));
+ selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled));
+ clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled));
+ blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled));
+ itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled));
switch (page) {
case 1:
@@ -71,10 +74,11 @@ public class PuzzleSolversGui extends GuiScreen {
this.buttonList.add(creeper);
this.buttonList.add(water);
this.buttonList.add(ticTacToe);
- this.buttonList.add(startsWith);
+ this.buttonList.add(traceInactive);
this.buttonList.add(nextPage);
break;
case 2:
+ this.buttonList.add(startsWith);
this.buttonList.add(selectAll);
this.buttonList.add(clickOrder);
this.buttonList.add(blockClicks);
@@ -123,6 +127,10 @@ public class PuzzleSolversGui extends GuiScreen {
ToggleCommand.ticTacToeToggled = !ToggleCommand.ticTacToeToggled;
ConfigHandler.writeBooleanConfig("toggles", "TicTacToePuzzle", ToggleCommand.ticTacToeToggled);
ticTacToe.displayString = "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled);
+ } else if (button == traceInactive) {
+ ToggleCommand.traceInactiveTerminalsToggled = !ToggleCommand.traceInactiveTerminalsToggled;
+ ConfigHandler.writeBooleanConfig("toggles", "TraceInactiveTerminals", ToggleCommand.traceInactiveTerminalsToggled);
+ traceInactive.displayString = "Trace Inactive Terminals: " + Utils.getColouredBoolean(ToggleCommand.traceInactiveTerminalsToggled);
} else if (button == startsWith) {
ToggleCommand.startsWithToggled = !ToggleCommand.startsWithToggled;
ConfigHandler.writeBooleanConfig("toggles", "StartsWithTerminal", ToggleCommand.startsWithToggled);
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index 531d631..aae3f59 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -202,6 +202,7 @@ public class ConfigHandler {
if (!hasKey("toggles", "CreeperPuzzle")) writeBooleanConfig("toggles", "CreeperPuzzle", false);
if (!hasKey("toggles", "WaterPuzzle")) writeBooleanConfig("toggles", "WaterPuzzle", false);
if (!hasKey("toggles", "TicTacToePuzzle")) writeBooleanConfig("toggles", "TicTacToePuzzle", false);
+ if (!hasKey("toggles", "TraceInactiveTerminals")) writeBooleanConfig("toggles", "TraceInactiveTerminals", false);
if (!hasKey("toggles", "StartsWithTerminal")) writeBooleanConfig("toggles", "StartsWithTerminal", false);
if (!hasKey("toggles", "SelectAllTerminal")) writeBooleanConfig("toggles", "SelectAllTerminal", false);
if (!hasKey("toggles", "ClickInOrderTerminal")) writeBooleanConfig("toggles", "ClickInOrderTerminal", false);
@@ -469,6 +470,7 @@ public class ConfigHandler {
ToggleCommand.creeperToggled = getBoolean("toggles", "CreeperPuzzle");
ToggleCommand.waterToggled = getBoolean("toggles", "WaterPuzzle");
ToggleCommand.ticTacToeToggled = getBoolean("toggles", "TicTacToePuzzle");
+ ToggleCommand.traceInactiveTerminalsToggled = getBoolean("toggles", "TraceInactiveTerminals");
ToggleCommand.startsWithToggled = getBoolean("toggles", "StartsWithTerminal");
ToggleCommand.selectAllToggled = getBoolean("toggles", "SelectAllTerminal");
ToggleCommand.clickInOrderToggled = getBoolean("toggles", "ClickInOrderTerminal");
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java
index e4f7873..6c1fadb 100644
--- a/src/main/java/me/Danker/utils/Utils.java
+++ b/src/main/java/me/Danker/utils/Utils.java
@@ -25,6 +25,7 @@ import net.minecraft.util.*;
import org.lwjgl.opengl.GL11;
import java.awt.*;
+import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -386,6 +387,96 @@ public class Utils {
RenderHelper.disableStandardItemLighting();
GlStateManager.disableRescaleNormal();
}
+
+ public static double interpolate(double current, double old, double scale) {
+ return old + (current - old) * scale;
+ }
+
+ // Yoink! https://stackoverflow.com/a/51780112
+ public static Color blendColors(float[] fractions, Color[] colors, float progress) {
+ Color color;
+ if (fractions != null) {
+ if (colors != null) {
+ if (fractions.length == colors.length) {
+ int[] indices = getFractionIndices(fractions, progress);
+ if (indices[0] >= 0 && indices[0] < fractions.length && indices[1] >= 0 && indices[1] < fractions.length) {
+ float[] range = new float[]{fractions[indices[0]], fractions[indices[1]]};
+ Color[] colorRange = new Color[]{colors[indices[0]], colors[indices[1]]};
+ float max = range[1] - range[0];
+ float value = progress - range[0];
+ float weight = value / max;
+ color = blend(colorRange[0], colorRange[1], 1.0F - weight);
+ return color;
+ } else {
+ return colors[0];
+ }
+ } else {
+ throw new IllegalArgumentException("Fractions and colours must have equal number of elements");
+ }
+ } else {
+ throw new IllegalArgumentException("Colors can't be null");
+ }
+ } else {
+ throw new IllegalArgumentException("Fractions can't be null");
+ }
+ }
+
+ public static int[] getFractionIndices(float[] fractions, float progress) {
+ int[] range = new int[2];
+
+ int startPoint;
+ for (startPoint = 0; startPoint < fractions.length && fractions[startPoint] <= progress; ++startPoint) {
+ }
+
+ if (startPoint >= fractions.length) {
+ startPoint = fractions.length - 1;
+ }
+
+ range[0] = startPoint - 1;
+ range[1] = startPoint;
+ return range;
+ }
+
+ public static Color blend(Color color1, Color color2, double ratio) {
+ float r = (float) ratio;
+ float ir = 1.0F - r;
+ float[] rgb1 = new float[3];
+ float[] rgb2 = new float[3];
+ color1.getColorComponents(rgb1);
+ color2.getColorComponents(rgb2);
+ float red = rgb1[0] * r + rgb2[0] * ir;
+ float green = rgb1[1] * r + rgb2[1] * ir;
+ float blue = rgb1[2] * r + rgb2[2] * ir;
+ if (red < 0.0F) {
+ red = 0.0F;
+ } else if (red > 255.0F) {
+ red = 255.0F;
+ }
+
+ if (green < 0.0F) {
+ green = 0.0F;
+ } else if (green > 255.0F) {
+ green = 255.0F;
+ }
+
+ if (blue < 0.0F) {
+ blue = 0.0F;
+ } else if (blue > 255.0F) {
+ blue = 255.0F;
+ }
+
+ Color color = null;
+
+ try {
+ color = new Color(red, green, blue);
+ } catch (IllegalArgumentException var14) {
+ NumberFormat nf = NumberFormat.getNumberInstance();
+ System.out.println(nf.format(red) + "; " + nf.format(green) + "; " + nf.format(blue));
+ var14.printStackTrace();
+ }
+
+ return color;
+ }
public static BlockPos getFirstBlockPosAfterVectors(Minecraft mc, Vec3 pos1, Vec3 pos2, int strength, int distance) {
double x = pos2.xCoord - pos1.xCoord;
@@ -441,5 +532,5 @@ public class Utils {
return null;
}
}
-
+
}