blob: bdb103385a6c1330808bfba0eaef1939f0a11a46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package at.hannibal2.skyhanni.mixins.hooks
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.features.misc.ContributorManager
import at.hannibal2.skyhanni.utils.EntityOutlineRenderer
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.player.EntityPlayer
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)
if (color != null) {
val colorRed = (color shr 16 and 255).toFloat() / 255.0f
val colorGreen = (color shr 8 and 255).toFloat() / 255.0f
val colorBlue = (color and 255).toFloat() / 255.0f
GlStateManager.color(colorRed, colorGreen, colorBlue, alpha)
} else {
GlStateManager.color(red, green, blue, alpha)
}
}
/**
* Check if the player is on the cool person list and if they should be flipped.
*/
@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.shouldBeUpsideDown(name)
}
/**
* Check if the player should spin and rotate them if the option is on.
*/
@JvmStatic
fun rotatePlayer(player: EntityPlayer) {
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)
}
}
|