diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins')
5 files changed, 119 insertions, 119 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 index 92e7a95ab..4ac45b644 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt @@ -1,21 +1,21 @@ -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
- }
- }
-}
+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 + } + } +} 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 8fb195a3b..8b724037a 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt @@ -1,21 +1,21 @@ -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)
- }
- }
-}
+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) + } + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/CustomRenderGlobal.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/CustomRenderGlobal.java index bd440d3ea..50d8ec9be 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/CustomRenderGlobal.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/CustomRenderGlobal.java @@ -1,17 +1,17 @@ -package at.hannibal2.skyhanni.mixins.transformers;
-
-import net.minecraft.client.renderer.RenderGlobal;
-import net.minecraft.client.shader.Framebuffer;
-import net.minecraft.client.shader.ShaderGroup;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.gen.Accessor;
-
-@Mixin(RenderGlobal.class)
-public interface CustomRenderGlobal {
- @Accessor("entityOutlineFramebuffer")
- Framebuffer getEntityOutlineFramebuffer_skyhanni();
-
- @Accessor("entityOutlineShader")
- ShaderGroup getEntityOutlineShader_skyhanni();
-
+package at.hannibal2.skyhanni.mixins.transformers; + +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.client.shader.ShaderGroup; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(RenderGlobal.class) +public interface CustomRenderGlobal { + @Accessor("entityOutlineFramebuffer") + Framebuffer getEntityOutlineFramebuffer_skyhanni(); + + @Accessor("entityOutlineShader") + ShaderGroup getEntityOutlineShader_skyhanni(); + }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderGlobal.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderGlobal.java index a56c42e2e..14c17f995 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderGlobal.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderGlobal.java @@ -1,40 +1,40 @@ -package at.hannibal2.skyhanni.mixins.transformers;
-
-import at.hannibal2.skyhanni.mixins.hooks.RenderGlobalHook;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.client.renderer.RenderGlobal;
-import net.minecraft.client.renderer.culling.ICamera;
-import net.minecraft.entity.Entity;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Shadow;
-import org.spongepowered.asm.mixin.Unique;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.Redirect;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-@Mixin(RenderGlobal.class)
-public abstract class MixinRenderGlobal {
-
- @Shadow
- abstract boolean isRenderEntityOutlines();
-
- @Unique
- private final RenderGlobalHook skyHanni$hook = new RenderGlobalHook();
-
- @Redirect(method = "renderEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderGlobal;isRenderEntityOutlines()Z"))
- public boolean renderEntitiesOutlines(RenderGlobal self, Entity renderViewEntity, ICamera camera, float partialTicks) {
- return skyHanni$hook.renderEntitiesOutlines(camera, partialTicks) && this.isRenderEntityOutlines();
- }
-
- @Inject(method = "isRenderEntityOutlines", at = @At(value = "HEAD"), cancellable = true)
- public void isRenderEntityOutlinesWrapper(CallbackInfoReturnable<Boolean> cir) {
- skyHanni$hook.shouldRenderEntityOutlines(cir);
- }
-
- @Inject(method = "renderEntityOutlineFramebuffer", at = @At(value = "RETURN"))
- public void afterFramebufferDraw(CallbackInfo callbackInfo) {
- GlStateManager.enableDepth();
- }
-}
+package at.hannibal2.skyhanni.mixins.transformers; + +import at.hannibal2.skyhanni.mixins.hooks.RenderGlobalHook; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.culling.ICamera; +import net.minecraft.entity.Entity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(RenderGlobal.class) +public abstract class MixinRenderGlobal { + + @Shadow + abstract boolean isRenderEntityOutlines(); + + @Unique + private final RenderGlobalHook skyHanni$hook = new RenderGlobalHook(); + + @Redirect(method = "renderEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderGlobal;isRenderEntityOutlines()Z")) + public boolean renderEntitiesOutlines(RenderGlobal self, Entity renderViewEntity, ICamera camera, float partialTicks) { + return skyHanni$hook.renderEntitiesOutlines(camera, partialTicks) && this.isRenderEntityOutlines(); + } + + @Inject(method = "isRenderEntityOutlines", at = @At(value = "HEAD"), cancellable = true) + public void isRenderEntityOutlinesWrapper(CallbackInfoReturnable<Boolean> cir) { + skyHanni$hook.shouldRenderEntityOutlines(cir); + } + + @Inject(method = "renderEntityOutlineFramebuffer", at = @At(value = "RETURN")) + public void afterFramebufferDraw(CallbackInfo callbackInfo) { + GlStateManager.enableDepth(); + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRendererLivingEntity.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRendererLivingEntity.java index a83585114..3e09dbd9f 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRendererLivingEntity.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRendererLivingEntity.java @@ -1,21 +1,21 @@ -package at.hannibal2.skyhanni.mixins.transformers;
-
-import at.hannibal2.skyhanni.mixins.hooks.RendererLivingEntityHook;
-import net.minecraft.client.renderer.entity.RendererLivingEntity;
-import net.minecraft.entity.EntityLivingBase;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Unique;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Redirect;
-
-@Mixin(RendererLivingEntity.class)
-public class MixinRendererLivingEntity {
-
- @Unique
- private final RendererLivingEntityHook skyHanni$hook = new RendererLivingEntityHook();
-
- @Redirect(method = "setScoreTeamColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;color(FFFF)V"))
- public void setOutlineColor(float colorRed, float colorGreen, float colorBlue, float colorAlpha, EntityLivingBase entity) {
- skyHanni$hook.setOutlineColor(colorRed, colorGreen, colorBlue, colorAlpha, entity);
- }
-}
+package at.hannibal2.skyhanni.mixins.transformers; + +import at.hannibal2.skyhanni.mixins.hooks.RendererLivingEntityHook; +import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.entity.EntityLivingBase; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(RendererLivingEntity.class) +public class MixinRendererLivingEntity { + + @Unique + private final RendererLivingEntityHook skyHanni$hook = new RendererLivingEntityHook(); + + @Redirect(method = "setScoreTeamColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;color(FFFF)V")) + public void setOutlineColor(float colorRed, float colorGreen, float colorBlue, float colorAlpha, EntityLivingBase entity) { + skyHanni$hook.setOutlineColor(colorRed, colorGreen, colorBlue, colorAlpha, entity); + } +} |