From 0cecb959a9ac5b261e9f5f9c855e86393843ab0d Mon Sep 17 00:00:00 2001 From: inglettronald Date: Tue, 13 Jun 2023 23:48:36 -0500 Subject: cleaned up interpolation performance --- .../dulkirmod/features/dungeons/ArcherHighlight.kt | 66 ++++++++++------------ 1 file changed, 31 insertions(+), 35 deletions(-) (limited to 'src/main/kotlin/dulkirmod') diff --git a/src/main/kotlin/dulkirmod/features/dungeons/ArcherHighlight.kt b/src/main/kotlin/dulkirmod/features/dungeons/ArcherHighlight.kt index 395d363..68a8659 100644 --- a/src/main/kotlin/dulkirmod/features/dungeons/ArcherHighlight.kt +++ b/src/main/kotlin/dulkirmod/features/dungeons/ArcherHighlight.kt @@ -1,43 +1,39 @@ package dulkirmod.features.dungeons -import com.google.common.eventbus.Subscribe import dulkirmod.DulkirMod.Companion.mc import dulkirmod.config.DulkirConfig import dulkirmod.utils.ScoreBoardUtils import dulkirmod.utils.TabListUtils import dulkirmod.utils.WorldRenderUtils -import ibxm.Player -import net.minecraft.entity.player.EntityPlayer -import net.minecraftforge.client.event.RenderLivingEvent import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.awt.Color object ArcherHighlight { - -// @SubscribeEvent -// fun onRenderLiving(event: RenderLivingEvent.Pre<*>) { -// if (!DulkirConfig.archerBox) return -// if (TabListUtils.area != "Dungeon") return -// if (!ScoreBoardUtils.isInM7 && !DulkirConfig.archerBoxEverywhere) return -// if (event.entity !is EntityPlayer) return -// val name = event.entity.name ?: return -// if (name != TabListUtils.archerName) return -// if (mc.thePlayer.positionVector.yCoord > 45 && !DulkirConfig.archerBoxEverywhere) return -// if (mc.thePlayer.name == name) return -// val (x, y, z) = WorldRenderUtils.fixRenderPos(event.x, event.y, event.z) -// WorldRenderUtils.drawCustomBox( -// x - .5, -// 1.0, -// y, -// 2.0, -// z - .5, -// 1.0, -// DulkirConfig.archBoxColor.toJavaColor(), -// 3f, -// phase = false -// ) -// } + /**The following code is broken but interesting because with SBA it makes RGB PEOPLE + @SubscribeEvent + fun onRenderLiving(event: RenderLivingEvent.Pre<*>) { + if (!DulkirConfig.archerBox) return + if (TabListUtils.area != "Dungeon") return + if (!ScoreBoardUtils.isInM7 && !DulkirConfig.archerBoxEverywhere) return + if (event.entity !is EntityPlayer) return + val name = event.entity.name ?: return + if (name != TabListUtils.archerName) return + if (mc.thePlayer.positionVector.yCoord > 45 && !DulkirConfig.archerBoxEverywhere) return + if (mc.thePlayer.name == name) return + val (x, y, z) = WorldRenderUtils.fixRenderPos(event.x, event.y, event.z) + WorldRenderUtils.drawCustomBox( + x - .5, + 1.0, + y, + 2.0, + z - .5, + 1.0, + DulkirConfig.archBoxColor.toJavaColor(), + 3f, + phase = false + ) + } + */ @SubscribeEvent fun onRenderWorldLast(event: RenderWorldLastEvent) { @@ -47,12 +43,12 @@ object ArcherHighlight { val players = mc.theWorld.playerEntities.filterNotNull() players.forEach { val name = it.name ?: return@forEach - if (name != TabListUtils.archerName) return - if (mc.thePlayer.positionVector.yCoord > 45 && !DulkirConfig.archerBoxEverywhere) return - if (mc.thePlayer.name == name) return - val x = it.posX - ((it.lastTickPosX - it.posX) * event.partialTicks) - val y = it.posY - ((it.lastTickPosY - it.posY) * event.partialTicks) - val z = it.posZ - ((it.lastTickPosZ - it.posZ) * event.partialTicks) + if (name != TabListUtils.archerName) return@forEach + if (mc.thePlayer.positionVector.yCoord > 45 && !DulkirConfig.archerBoxEverywhere) return@forEach + if (mc.thePlayer.name == name) return@forEach + val x = it.lastTickPosX + ((it.posX - it.lastTickPosX) * event.partialTicks) + val y = it.lastTickPosY + ((it.posY - it.lastTickPosY) * event.partialTicks) + val z = it.lastTickPosZ + ((it.posZ - it.lastTickPosZ) * event.partialTicks) WorldRenderUtils.drawCustomBox( x - .5, 1.0, -- cgit