diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-05-26 22:26:24 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-26 14:26:24 +0200 |
commit | 0ddd9edc94bc0c872109acd0b845163b073ceb6a (patch) | |
tree | e8cad5d9d86105dfce6809489c9f6409a3a5ffc2 /src/main/java/at/hannibal2 | |
parent | 573e8452bf2e9a3e1ca94f736c2b441796ad4b92 (diff) | |
download | skyhanni-0ddd9edc94bc0c872109acd0b845163b073ceb6a.tar.gz skyhanni-0ddd9edc94bc0c872109acd0b845163b073ceb6a.tar.bz2 skyhanni-0ddd9edc94bc0c872109acd0b845163b073ceb6a.zip |
Backend: Use less deprecated LorenzVec functions (#1556)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2')
17 files changed, 62 insertions, 103 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/composter/ComposterConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/composter/ComposterConfig.java index 653a3a243..867f63426 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/composter/ComposterConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/composter/ComposterConfig.java @@ -7,8 +7,8 @@ import com.google.gson.annotations.Expose; import io.github.notenoughupdates.moulconfig.annotations.Accordion; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown; -import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; public class ComposterConfig { @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt index 6497fddfb..a521e2354 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt @@ -270,7 +270,7 @@ class MobDetection { + "DistanceC: ${ entity.getLorenzVec().distanceChebyshevIgnoreY(LocationUtils.playerLocation()) }\n" - + "Relative Position: ${entity.getLorenzVec().subtract(LocationUtils.playerLocation())}\n " + + + "Relative Position: ${entity.getLorenzVec() - LocationUtils.playerLocation()}\n " + "}" ) // Uncomment this to make it closed a loop diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt index 2d97da6b0..aaaa1dd2e 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt @@ -7,7 +7,6 @@ import at.hannibal2.skyhanni.mixins.transformers.AccessorEventBus import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.launchwrapper.Launch import net.minecraftforge.common.MinecraftForge import net.minecraftforge.fml.common.eventhandler.Event import net.minecraftforge.fml.common.eventhandler.IEventListener diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt index 73fbc21a5..535e8d4a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt @@ -184,8 +184,8 @@ class SoopyGuessBurrow { val pr2 = mutableListOf<LorenzVec>() val start = slopeThing.size - 1 - val lastPos = locs[start].multiply(1).toDoubleArray() - val lastPos2 = locs[start].multiply(1).toDoubleArray() + val lastPos = locs[start].toDoubleArray() + val lastPos2 = locs[start].toDoubleArray() var distCovered = 0.0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt index 968601e92..c2c395c1a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleWaypoint.kt @@ -177,9 +177,9 @@ class PestParticleWaypoint { val list = locations.toList() var pos = LorenzVec(0.0, 0.0, 0.0) for ((i, particle) in list.withIndex()) { - pos = pos.add(particle.subtract(firstParticle).divide(i.toDouble() + 1.0)) + pos += (particle - firstParticle) / (i.toDouble() + 1.0) } - return firstParticle.add(pos.multiply(120.0 / list.size)) + return firstParticle + pos * (120.0 / list.size) } fun isEnabled() = GardenAPI.inGarden() && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt index 9c612695d..586521b4b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt @@ -2,7 +2,6 @@ package at.hannibal2.skyhanni.features.itemabilities.abilitycooldown import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.utils.LorenzColor -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt index c98a32a68..7eba48a4d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt @@ -134,7 +134,7 @@ class MinionXp { ) return positionsToCheck.any { position -> - val pos = minionPosition.add(position).toBlockPos() + val pos = (minionPosition + position).toBlockPos() val block = Minecraft.getMinecraft().theWorld.getBlockState(pos).block block is BlockChest } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt index c1420bc8c..12503c29d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt @@ -1,9 +1,9 @@ package at.hannibal2.skyhanni.features.misc.massconfiguration +import io.github.moulberry.notenoughupdates.util.Utils import io.github.notenoughupdates.moulconfig.internal.GlScissorStack import io.github.notenoughupdates.moulconfig.internal.RenderUtils import io.github.notenoughupdates.moulconfig.internal.TextRenderUtils -import io.github.moulberry.notenoughupdates.util.Utils import net.minecraft.client.gui.GuiScreen import net.minecraft.client.gui.ScaledResolution import net.minecraft.client.renderer.GlStateManager diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt index 057c0dfdc..f56185aba 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.features.misc.update import at.hannibal2.skyhanni.SkyHanniMod +import io.github.moulberry.notenoughupdates.itemeditor.GuiElementButton import io.github.notenoughupdates.moulconfig.gui.GuiOptionEditor import io.github.notenoughupdates.moulconfig.internal.TextRenderUtils import io.github.notenoughupdates.moulconfig.processor.ProcessedOption -import io.github.moulberry.notenoughupdates.itemeditor.GuiElementButton import net.minecraft.client.Minecraft import net.minecraft.client.renderer.GlStateManager import net.minecraft.util.EnumChatFormatting.GREEN diff --git a/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt index 724ed3dd7..ae0028b33 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/BlockUtils.kt @@ -41,8 +41,8 @@ object BlockUtils { } fun rayTrace(start: LorenzVec, direction: LorenzVec, distance: Double = 50.0): LorenzVec? { - val help = direction.normalize().multiply(distance) - val target = start.add(help) + val help = direction.normalize() * distance + val target = start + help val result = Minecraft.getMinecraft().theWorld.rayTraceBlocks(start.toVec3(), target.toVec3()) return result?.blockPos?.toLorenzVec() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index a6564f196..bd07f2115 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -37,33 +37,6 @@ object EntityUtils { return getNameTagWith(y, contains, debugRightEntity, inaccuracy, debugWrongEntity) != null } - fun EntityLivingBase.getAllNameTagsWith( - y: Int, - contains: String, - debugRightEntity: Boolean = false, - inaccuracy: Double = 1.6, - debugWrongEntity: Boolean = false, - ): List<EntityArmorStand> { - val center = getLorenzVec().add(y = y) - val a = center.add(-inaccuracy, -inaccuracy - 3, -inaccuracy).toBlockPos() - val b = center.add(inaccuracy, inaccuracy + 3, inaccuracy).toBlockPos() - val alignedBB = AxisAlignedBB(a, b) - val clazz = EntityArmorStand::class.java - val found = worldObj.getEntitiesWithinAABB(clazz, alignedBB) - return found.filter { - val result = it.name.contains(contains) - if (debugWrongEntity && !result) { - LorenzUtils.consoleLog("wrong entity in aabb: '" + it.name + "'") - } - if (debugRightEntity && result) { - LorenzUtils.consoleLog("mob: " + center.printWithAccuracy(2)) - LorenzUtils.consoleLog("nametag: " + it.getLorenzVec().printWithAccuracy(2)) - LorenzUtils.consoleLog("accuracy: " + it.getLorenzVec().subtract(center).printWithAccuracy(3)) - } - result - } - } - fun getPlayerEntities(): MutableList<EntityOtherPlayerMP> { val list = mutableListOf<EntityOtherPlayerMP>() for (entity in Minecraft.getMinecraft().theWorld.playerEntities) { @@ -77,17 +50,8 @@ object EntityUtils { fun EntityLivingBase.getAllNameTagsInRadiusWith( contains: String, radius: Double = 3.0, - ): List<EntityArmorStand> { - val center = getLorenzVec().add(y = 3) - val a = center.add(-radius, -radius - 3, -radius).toBlockPos() - val b = center.add(radius, radius + 3, radius).toBlockPos() - val alignedBB = AxisAlignedBB(a, b) - val clazz = EntityArmorStand::class.java - val found = worldObj.getEntitiesWithinAABB(clazz, alignedBB) - return found.filter { - val result = it.name.contains(contains) - result - } + ): List<EntityArmorStand> = getArmorStandsInRadius(getLorenzVec().add(y = 3), radius).filter { + it.name.contains(contains) } fun EntityLivingBase.getNameTagWith( @@ -96,14 +60,17 @@ object EntityUtils { debugRightEntity: Boolean = false, inaccuracy: Double = 1.6, debugWrongEntity: Boolean = false, - ): EntityArmorStand? { + ): EntityArmorStand? = getAllNameTagsWith(y, contains, debugRightEntity, inaccuracy, debugWrongEntity).firstOrNull() + + fun EntityLivingBase.getAllNameTagsWith( + y: Int, + contains: String, + debugRightEntity: Boolean = false, + inaccuracy: Double = 1.6, + debugWrongEntity: Boolean = false, + ): List<EntityArmorStand> { val center = getLorenzVec().add(y = y) - val a = center.add(-inaccuracy, -inaccuracy - 3, -inaccuracy).toBlockPos() - val b = center.add(inaccuracy, inaccuracy + 3, inaccuracy).toBlockPos() - val alignedBB = AxisAlignedBB(a, b) - val clazz = EntityArmorStand::class.java - val found = worldObj.getEntitiesWithinAABB(clazz, alignedBB) - return found.find { + return getArmorStandsInRadius(center, inaccuracy).filter { val result = it.name.contains(contains) if (debugWrongEntity && !result) { LorenzUtils.consoleLog("wrong entity in aabb: '" + it.name + "'") @@ -111,12 +78,21 @@ object EntityUtils { if (debugRightEntity && result) { LorenzUtils.consoleLog("mob: " + center.printWithAccuracy(2)) LorenzUtils.consoleLog("nametag: " + it.getLorenzVec().printWithAccuracy(2)) - LorenzUtils.consoleLog("accuracy: " + it.getLorenzVec().subtract(center).printWithAccuracy(3)) + LorenzUtils.consoleLog("accuracy: " + (it.getLorenzVec() - center).printWithAccuracy(3)) } result } } + private fun getArmorStandsInRadius(center: LorenzVec, radius: Double): List<EntityArmorStand> { + val a = center.add(-radius, -radius - 3, -radius).toBlockPos() + val b = center.add(radius, radius + 3, radius).toBlockPos() + val alignedBB = AxisAlignedBB(a, b) + val clazz = EntityArmorStand::class.java + val worldObj = Minecraft.getMinecraft()?.theWorld ?: return emptyList() + return worldObj.getEntitiesWithinAABB(clazz, alignedBB) + } + fun EntityLivingBase.hasBossHealth(health: Int): Boolean = this.hasMaxHealth(health, true) // TODO remove baseMaxHealth diff --git a/src/main/java/at/hannibal2/skyhanni/utils/HolographicEntities.kt b/src/main/java/at/hannibal2/skyhanni/utils/HolographicEntities.kt index c4de45cbc..602ea0c4d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/HolographicEntities.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/HolographicEntities.kt @@ -167,7 +167,7 @@ object HolographicEntities { GlStateManager.pushMatrix() val viewerPosition = getViewerPos(partialTicks) val mobPosition = holographicEntity.interpolatedPosition(partialTicks) - val renderingOffset = mobPosition.subtract(viewerPosition) + val renderingOffset = mobPosition - viewerPosition renderingOffset.applyTranslationToGL() GlStateManager.disableCull() GlStateManager.enableRescaleNormal() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt index 9f069f19c..ff8fc48be 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LocationUtils.kt @@ -3,7 +3,6 @@ package at.hannibal2.skyhanni.utils import net.minecraft.client.Minecraft import net.minecraft.entity.Entity import net.minecraft.util.AxisAlignedBB -import net.minecraft.util.BlockPos import kotlin.math.max import kotlin.math.min @@ -55,8 +54,8 @@ object LocationUtils { fun AxisAlignedBB.rayIntersects(origin: LorenzVec, direction: LorenzVec): Boolean { // Reference for Algorithm https://tavianator.com/2011/ray_box.html val rayDirectionInverse = direction.inverse() - val t1 = (this.minBox().subtract(origin)).multiply(rayDirectionInverse) - val t2 = (this.maxBox().subtract(origin)).multiply(rayDirectionInverse) + val t1 = (this.minBox() - origin) * rayDirectionInverse + val t2 = (this.maxBox() - origin) * rayDirectionInverse val tmin = max(t1.minOfEachElement(t2).max(), Double.NEGATIVE_INFINITY) val tmax = min(t1.maxOfEachElement(t2).min(), Double.POSITIVE_INFINITY) @@ -84,17 +83,14 @@ object LocationUtils { if (aabb.maxZ > maxZ) maxZ = aabb.maxZ } - val combinedMin = BlockPos(minX, minY, minZ) - val combinedMax = BlockPos(maxX, maxY, maxZ) - return AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ) } - fun AxisAlignedBB.getEdgeLengths() = this.maxBox().subtract(this.minBox()) + fun AxisAlignedBB.getEdgeLengths() = maxBox() - minBox() - fun AxisAlignedBB.getCenter() = this.getEdgeLengths().multiply(0.5).add(this.minBox()) + fun AxisAlignedBB.getCenter() = getEdgeLengths() * 0.5 + minBox() - fun AxisAlignedBB.getTopCenter() = this.getCenter().add(y = (maxY - minY) / 2) + fun AxisAlignedBB.getTopCenter() = getCenter().add(y = (maxY - minY) / 2) fun AxisAlignedBB.clampTo(other: AxisAlignedBB): AxisAlignedBB { val minX = max(this.minX, other.minX) @@ -106,4 +102,3 @@ object LocationUtils { return AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ) } } - diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt index dc143a841..e369a69ca 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzVec.kt @@ -44,15 +44,15 @@ data class LorenzVec( fun distanceChebyshevIgnoreY(other: LorenzVec) = max(abs(this.x - other.x), abs(this.z - other.z)) fun distanceSq(other: LorenzVec): Double { - val dx = (other.x - x) - val dy = (other.y - y) - val dz = (other.z - z) + val dx = other.x - x + val dy = other.y - y + val dz = other.z - z return (dx * dx + dy * dy + dz * dz) } fun distanceSqIgnoreY(other: LorenzVec): Double { - val dx = (other.x - x) - val dz = (other.z - z) + val dx = other.x - x + val dz = other.z - z return (dx * dx + dz * dz) } @@ -75,20 +75,15 @@ data class LorenzVec( override fun toString() = "LorenzVec{x=$x, y=$y, z=$z}" @Deprecated("Use operator fun times instead", ReplaceWith("this * LorenzVec(x, y, z)")) - fun multiply(d: Double): LorenzVec = LorenzVec(x multiplyZeroSave d, y multiplyZeroSave d, z multiplyZeroSave d) + fun multiply(d: Double): LorenzVec = LorenzVec(x * d, y * d, z * d) @Deprecated("Use operator fun times instead", ReplaceWith("this * LorenzVec(x, y, z)")) - fun multiply(d: Int): LorenzVec = - LorenzVec(x multiplyZeroSave d.toDouble(), y multiplyZeroSave d.toDouble(), z multiplyZeroSave d.toDouble()) - - @Deprecated("Use operator fun div instead", ReplaceWith("this / LorenzVec(x, y, z)")) - fun divide(d: Double) = multiply(1.0 / d) + fun multiply(d: Int): LorenzVec = LorenzVec(x * d, y * d, z * d) @Deprecated("Use operator fun times instead", ReplaceWith("this * LorenzVec(x, y, z)")) - fun multiply(v: LorenzVec) = LorenzVec(x multiplyZeroSave v.x, y multiplyZeroSave v.y, z multiplyZeroSave v.z) + fun multiply(v: LorenzVec) = LorenzVec(x * v.x, y * v.y, z * v.z) - fun dotProduct(other: LorenzVec): Double = - (x multiplyZeroSave other.x) + (y multiplyZeroSave other.y) + (z multiplyZeroSave other.z) + fun dotProduct(other: LorenzVec): Double = (x * other.x) + (y * other.y) + (z * other.z) fun angleAsCos(other: LorenzVec) = this.normalize().dotProduct(other.normalize()) @@ -164,12 +159,12 @@ data class LorenzVec( return LorenzVec(x, y, z) } - fun slope(other: LorenzVec, factor: Double) = add(other.subtract(this).scale(factor)) + fun slope(other: LorenzVec, factor: Double) = this + (other - this).scale(factor) fun roundLocation(): LorenzVec { - val x = if (this.x < 0) x.toInt().toDouble() - 1 else x.toInt().toDouble() - val y = y.toInt().toDouble() - 1 - val z = if (this.z < 0) z.toInt().toDouble() - 1 else z.toInt().toDouble() + val x = if (this.x < 0) x.toInt() - 1 else x.toInt() + val y = y.toInt() - 1 + val z = if (this.z < 0) z.toInt() - 1 else z.toInt() return LorenzVec(x, y, z) } @@ -244,11 +239,6 @@ data class LorenzVec( } } -private infix fun Double.multiplyZeroSave(other: Double): Double { - val result = this * other - return if (result == -0.0) 0.0 else result -} - fun BlockPos.toLorenzVec(): LorenzVec = LorenzVec(x, y, z) fun Entity.getLorenzVec(): LorenzVec = LorenzVec(posX, posY, posZ) @@ -267,6 +257,6 @@ fun Array<Double>.toLorenzVec(): LorenzVec { fun RenderUtils.translate(vec: LorenzVec) = GlStateManager.translate(vec.x, vec.y, vec.z) -fun AxisAlignedBB.expand(vec: LorenzVec) = this.expand(vec.x, vec.y, vec.z) +fun AxisAlignedBB.expand(vec: LorenzVec): AxisAlignedBB = this.expand(vec.x, vec.y, vec.z) -fun AxisAlignedBB.expand(amount: Double) = this.expand(amount, amount, amount) +fun AxisAlignedBB.expand(amount: Double): AxisAlignedBB = this.expand(amount, amount, amount) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt index 76b603542..4e2180443 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/MobUtils.kt @@ -66,7 +66,7 @@ object MobUtils { rayTraceForMobs(entity, partialTicks, offset)?.firstOrNull() fun rayTraceForMobs(entity: Entity, partialTicks: Float, offset: LorenzVec = LorenzVec()): List<Mob>? { - val pos = entity.getPositionEyes(partialTicks).toLorenzVec().add(offset) + val pos = entity.getPositionEyes(partialTicks).toLorenzVec() + offset val look = entity.getLook(partialTicks).toLorenzVec().normalize() val possibleEntities = MobData.entityToMob.filterKeys { it !is EntityArmorStand && it.entityBoundingBox.rayIntersects( diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt index 2e4f16ba6..658118bcb 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt @@ -99,7 +99,7 @@ class ParkourHelper( val from = locations[shortCut.from].offsetCenter() val to = locations[shortCut.to].offsetCenter() event.draw3DLine_nea(from, to, Color.RED, 3, false) - val textLocation = from.add(to.subtract(from).normalize()) + val textLocation = from + (to - from).normalize() event.drawDynamicText(textLocation.add(-0.5, 1.0, -0.5), "§cShortcut", 1.8) val aabb = axisAlignedBB(locations[shortCut.to]) @@ -141,10 +141,10 @@ class ParkourHelper( if (LocationUtils.playerLocation().distance(nextPosition) > currentPosition.distance(nextPosition)) return null val factor = LocationUtils.playerLocation().distance(currentPosition) / currentPosition.distance(nextPosition) - val solpeLocation = lookAheadStart.slope(lookAheadEnd, factor) + val slopeLocation = lookAheadStart.slope(lookAheadEnd, factor) return Pair( IndexedValue(current + lookAhead - 1, lookAheadStart), - IndexedValue(current + lookAhead, solpeLocation) + IndexedValue(current + lookAhead, slopeLocation) ) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index fa1b22187..dbbc553e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -195,8 +195,8 @@ object RenderUtils { fun getViewerPos(partialTicks: Float) = exactLocation(Minecraft.getMinecraft().renderViewEntity, partialTicks) - fun AxisAlignedBB.expandBlock(n: Int = 1) = expand(LorenzVec.expandVector.multiply(n)) - fun AxisAlignedBB.inflateBlock(n: Int = 1) = expand(LorenzVec.expandVector.multiply(-n)) + fun AxisAlignedBB.expandBlock(n: Int = 1) = expand(LorenzVec.expandVector * n) + fun AxisAlignedBB.inflateBlock(n: Int = 1) = expand(LorenzVec.expandVector * -n) /** * Taken from NotEnoughUpdates under Creative Commons Attribution-NonCommercial 3.0 @@ -1036,7 +1036,7 @@ object RenderUtils { fun LorenzRenderWorldEvent.exactPlayerEyeLocation(): LorenzVec { val player = Minecraft.getMinecraft().thePlayer val add = if (player.isSneaking) LorenzVec(0.0, 1.54, 0.0) else LorenzVec(0.0, 1.62, 0.0) - return exactLocation(player).add(add) + return exactLocation(player) + add } fun exactLocation(entity: Entity, partialTicks: Float): LorenzVec { @@ -1375,7 +1375,7 @@ object RenderUtils { worldRenderer.pos(sidePoint1).endVertex() worldRenderer.pos(middlePoint).endVertex() worldRenderer.pos(sidePoint2).endVertex() - worldRenderer.pos(sidePoint1.add(sidePoint2).subtract(middlePoint)).endVertex() + worldRenderer.pos(sidePoint1 + sidePoint2 - middlePoint).endVertex() tessellator.draw() } |