From 6a8be2c1660815726f8cde11d77e8206ccfccc13 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 3 May 2024 13:04:34 +0200 Subject: Fix upside down mixin and split up spinny from upside down (#1658) --- .../skyhanni/mixins/hooks/RendererLivingEntityHook.kt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/mixins/hooks') diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt index da82902f6..bdb103385 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt @@ -8,9 +8,10 @@ import net.minecraft.client.renderer.GlStateManager import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.player.EntityPlayer -class RendererLivingEntityHook { +object RendererLivingEntityHook { private val config get() = SkyHanniMod.feature.dev + @JvmStatic fun setOutlineColor(red: Float, green: Float, blue: Float, alpha: Float, entity: EntityLivingBase) { val color = EntityOutlineRenderer.getCustomOutlineColor(entity) @@ -27,18 +28,23 @@ class RendererLivingEntityHook { /** * Check if the player is on the cool person list and if they should be flipped. */ - fun isCoolPerson(userName: String?): Boolean { + @JvmStatic + fun shouldBeUpsideDown(userName: String?): Boolean { if (!LorenzUtils.inSkyBlock) return false if (!config.flipContributors && !LorenzUtils.isAprilFoolsDay) return false val name = userName ?: return false - return ContributorManager.canSpin(name) + return ContributorManager.shouldBeUpsideDown(name) } /** - * Player is already on the cool person list so rotate them if the option is on. + * Check if the player should spin and rotate them if the option is on. */ + @JvmStatic fun rotatePlayer(player: EntityPlayer) { - if (!config.rotateContributors) return + if (!LorenzUtils.inSkyBlock) return + if (!config.rotateContributors && !LorenzUtils.isAprilFoolsDay) return + val name = player.name ?: return + if (!ContributorManager.shouldSpin(name)) return val rotation = ((player.ticksExisted % 90) * 4).toFloat() GlStateManager.rotate(rotation, 0f, 1f, 0f) } -- cgit