aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/mixins/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins/hooks')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt20
2 files changed, 40 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt
new file mode 100644
index 000000000..57305c5bd
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt
@@ -0,0 +1,20 @@
+package at.hannibal2.skyhanni.mixins.hooks
+
+import at.hannibal2.skyhanni.utils.EntityOutlineRenderer
+import at.hannibal2.skyhanni.utils.RenderUtils
+import net.minecraft.client.Minecraft
+import net.minecraft.client.renderer.culling.ICamera
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
+
+class RenderGlobalHook {
+ fun renderEntitiesOutlines(camera: ICamera?, partialTicks: Float): Boolean {
+ val vec = RenderUtils.exactLocation(Minecraft.getMinecraft().renderViewEntity, partialTicks)
+ return EntityOutlineRenderer.renderEntityOutlines(camera!!, partialTicks, vec)
+ }
+
+ fun shouldRenderEntityOutlines(cir: CallbackInfoReturnable<Boolean?>) {
+ if (EntityOutlineRenderer.shouldRenderEntityOutlines()) {
+ cir.returnValue = true
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt
new file mode 100644
index 000000000..c91252c8a
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt
@@ -0,0 +1,20 @@
+package at.hannibal2.skyhanni.mixins.hooks
+
+import at.hannibal2.skyhanni.utils.EntityOutlineRenderer
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraft.entity.EntityLivingBase
+
+class RendererLivingEntityHook {
+ 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)
+ }
+ }
+} \ No newline at end of file