aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--build.gradle.kts2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/GriffinJavaUtils.java354
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/GriffinUtils.kt119
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt41
14 files changed, 74 insertions, 497 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 337c32a03..68a4a1951 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,7 @@
# SkyHanni - Change Log
+## Version 0.16.UNRELEASED (UNRELEASED)
+
## Version 0.15.1 (2023-01-25)
## Features
diff --git a/build.gradle.kts b/build.gradle.kts
index f3658678a..3deb01a58 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -10,7 +10,7 @@ plugins {
}
group = "at.hannibal2.skyhanni"
-version = "0.15.1"
+version = "0.16.UNRELEASED"
// Toolchains:
java {
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index 19f5bc38a..02e9493ed 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -62,7 +62,7 @@ import java.util.List;
public class SkyHanniMod {
public static final String MODID = "skyhanni";
- public static final String VERSION = "0.15.1";
+ public static final String VERSION = "0.16.UNRELEASED";
public static Features feature;
diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
index fc130de50..95ce8823f 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
@@ -1,8 +1,8 @@
package at.hannibal2.skyhanni.events
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.test.GriffinJavaUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.fml.common.eventhandler.Event
@@ -30,7 +30,7 @@ abstract class LorenzEvent : Event() {
lastPrint = System.currentTimeMillis()
println(" ")
println("Event Timings!")
- for (entry in GriffinJavaUtils.sortByValue(map)) {
+ for (entry in map.sorted()) {
println(entry.key + ": " + entry.value + " ms")
}
println(" ")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
index 245fa85af..949b3c4e3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.event.diana
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.OSUtils.isActive
import net.minecraft.client.Minecraft
@@ -85,7 +86,7 @@ class BurrowWarpHelper {
private fun getNearestWarpPoint(location: LorenzVec): WarpPoint {
val map = WarpPoint.values().filter { it.enabled }.map { it to it.distance(location) }
- return map.toList().sortedBy { (_, value) -> value }.first().first
+ return map.sorted().first().first
}
fun resetDisabledWarps() {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt
index f8a9d5c7f..0666581d4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt
@@ -6,11 +6,11 @@ import at.hannibal2.skyhanni.events.BurrowDetectEvent
import at.hannibal2.skyhanni.events.BurrowDugEvent
import at.hannibal2.skyhanni.events.EntityMoveEvent
import at.hannibal2.skyhanni.events.SoopyGuessBurrowEvent
-import at.hannibal2.skyhanni.test.GriffinUtils.draw3DLine
import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzVec
+import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import net.minecraft.client.Minecraft
@@ -198,7 +198,7 @@ class GriffinBurrowHelper {
var vector = target.subtract(animation)
- event.draw3DLine(animation.add(0.5, 0.5, 0.5), target.add(0.5, 0.5, 0.5), LorenzColor.WHITE, 2, true)
+ event.draw3DLine(animation.add(0.5, 0.5, 0.5), target.add(0.5, 0.5, 0.5), LorenzColor.WHITE.toColor(), 2, true)
vector = vector.multiply(1 / vector.length())
vector = vector.multiply(0.18)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt
index 8ddf0eba7..f2b188787 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt
@@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent
import at.hannibal2.skyhanni.features.bazaar.BazaarApi
import at.hannibal2.skyhanni.features.bazaar.BazaarData
-import at.hannibal2.skyhanni.test.GriffinJavaUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
@@ -95,11 +94,11 @@ class CollectionCounter {
}
private fun updateDisplay() {
- val format = GriffinJavaUtils.formatInteger(itemAmount)
+ val format = LorenzUtils.formatInteger(itemAmount)
var gainText = ""
if (recentGain != 0) {
- gainText = "§a+" + GriffinJavaUtils.formatInteger(recentGain)
+ gainText = "§a+" + LorenzUtils.formatInteger(recentGain)
}
display = "$itemName collection: §e$format $gainText"
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
index 44e9332f4..5adafb6b4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
@@ -64,7 +64,7 @@ class NonGodPotEffectDisplay {
totalEffectsCount = 0
checkFooter = true
}
- for (effect in GriffinJavaUtils.sortByValue(activeEffects)) {
+ for (effect in activeEffects.sorted()) {
val label = effect.key
val until = effect.value
val seconds = (until - now) / 1000
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt
index d846ac42b..a622fa02a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt
@@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
@@ -91,7 +92,7 @@ class TiaRelayHelper {
resultDisplay.clear()
var i = 1
- for (entry in pitchMap.toList().sortedBy { (_, value) -> value }.toMap()) {
+ for (entry in pitchMap.sorted()) {
resultDisplay[entry.key] = i
i++
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt
index dc5ac9691..d054ded6c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt
@@ -1,10 +1,10 @@
package at.hannibal2.skyhanni.features.summonings
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.test.GriffinJavaUtils
import at.hannibal2.skyhanni.utils.EntityUtils.getNameTagWith
import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.getLorenzVec
@@ -57,20 +57,9 @@ class SummoningSoulsName {
map[mob] = distance
}
- val nearestMob = GriffinJavaUtils.sortByValueAsc(map).firstNotNullOfOrNull { it.key }
+ val nearestMob = map.sorted().firstNotNullOfOrNull { it.key }
if (nearestMob != null) {
-// val mobDistance = nearestMob.getLorenzVec().add(0.0, -1.4375, 0.0)
-// val distance = mobDistance.distance(soulLocation)
-// val diff = mobDistance.add(soulLocation.multiply(-1))
-
-// println(" ")
-// println("mobDistance: $mobDistance")
-// println("soulLocation: $soulLocation")
-// println("diff: $diff")
-// LorenzUtils.chat("distance: $distance")
- val name = mobsName[nearestMob]!!
-// LorenzUtils.chat("maybe its $name")
- souls[entity] = name
+ souls[entity] = mobsName[nearestMob]!!
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/GriffinJavaUtils.java b/src/main/java/at/hannibal2/skyhanni/test/GriffinJavaUtils.java
deleted file mode 100644
index 688923f65..000000000
--- a/src/main/java/at/hannibal2/skyhanni/test/GriffinJavaUtils.java
+++ /dev/null
@@ -1,354 +0,0 @@
-package at.hannibal2.skyhanni.test;
-
-import at.hannibal2.skyhanni.utils.LorenzVec;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.WorldRenderer;
-import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.AxisAlignedBB;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.*;
-import java.text.DecimalFormat;
-import java.util.List;
-import java.util.*;
-import java.util.function.Function;
-
-//TODO delte this class after next diana mayor
-public class GriffinJavaUtils {
- public static <T> void permute(ArrayList<ArrayList<T>> result, T[] a, int k) {
- if (k == a.length) {
- ArrayList<T> subResult = new ArrayList<>();
- result.add(subResult);
- Collections.addAll(subResult, a);
- } else {
- for (int i = k; i < a.length; i++) {
- T temp = a[k];
- a[k] = a[i];
- a[i] = temp;
-
- permute(result, a, k + 1);
-
- temp = a[k];
- a[k] = a[i];
- a[i] = temp;
- }
- }
- }
-
-// public static <T> ArrayList<T> sortLocationListC(LorenzVec start, Map<T, LorenzVec> map, boolean brokenMath) {
-// Map<T, Double> fastestWithout = new HashMap<>();
-// for (T without : map.keySet()) {
-//
-// ArrayList<ArrayList<T>> variants = new ArrayList<>();
-// ArrayList<T> values = new ArrayList<>(map.keySet());
-//
-// values.remove(without);
-// T[] array = (T[]) values.toArray();
-//
-// permute(variants, array, 0);
-//
-// LinkedHashMap<ArrayList<T>, Double> distances = new LinkedHashMap<>();
-//
-// for (ArrayList<T> list : variants) {
-//
-// double distance = 0;
-// LorenzVec last = start;
-//
-// for (T t : list) {
-// LorenzVec location = map.get(t);
-// distance += last.distanceSq(location);
-// last = location;
-// }
-//
-// distances.put(list, distance);
-// }
-//
-// Map<ArrayList<T>, Double> sort;
-// if (brokenMath) {
-// sort = sortByValue(distances);
-// } else {
-// sort = sortByValueAsc(distances);
-// }
-//
-// double fastestDistance = sort.values().iterator().next();
-// fastestWithout.put(without, fastestDistance);
-// }
-//
-// T skip = sortByValueAsc(fastestWithout).keySet().iterator().next();
-//
-//
-// map.remove(skip);
-// ArrayList<T> result = sortLocationListB(start, map, brokenMath, false, T -> false, 0);
-// result.add(skip);
-//
-// return result;
-// }
-
- public static <T> ArrayList<LorenzVec> sortLocationListB(LorenzVec start, Map<T, LorenzVec> map, boolean brokenMath,
- boolean skipWorst, Function<T, Boolean> shouldAddToHostile, int addToHostileLastValue) {
-
-// if (skipWorst) {
-// return sortLocationListC(start, map, brokenMath);
-// }
- ArrayList<ArrayList<T>> variants = new ArrayList<>();
- Set<T> values = map.keySet();
- T[] array = (T[]) values.toArray();
-
- permute(variants, array, 0);
-
- LinkedHashMap<ArrayList<T>, Double> distances = new LinkedHashMap<>();
-
- int with = 0;
- int without = 0;
-
- for (ArrayList<T> list : variants) {
-
- double distance = 0;
- LorenzVec last = start;
- T lastT = null;
-
- for (T t : list) {
- LorenzVec location = map.get(t);
- distance += last.distanceSq(location);
- last = location;
- lastT = t;
- }
- if (shouldAddToHostile.apply(lastT)) {
- distance += addToHostileLastValue;
- with++;
- } else {
- without++;
- }
-
- distances.put(list, distance);
- }
-// LorenzUtils.Companion.chat("with: " + with);
-// LorenzUtils.Companion.chat("without: " + without);
-
- Map<ArrayList<T>, Double> sort;
- if (brokenMath) {
- sort = sortByValue(distances);
- } else {
- sort = sortByValueAsc(distances);
- }
- ArrayList<T> result = sort.keySet().iterator().next();
- ArrayList<LorenzVec> resultList = new ArrayList<>();
- for (T t : result) {
- resultList.add(map.get(t));
- }
-
- return resultList;
- }
-
- //descending
- public static <K, V extends Comparable<? super V>> Map<K, V> sortByValue(Map<K, V> map) {
- List<Map.Entry<K, V>> list = new ArrayList<>(map.entrySet());
- list.sort(Map.Entry.comparingByValue());
- Collections.reverse(list);
-
- Map<K, V> result = new LinkedHashMap<>();
- for (Map.Entry<K, V> entry : list) {
- result.put(entry.getKey(), entry.getValue());
- }
-
- return result;
- }
-
- //ascending
- public static <K, V extends Comparable<? super V>> Map<K, V> sortByValueAsc(Map<K, V> map) {
- List<Map.Entry<K, V>> list = new ArrayList<>(map.entrySet());
- list.sort(Map.Entry.comparingByValue());
-
- Map<K, V> result = new LinkedHashMap<>();
- for (Map.Entry<K, V> entry : list) {
- result.put(entry.getKey(), entry.getValue());
- }
-
- return result;
- }
-
- public static String formatInteger(int i) {
- return new DecimalFormat("#,##0").format(i).replace(',', '.');
- }
-
- public static List<ItemStack> getItemsInInventory() {
- return getItemsInInventory(false);
- }
-
- public static List<ItemStack> getItemsInInventory(boolean withCursorItem) {
- List<ItemStack> list = new ArrayList<>();
-
-// EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
- EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
- if (player == null) {
- System.err.println("loadCurrentInventory: player is null!");
- return list;
- }
-
- InventoryPlayer inventory = player.inventory;
- ItemStack[] mainInventory = inventory.mainInventory;
-
- ArrayList<ItemStack> helpList = new ArrayList<>();
- helpList.addAll(Arrays.asList(mainInventory));
-
- if (withCursorItem) {
- helpList.add(inventory.getItemStack());
- }
-
- for (ItemStack item : helpList) {
- if (item == null) continue;
- String name = item.getDisplayName();
- if (name.equalsIgnoreCase("air")) continue;
- if (name.equalsIgnoreCase("luft")) continue;
- list.add(item);
- }
-
- return list;
- }
-
- public static void drawWaypoint(LorenzVec pos, float partialTicks, Color color, boolean beacon) {
- drawWaypoint(pos, partialTicks, color, beacon, false);
- }
-
- public static void drawWaypoint(LorenzVec pos, float partialTicks, Color color, boolean beacon, boolean forceBeacon) {
- Entity viewer = Minecraft.getMinecraft().getRenderViewEntity();
- double viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partialTicks;
- double viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partialTicks;
- double viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partialTicks;
-
- double x = pos.getX() - viewerX;
- double y = pos.getY() - viewerY;
- double z = pos.getZ() - viewerZ;
-
-
- GlStateManager.disableDepth();
- GlStateManager.disableCull();
- GlStateManager.disableTexture2D();
- if (beacon) {
- double distSq = x * x + y * y + z * z;
- if (distSq > 5 * 5 || forceBeacon) {
- //TODO add beacon
-// GriffinUtils.renderBeaconBeam(x, y, z, color.getRGB(), 1.0f, partialTicks);
- }
- }
-// BlockPos a = pos.toBlocPos();
-// BlockPos b = pos.add(1, 1, 1).toBlocPos();
-// draw3DBox(new AxisAlignedBB(a, b), color, partialTicks);
-
- AxisAlignedBB aabb = new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1);
-
- draw3DBox(aabb, color, partialTicks);
- GlStateManager.disableLighting();
- GlStateManager.enableTexture2D();
- GlStateManager.enableDepth();
-
- }
-
- public static void draw3DLine(LorenzVec p1, LorenzVec p2, Color color, int lineWidth, boolean depth, float partialTicks) {
- GlStateManager.disableDepth();
- GlStateManager.disableCull();
-
-// Vec3 pos1 = new Vec3(p1.getX(), p1.getY(), p1.getZ());
-// Vec3 pos2 = new Vec3(p2.getX(), p2.getY(), p2.getZ());
-
- Entity render = Minecraft.getMinecraft().getRenderViewEntity();
- WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer();
-
- double realX = render.lastTickPosX + (render.posX - render.lastTickPosX) * partialTicks;
- double realY = render.lastTickPosY + (render.posY - render.lastTickPosY) * partialTicks;
- double realZ = render.lastTickPosZ + (render.posZ - render.lastTickPosZ) * partialTicks;
-
- GlStateManager.pushMatrix();
- GlStateManager.translate(-realX, -realY, -realZ);
- GlStateManager.disableTexture2D();
- GlStateManager.enableBlend();
- GlStateManager.disableAlpha();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GL11.glLineWidth(lineWidth);
-
-
- if (!depth) {
- GL11.glDisable(GL11.GL_DEPTH_TEST);
- GlStateManager.depthMask(false);
- }
- GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f);
- worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
-
- worldRenderer.pos(p1.getX(), p1.getY(), p1.getZ()).endVertex();
- worldRenderer.pos(p2.getX(), p2.getY(), p2.getZ()).endVertex();
- Tessellator.getInstance().draw();
-
- GlStateManager.translate(realX, realY, realZ);
- if (!depth) {
- GL11.glEnable(GL11.GL_DEPTH_TEST);
- GlStateManager.depthMask(true);
- }
-
-
- GlStateManager.disableBlend();
- GlStateManager.enableAlpha();
- GlStateManager.enableTexture2D();
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- GlStateManager.popMatrix();
-
-
- GlStateManager.disableLighting();
- GlStateManager.enableDepth();
- }
-
- public static void draw3DBox(AxisAlignedBB aabb, Color colour, float partialTicks) {
- Entity render = Minecraft.getMinecraft().getRenderViewEntity();
- WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer();
-
- double realX = render.lastTickPosX + (render.posX - render.lastTickPosX) * partialTicks;
- double realY = render.lastTickPosY + (render.posY - render.lastTickPosY) * partialTicks;
- double realZ = render.lastTickPosZ + (render.posZ - render.lastTickPosZ) * partialTicks;
-
- GlStateManager.pushMatrix();
- GlStateManager.translate(-realX, -realY, -realZ);
- GlStateManager.disableTexture2D();
- GlStateManager.enableBlend();
- GlStateManager.disableAlpha();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GL11.glLineWidth(2);
- GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue() / 255f, colour.getAlpha() / 255f);
- worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
-
- worldRenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex();
- worldRenderer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex();
- worldRenderer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex();
- worldRenderer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex();
- worldRenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex();
- Tessellator.getInstance().draw();
- worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
- worldRenderer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex();
- worldRenderer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex();
- worldRenderer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex();
- worldRenderer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex();
- worldRenderer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex();
- Tessellator.getInstance().draw();
- worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
- worldRenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex();
- worldRenderer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex();
- worldRenderer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex();
- worldRenderer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex();
- worldRenderer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex();
- worldRenderer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex();
- worldRenderer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex();
- worldRenderer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex();
- Tessellator.getInstance().draw();
-
- GlStateManager.translate(realX, realY, realZ);
- GlStateManager.disableBlend();
- GlStateManager.enableAlpha();
- GlStateManager.enableTexture2D();
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- GlStateManager.popMatrix();
- }
-}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/GriffinUtils.kt b/src/main/java/at/hannibal2/skyhanni/test/GriffinUtils.kt
index d9da2745c..8c2a39d46 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/GriffinUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/GriffinUtils.kt
@@ -1,6 +1,5 @@
package at.hannibal2.skyhanni.test
-import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils
import at.hannibal2.skyhanni.utils.RenderUtils.expandBlock
@@ -11,11 +10,6 @@ import java.awt.Color
object GriffinUtils {
-
- fun RenderWorldLastEvent.drawWaypoint(location: LorenzVec, color: LorenzColor, beacon: Boolean = false) {
- GriffinJavaUtils.drawWaypoint(location, partialTicks, color.toColor(), beacon)
- }
-
fun RenderWorldLastEvent.drawWaypointFilled(
location: LorenzVec,
color: Color,
@@ -36,12 +30,10 @@ object GriffinUtils {
GlStateManager.disableCull()
}
RenderUtils.drawFilledBoundingBox(
- AxisAlignedBB(x - extraSize,
- y - extraSizeBottomY,
- z - extraSize,
- x + 1 + extraSize,
- y + 1 + extraSizeTopY,
- z + 1 + extraSize).expandBlock(),
+ AxisAlignedBB(
+ x - extraSize, y - extraSizeBottomY, z - extraSize,
+ x + 1 + extraSize, y + 1 + extraSizeTopY, z + 1 + extraSize
+ ).expandBlock(),
color,
(0.1f + 0.005f * distSq.toFloat()).coerceAtLeast(0.2f)
)
@@ -55,107 +47,4 @@ object GriffinUtils {
GlStateManager.enableCull()
}
}
-
- fun RenderWorldLastEvent.draw3DLine(
- p1: LorenzVec,
- p2: LorenzVec,
- color: LorenzColor,
- lineWidth: Int,
- depth: Boolean,
- ) {
-
- GriffinJavaUtils.draw3DLine(p1, p2, color.toColor(), lineWidth, depth, partialTicks)
- }
-
-// fun renderBeaconBeam(x: Double, y: Double, z: Double, rgb: Int, alphaMultiplier: Float, partialTicks: Float) {
-// val height = 300
-// val bottomOffset = 0
-// val topOffset = bottomOffset + height
-// val tessellator = Tessellator.getInstance()
-// val worldrenderer = tessellator.worldRenderer
-//
-//// Skytils.mc.textureManager.bindTexture(RenderUtil.beaconBeam)
-// GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0f)
-// GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0f)
-// GlStateManager.disableLighting()
-// GlStateManager.enableCull()
-// GlStateManager.enableTexture2D()
-// GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0)
-// GlStateManager.enableBlend()
-// GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0)
-// val time = Skytils.mc.theWorld.totalWorldTime + partialTicks.toDouble()
-// val d1 = MathHelper.func_181162_h(
-// -time * 0.2 - MathHelper.floor_double(-time * 0.1)
-// .toDouble()
-// )
-// val r = (rgb shr 16 and 0xFF) / 255f
-// val g = (rgb shr 8 and 0xFF) / 255f
-// val b = (rgb and 0xFF) / 255f
-// val d2 = time * 0.025 * -1.5
-// val d4 = 0.5 + cos(d2 + 2.356194490192345) * 0.2
-// val d5 = 0.5 + sin(d2 + 2.356194490192345) * 0.2
-// val d6 = 0.5 + cos(d2 + Math.PI / 4.0) * 0.2
-// val d7 = 0.5 + sin(d2 + Math.PI / 4.0) * 0.2
-// val d8 = 0.5 + cos(d2 + 3.9269908169872414) * 0.2
-// val d9 = 0.5 + sin(d2 + 3.9269908169872414) * 0.2
-// val d10 = 0.5 + cos(d2 + 5.497787143782138) * 0.2
-// val d11 = 0.5 + sin(d2 + 5.497787143782138) * 0.2
-// val d14 = -1.0 + d1
-// val d15 = height.toDouble() * 2.5 + d14
-// worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR)
-// worldrenderer.pos(x + d4, y + topOffset, z + d5).tex(1.0, d15).color(r, g, b, 1.0f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + d4, y + bottomOffset, z + d5).tex(1.0, d14).color(r, g, b, 1.0f).endVertex()
-// worldrenderer.pos(x + d6, y + bottomOffset, z + d7).tex(0.0, d14).color(r, g, b, 1.0f).endVertex()
-// worldrenderer.pos(x + d6, y + topOffset, z + d7).tex(0.0, d15).color(r, g, b, 1.0f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + d10, y + topOffset, z + d11).tex(1.0, d15).color(r, g, b, 1.0f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + d10, y + bottomOffset, z + d11).tex(1.0, d14).color(r, g, b, 1.0f).endVertex()
-// worldrenderer.pos(x + d8, y + bottomOffset, z + d9).tex(0.0, d14).color(r, g, b, 1.0f).endVertex()
-// worldrenderer.pos(x + d8, y + topOffset, z + d9).tex(0.0, d15).color(r, g, b, 1.0f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + d6, y + topOffset, z + d7).tex(1.0, d15).color(r, g, b, 1.0f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + d6, y + bottomOffset, z + d7).tex(1.0, d14).color(r, g, b, 1.0f).endVertex()
-// worldrenderer.pos(x + d10, y + bottomOffset, z + d11).tex(0.0, d14).color(r, g, b, 1.0f).endVertex()
-// worldrenderer.pos(x + d10, y + topOffset, z + d11).tex(0.0, d15).color(r, g, b, 1.0f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + d8, y + topOffset, z + d9).tex(1.0, d15).color(r, g, b, 1.0f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + d8, y + bottomOffset, z + d9).tex(1.0, d14).color(r, g, b, 1.0f).endVertex()
-// worldrenderer.pos(x + d4, y + bottomOffset, z + d5).tex(0.0, d14).color(r, g, b, 1.0f).endVertex()
-// worldrenderer.pos(x + d4, y + topOffset, z + d5).tex(0.0, d15).color(r, g, b, 1.0f * alphaMultiplier)
-// .endVertex()
-// tessellator.draw()
-// GlStateManager.disableCull()
-// val d12 = -1.0 + d1
-// val d13 = height + d12
-// worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR)
-// worldrenderer.pos(x + 0.2, y + topOffset, z + 0.2).tex(1.0, d13).color(r, g, b, 0.25f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + 0.2, y + bottomOffset, z + 0.2).tex(1.0, d12).color(r, g, b, 0.25f).endVertex()
-// worldrenderer.pos(x + 0.8, y + bottomOffset, z + 0.2).tex(0.0, d12).color(r, g, b, 0.25f).endVertex()
-// worldrenderer.pos(x + 0.8, y + topOffset, z + 0.2).tex(0.0, d13).color(r, g, b, 0.25f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + 0.8, y + topOffset, z + 0.8).tex(1.0, d13).color(r, g, b, 0.25f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + 0.8, y + bottomOffset, z + 0.8).tex(1.0, d12).color(r, g, b, 0.25f).endVertex()
-// worldrenderer.pos(x + 0.2, y + bottomOffset, z + 0.8).tex(0.0, d12).color(r, g, b, 0.25f).endVertex()
-// worldrenderer.pos(x + 0.2, y + topOffset, z + 0.8).tex(0.0, d13).color(r, g, b, 0.25f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + 0.8, y + topOffset, z + 0.2).tex(1.0, d13).color(r, g, b, 0.25f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + 0.8, y + bottomOffset, z + 0.2).tex(1.0, d12).color(r, g, b, 0.25f).endVertex()
-// worldrenderer.pos(x + 0.8, y + bottomOffset, z + 0.8).tex(0.0, d12).color(r, g, b, 0.25f).endVertex()
-// worldrenderer.pos(x + 0.8, y + topOffset, z + 0.8).tex(0.0, d13).color(r, g, b, 0.25f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + 0.2, y + topOffset, z + 0.8).tex(1.0, d13).color(r, g, b, 0.25f * alphaMultiplier)
-// .endVertex()
-// worldrenderer.pos(x + 0.2, y + bottomOffset, z + 0.8).tex(1.0, d12).color(r, g, b, 0.25f).endVertex()
-// worldrenderer.pos(x + 0.2, y + bottomOffset, z + 0.2).tex(0.0, d12).color(r, g, b, 0.25f).endVertex()
-// worldrenderer.pos(x + 0.2, y + topOffset, z + 0.2).tex(0.0, d13).color(r, g, b, 0.25f * alphaMultiplier)
-// .endVertex()
-// tessellator.draw()
-// }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 83152f486..3783833fb 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -86,7 +86,6 @@ object LorenzUtils {
//TODO move into StringUtils
fun String.matchRegex(@Language("RegExp") regex: String): Boolean = regex.toRegex().matches(this)
-
fun SimpleDateFormat.formatCurrentTime(): String = this.format(System.currentTimeMillis())
fun stripVanillaMessage(originalMessage: String): String {
@@ -157,4 +156,16 @@ object LorenzUtils {
else -> 0
}
}
+
+ fun <K, V : Comparable<V>> List<Pair<K, V>>.sorted(): List<Pair<K, V>> {
+ return sortedBy { (_, value) -> value }
+ }
+
+ fun <K, V : Comparable<V>> Map<K, V>.sorted(): Map<K, V> {
+ return toList().sorted().toMap()
+ }
+
+ fun <K, V : Comparable<V>> Map<K, V>.sortedDesc(): Map<K, V> {
+ return toList().sorted().reversed().toMap()
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index e0abe1ac5..4df10611f 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -461,7 +461,7 @@ object RenderUtils {
var offsetY = 0
for (s in list) {
- renderString(s, offsetY, center = center)
+ renderString(s, offsetY = offsetY, center = center)
offsetY += 10 + extraSpace
}
}
@@ -721,4 +721,43 @@ object RenderUtils {
GL11.glDepthMask(true)
}
}
+
+ fun RenderWorldLastEvent.draw3DLine(p1: LorenzVec, p2: LorenzVec, color: Color, lineWidth: Int, depth: Boolean) {
+ GlStateManager.disableDepth()
+ GlStateManager.disableCull()
+
+ val render = Minecraft.getMinecraft().renderViewEntity
+ val worldRenderer = Tessellator.getInstance().worldRenderer
+ val realX = render.lastTickPosX + (render.posX - render.lastTickPosX) * partialTicks
+ val realY = render.lastTickPosY + (render.posY - render.lastTickPosY) * partialTicks
+ val realZ = render.lastTickPosZ + (render.posZ - render.lastTickPosZ) * partialTicks
+ GlStateManager.pushMatrix()
+ GlStateManager.translate(-realX, -realY, -realZ)
+ GlStateManager.disableTexture2D()
+ GlStateManager.enableBlend()
+ GlStateManager.disableAlpha()
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0)
+ GL11.glLineWidth(lineWidth.toFloat())
+ if (!depth) {
+ GL11.glDisable(GL11.GL_DEPTH_TEST)
+ GlStateManager.depthMask(false)
+ }
+ GlStateManager.color(color.red / 255f, color.green / 255f, color.blue / 255f, color.alpha / 255f)
+ worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION)
+ worldRenderer.pos(p1.x, p1.y, p1.z).endVertex()
+ worldRenderer.pos(p2.x, p2.y, p2.z).endVertex()
+ Tessellator.getInstance().draw()
+ GlStateManager.translate(realX, realY, realZ)
+ if (!depth) {
+ GL11.glEnable(GL11.GL_DEPTH_TEST)
+ GlStateManager.depthMask(true)
+ }
+ GlStateManager.disableBlend()
+ GlStateManager.enableAlpha()
+ GlStateManager.enableTexture2D()
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f)
+ GlStateManager.popMatrix()
+ GlStateManager.disableLighting()
+ GlStateManager.enableDepth()
+ }
} \ No newline at end of file