diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2023-07-05 12:29:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-05 12:29:49 +0200 |
commit | c4092f9f36ef2d6a1914ee5ef606522d35e14cdc (patch) | |
tree | 5f606fa38d17f3e2471e75060c06acb9f65a2c81 /src/main/java/at | |
parent | 5bedd8978dc05f60ef752a95a2062e99be41281c (diff) | |
download | skyhanni-c4092f9f36ef2d6a1914ee5ef606522d35e14cdc.tar.gz skyhanni-c4092f9f36ef2d6a1914ee5ef606522d35e14cdc.tar.bz2 skyhanni-c4092f9f36ef2d6a1914ee5ef606522d35e14cdc.zip |
mirror verse jump and run (#265)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Co-authored-by: Roman / Linnea Gräf <nea@nea.moe>
Diffstat (limited to 'src/main/java/at')
14 files changed, 304 insertions, 53 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index e1c83f54a..2513c1860 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -317,6 +317,7 @@ class SkyHanniMod { loadModule(DanceRoomHelper) loadModule(LaserParkour()) loadModule(CustomTextBox()) + loadModule(RiftUpsideDownParkour()) init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index b41ec2227..cec63122e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -92,7 +92,7 @@ object Commands { registerCommand("shreloadlocalrepo") { SkyHanniMod.repo.reloadLocalRepo() } registerCommand("shstoplisteners") { SkyHanniTestCommand.stopListeners() } registerCommand("shreloadlisteners") { SkyHanniTestCommand.reloadListeners() } - registerCommand("shcopylocation") { SkyHanniTestCommand.copyLocation() } + registerCommand("shcopylocation") { SkyHanniTestCommand.copyLocation(it) } registerCommand("shcopyentities") { CopyNearbyEntitiesCommand.command(it) } registerCommand("shcopytablist") { CopyTabListCommand.command(it) } registerCommand("shcopyscoreboard") { CopyScoreboardCommand.command(it) } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java index e957ed560..a6c11495d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java @@ -174,10 +174,10 @@ public class RiftConfig { @Expose public DanceRoomHelper danceRoomHelper = new DanceRoomHelper(); - public static class DanceRoomHelper{ + public static class DanceRoomHelper { @Expose - @ConfigOption(name= "Enabled", desc = "Helps to solve the dance room in the mirror verse by showing multiple tasks at once.") + @ConfigOption(name = "Enabled", desc = "Helps to solve the dance room in the mirror verse by showing multiple tasks at once.") @ConfigEditorBoolean public boolean enabled = false; @@ -201,6 +201,39 @@ public class RiftConfig { } + @ConfigOption(name = "Upside Down Parkour", desc = "") + @Accordion + @Expose + public UpsideDownParkour upsideDownParkour = new UpsideDownParkour(); + + public static class UpsideDownParkour { + + @Expose + @ConfigOption(name = "Enabled", desc = "Helps to solve the upside down parkour in the mirror verse by showing the correct way.") + @ConfigEditorBoolean + public boolean enabled = true; + + @Expose + @ConfigOption(name = "Look Ahead", desc = "How many plattforms should be shown in front of you?") + @ConfigEditorSlider(minStep = 1, maxValue = 9, minValue = 1) + public int lookAhead = 2; + + @Expose + @ConfigOption(name = "Rainbow Color", desc = "Show the rainbow color effect instead of a boring monochrome.") + @ConfigEditorBoolean + public boolean rainbowColor = true; + + @Expose + @ConfigOption(name = "Monochrome Color", desc = "Set a boring monochrome color for the parkour platforms.") + @ConfigEditorColour + public String monochromeColor = "0:60:0:0:255"; + + @Expose + @ConfigOption(name = "Hide others players", desc = "Hide other players while doing the upside down parkour.") + @ConfigEditorBoolean + public boolean hidePlayers = false; + } + @Expose @ConfigOption(name = "Tubulator", desc = "Highlights the location of the invisible blocks (Laser Parkour).") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 4d0cce395..7c017f8c5 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -28,12 +28,7 @@ class HypixelData { var profileName = "" var joinedWorld = 0L - fun readSkyBlockArea(): String { - return ScoreboardData.sidebarLinesFormatted - .firstOrNull { it.startsWith(" §7⏣ ") || it.startsWith(" §5ф ") } - ?.substring(5)?.removeColor() - ?: "invalid" - } + var skyBlockArea = "?" } private var loggerIslandChange = LorenzLogger("debug/island_change") @@ -71,6 +66,15 @@ class HypixelData { @SubscribeEvent fun onTick(event: LorenzTickEvent) { + if (event.isMod(2)) { + if (LorenzUtils.inSkyBlock) { + skyBlockArea = ScoreboardData.sidebarLinesFormatted + .firstOrNull { it.startsWith(" §7⏣ ") || it.startsWith(" §5ф ") } + ?.substring(5)?.removeColor() + ?: "?" + } + } + if (!event.isMod(5)) return if (!LorenzUtils.onHypixel) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index 43dd23adb..486b762a7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -192,7 +192,7 @@ class FarmingFortuneDisplay { fun getCounterFortune(tool: ItemStack?): Double { val counter = tool?.getHoeCounter() ?: return 0.0 val digits = floor(log10(counter.toDouble())) - return (16 * digits - 48).takeIf { it > 0.0 } ?: 0.0 + return (16 * digits - 48).coerceAtLeast(0.0) } fun getDedicationFortune(tool: ItemStack?, cropType: CropType?): Double { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/CruxTalismanDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/CruxTalismanDisplay.kt index 73ebd0e3b..632129d11 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/CruxTalismanDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/CruxTalismanDisplay.kt @@ -123,5 +123,5 @@ object CruxTalismanDisplay { data class Crux(val name: String, val tier: String, val progress: String, val maxed: Boolean) - fun isEnabled() = RiftAPI.inRift() && config.enabled + fun isEnabled() = RiftAPI.inRift() && config.enabled && LorenzUtils.skyBlockArea != "Mirrorverse" }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt index 6ea866311..a7d40580b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt @@ -26,7 +26,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object EnigmaSoulWaypoints { private val config get() = SkyHanniMod.feature.rift.enigmaSoulWaypoints private var inInventory = false - private val soulLocations = mutableMapOf<String, LorenzVec>() + private var soulLocations = mapOf<String, LorenzVec>() private val trackedSouls = mutableListOf<String>() private val inventoryUnfound = mutableListOf<String>() private var adding = true @@ -144,10 +144,11 @@ object EnigmaSoulWaypoints { fun onRepoReload(event: RepositoryReloadEvent) { val data = event.getConstant<EnigmaSoulsJson>("EnigmaSouls") ?: return val areas = data.areas ?: error("'areas' is null in EnigmaSouls!") - soulLocations.clear() - for ((area, locations) in areas) { - for (location in locations) { - soulLocations[location.name] = location.position + soulLocations = buildMap { + for ((area, locations) in areas) { + for (location in locations) { + this[location.name] = location.position + } } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt index 6bffa8a80..42188244e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt @@ -84,6 +84,7 @@ class RiftTimer { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!isEnabled()) return + if (LorenzUtils.skyBlockArea == "Mirrorverse") return config.timerPosition.renderStrings(display, posLabel = "Rift Timer") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftUpsideDownParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftUpsideDownParkour.kt new file mode 100644 index 000000000..721c51654 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftUpsideDownParkour.kt @@ -0,0 +1,139 @@ +package at.hannibal2.skyhanni.features.rift + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.CheckRenderEntityEvent +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer +import at.hannibal2.skyhanni.utils.LocationUtils.playerLocation +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor +import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.RenderUtils +import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine +import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import at.hannibal2.skyhanni.utils.RenderUtils.drawFilledBoundingBox +import at.hannibal2.skyhanni.utils.RenderUtils.expandBlock +import at.hannibal2.skyhanni.utils.jsonobjects.ParkourJson +import at.hannibal2.skyhanni.utils.jsonobjects.ParkourJson.ShortCut +import net.minecraft.client.Minecraft +import net.minecraftforge.client.event.RenderWorldLastEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.awt.Color +import kotlin.time.Duration.Companion.seconds + +class RiftUpsideDownParkour { + private val config get() = SkyHanniMod.feature.rift.mirrorVerse.upsideDownParkour + private var locations = emptyList<LorenzVec>() + private var shortCuts = emptyList<ShortCut>() + private var current = -1 + private var visible = false + + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + val data = event.getConstant<ParkourJson>("RiftUpsideDownParkour") ?: return + locations = data.locations + shortCuts = data.shortCuts + } + + @SubscribeEvent + fun onCheckRender(event: CheckRenderEntityEvent<*>) { + if (!isEnabled()) return + if (!config.hidePlayers) return + + if (current != -1) { + event.isCanceled = true + } + } + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!isEnabled()) return + + if (event.message == "§c§lOH NO! THE LAVA OOFED YOU BACK TO THE START!") { + current = -1 + visible = false + } + } + + private val lookAhead get() = config.lookAhead + 1 + + @SubscribeEvent + fun onRenderWorld(event: RenderWorldLastEvent) { + if (!isEnabled()) return + + if (current == locations.size - 1) visible = false + + val distanceToPlayer = locations.first().distanceToPlayer() + if (distanceToPlayer < 2) { + visible = true + } else if (distanceToPlayer > 15) { + if (current < 1) { + visible = false + } + } + + if (!visible) return + + for ((index, location) in locations.withIndex()) { + if (location.distanceToPlayer() < 2) { + if (Minecraft.getMinecraft().thePlayer.onGround) { + current = index + } + } + } + if (current < 0) return + + val inProgressVec = getInProgressPair().toSingletonListOrEmpty() + for ((prev, next) in locations.asSequence().withIndex().zipWithNext().drop(current) + .take(lookAhead - 1) + inProgressVec) { + event.draw3DLine(prev.value, next.value, colorForIndex(prev.index), 5, false, colorForIndex(next.index)) + } + val nextShortcuts = current until current + lookAhead + for (shortCut in shortCuts) { + if (shortCut.from in nextShortcuts && shortCut.to in locations.indices) { + event.draw3DLine(locations[shortCut.from], locations[shortCut.to], Color.RED, 3, false) + event.drawFilledBoundingBox(axisAlignedBB(locations[shortCut.to]), Color.RED, 1f) + event.drawDynamicText(locations[shortCut.to].add(-0.5, 1.0, -0.5), "§cShortcut", 2.5) + } + + } + for ((index, location) in locations.asSequence().withIndex().drop(current) + .take(lookAhead) + inProgressVec.map { it.second }) { + event.drawFilledBoundingBox(axisAlignedBB(location), colorForIndex(index), 1f) + } + } + + private fun getInProgressPair(): Pair<IndexedValue<LorenzVec>, IndexedValue<LorenzVec>>? { + if (current < 0 || current + lookAhead >= locations.size) return null + val currentPosition = locations[current] + val nextPosition = locations[current + 1] + val lookAheadStart = locations[current + lookAhead - 1] + val lookAheadEnd = locations[current + lookAhead] + if (playerLocation().distance(nextPosition) > currentPosition.distance(nextPosition)) return null + return Pair( + IndexedValue(current + lookAhead - 1, lookAheadStart), + IndexedValue( + current + lookAhead, lookAheadStart.add( + lookAheadEnd.subtract(lookAheadStart) + .scale(playerLocation().distance(currentPosition) / currentPosition.distance(nextPosition)) + ) + ) + ) + } + + private fun axisAlignedBB(loc: LorenzVec) = loc.add(-1.0, 0.0, -1.0).boundingToOffset(2, -1, 2).expandBlock() + + private fun colorForIndex(index: Int) = if (config.rainbowColor) { + RenderUtils.chromaColor(4.seconds, offset = -index / 12f, brightness = 0.7f) + } else { + config.monochromeColor.toChromaColor() + } + + fun isEnabled() = RiftAPI.inRift() && LorenzUtils.skyBlockArea == "Mirrorverse" && config.enabled +} + +private fun <T : Any> T?.toSingletonListOrEmpty(): List<T> { + if (this == null) return emptyList() + return listOf(this) +} diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt index d7b1b0029..0ec54b3a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt @@ -152,11 +152,18 @@ class SkyHanniTestCommand { LorenzUtils.chat("§e[SkyHanni] stopped ${modules.size} listener classes.") } - fun copyLocation() { + fun copyLocation(args: Array<String>) { val location = LocationUtils.playerLocation() - val x = LorenzUtils.formatDouble(location.x) - val y = LorenzUtils.formatDouble(location.y) - val z = LorenzUtils.formatDouble(location.z) + val x = LorenzUtils.formatDouble(location.x + 0.001).replace(",", ".") + val y = LorenzUtils.formatDouble(location.y + 0.001).replace(",", ".") + val z = LorenzUtils.formatDouble(location.z + 0.001).replace(",", ".") + if (args.size == 1) { + if (args[0].equals("json", false)) { + OSUtils.copyToClipboard("\"$x:$y:$z\"") + return + } + } + OSUtils.copyToClipboard("LorenzVec($x, $y, $z)") } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 77a47b895..129cec02e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -32,36 +32,25 @@ import kotlin.reflect.KProperty0 object LorenzUtils { - val onHypixel: Boolean - get() = (HypixelData.hypixelLive || HypixelData.hypixelAlpha) && Minecraft.getMinecraft().thePlayer != null + val onHypixel get() = (HypixelData.hypixelLive || HypixelData.hypixelAlpha) && Minecraft.getMinecraft().thePlayer != null - val isOnAlphaServer: Boolean - get() = onHypixel && HypixelData.hypixelAlpha + val isOnAlphaServer get() = onHypixel && HypixelData.hypixelAlpha - val inSkyBlock: Boolean - get() = onHypixel && HypixelData.skyBlock + val inSkyBlock get() = onHypixel && HypixelData.skyBlock - val inDungeons: Boolean - get() = inSkyBlock && DungeonData.inDungeon() + val inDungeons get() = inSkyBlock && DungeonData.inDungeon() - val skyBlockIsland: IslandType - get() = HypixelData.skyBlockIsland + val skyBlockIsland get() = HypixelData.skyBlockIsland - //TODO add cache - val skyBlockArea: String - get() = HypixelData.readSkyBlockArea() + val skyBlockArea get() = if (inSkyBlock) HypixelData.skyBlockArea else "?" - val inKuudraFight: Boolean - get() = skyBlockIsland == IslandType.KUUDRA_ARENA + val inKuudraFight get() = skyBlockIsland == IslandType.KUUDRA_ARENA - val noTradeMode: Boolean - get() = HypixelData.noTrade + val noTradeMode get() = HypixelData.noTrade - val isBingoProfile: Boolean - get() = inSkyBlock && (HypixelData.bingo || TestBingo.testBingo) + val isBingoProfile get() = inSkyBlock && (HypixelData.bingo || TestBingo.testBingo) - val lastWorldSwitch: Long - get() = HypixelData.joinedWorld + val lastWorldSwitch get() = HypixelData.joinedWorld const val DEBUG_PREFIX = "[SkyHanni Debug] §7" private val log = LorenzLogger("chat/mod_sent") @@ -389,4 +378,10 @@ object LorenzUtils { /** transfer string colors from the config to java.awt.Color */ fun String.toChromaColor() = Color(SpecialColour.specialToChromaRGB(this), true) + + fun <E> List<E>.getOrNull(index: Int): E? { + return if (index in indices) { + get(index) + } else null + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt index b0b363b05..1d1909875 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt @@ -3,10 +3,15 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.utils.LorenzUtils.round import net.minecraft.entity.Entity import net.minecraft.network.play.server.S2APacketParticles +import net.minecraft.util.AxisAlignedBB import net.minecraft.util.BlockPos import net.minecraft.util.Rotations import net.minecraft.util.Vec3 -import kotlin.math.* +import kotlin.math.cos +import kotlin.math.pow +import kotlin.math.round +import kotlin.math.sin +import kotlin.math.sqrt data class LorenzVec( val x: Double, @@ -102,6 +107,12 @@ data class LorenzVec( return LorenzVec(x, y, z) } + fun boundingToOffset(offX: Int, offY: Int, offZ: Int) = AxisAlignedBB(x, y, z, x + offX, y + offY, z + offZ) + + fun scale(scalar: Double): LorenzVec { + return LorenzVec(scalar * x, scalar * y, scalar * z) + } + companion object { fun getFromYawPitch(yaw: Double, pitch: Double): LorenzVec { val yaw: Double = (yaw + 90) * Math.PI / 180 diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 69df66afa..c4a4239c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -23,6 +23,8 @@ import java.awt.Color import kotlin.math.cos import kotlin.math.sin import kotlin.math.sqrt +import kotlin.time.Duration +import kotlin.time.DurationUnit object RenderUtils { @@ -551,7 +553,8 @@ object RenderUtils { GlStateManager.translate(getAbsX().toFloat(), (getAbsY() + offsetY).toFloat(), 0F) var offsetX = 0 for (any in line) { - val renderable = Renderable.fromAny(any, itemScale = itemScale) ?: throw RuntimeException("Unknown render object: $any") + val renderable = + Renderable.fromAny(any, itemScale = itemScale) ?: throw RuntimeException("Unknown render object: $any") renderable.render(getAbsX() + offsetX, getAbsY() + offsetY) offsetX += renderable.width @@ -783,43 +786,62 @@ object RenderUtils { } } - fun RenderWorldLastEvent.draw3DLine(p1: LorenzVec, p2: LorenzVec, color: Color, lineWidth: Int, depth: Boolean) { - GlStateManager.disableDepth() - GlStateManager.disableCull() + fun RenderWorldLastEvent.drawFilledBoundingBox( + aabb: AxisAlignedBB, + c: Color, + alphaMultiplier: Float = 1f, + /** + * If set to `true`, renders the box relative to the camera instead of relative to the world. + * If set to `false`, will be relativized to [RenderUtils.getViewerPos]. + */ + renderRelativeToCamera: Boolean = false, + drawVerticalBarriers: Boolean = true + ) { + drawFilledBoundingBox(aabb, c, alphaMultiplier, renderRelativeToCamera, drawVerticalBarriers, partialTicks) + } + fun RenderWorldLastEvent.draw3DLine( + p1: LorenzVec, p2: LorenzVec, color: Color, lineWidth: Int, depth: Boolean, targetColor: Color? = null + ) { 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.disableDepth() + GlStateManager.disableCull() + GlStateManager.disableLighting() GlStateManager.translate(-realX, -realY, -realZ) GlStateManager.disableTexture2D() GlStateManager.enableBlend() GlStateManager.disableAlpha() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 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() + GlStateManager.color(1f, 1f, 1f, 1f) + if (targetColor != null) + GlStateManager.shadeModel(GL11.GL_SMOOTH) + worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR) + worldRenderer.pos(p1.x, p1.y, p1.z).color(color.red, color.green, color.blue, color.alpha).endVertex() + val secondColor = targetColor ?: color + worldRenderer.pos(p2.x, p2.y, p2.z) + .color(secondColor.red, secondColor.green, secondColor.blue, secondColor.alpha).endVertex() Tessellator.getInstance().draw() - GlStateManager.translate(realX, realY, realZ) if (!depth) { GL11.glEnable(GL11.GL_DEPTH_TEST) GlStateManager.depthMask(true) } + GlStateManager.shadeModel(GL11.GL_FLAT) GlStateManager.disableBlend() GlStateManager.enableAlpha() GlStateManager.enableTexture2D() GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f) GlStateManager.popMatrix() GlStateManager.disableLighting() - GlStateManager.enableDepth() } fun RenderWorldLastEvent.exactLocation(entity: Entity): LorenzVec { @@ -832,4 +854,20 @@ object RenderUtils { val z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks return LorenzVec(x, y, z) } + + fun chromaColor( + timeTillRepeat: Duration, + offset: Float = 0f, + saturation: Float = 1F, + brightness: Float = 0.8F, + timeOverride: Long = System.currentTimeMillis() + ): Color { + return Color( + Color.HSBtoRGB( + ((offset + timeOverride / timeTillRepeat.toDouble(DurationUnit.MILLISECONDS)) % 1).toFloat(), + saturation, + brightness + ) + ) + } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ParkourJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ParkourJson.java new file mode 100644 index 000000000..71206d18c --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ParkourJson.java @@ -0,0 +1,21 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import at.hannibal2.skyhanni.utils.LorenzVec; +import com.google.gson.annotations.Expose; + +import java.util.ArrayList; +import java.util.List; + +public class ParkourJson { + @Expose + public List<LorenzVec> locations; + @Expose + public List<ShortCut> shortCuts = new ArrayList<>(); + + public static class ShortCut { + @Expose + public int from; + @Expose + public int to; + } +} |