forked from SkyblockerMod/Skyblocker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fab3e8a
commit 7e7020b
Showing
7 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/main/java/de/hysky/skyblocker/injected/CustomGlowInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package de.hysky.skyblocker.injected; | ||
|
||
public interface CustomGlowInfo { | ||
|
||
default boolean atLeastOneMobHasCustomGlow() { | ||
return false; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/de/hysky/skyblocker/mixins/RenderLayerMultiPhaseMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package de.hysky.skyblocker.mixins; | ||
|
||
import org.objectweb.asm.Opcodes; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
|
||
import de.hysky.skyblocker.utils.render.SkyblockerRenderLayers; | ||
import net.minecraft.client.render.RenderLayer; | ||
import net.minecraft.client.render.RenderPhase.DepthTest; | ||
|
||
@Mixin(RenderLayer.MultiPhase.class) | ||
public class RenderLayerMultiPhaseMixin { | ||
|
||
@ModifyExpressionValue(method = "method_34844", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/RenderLayer$MultiPhase;ALWAYS_DEPTH_TEST:Lnet/minecraft/client/render/RenderPhase$DepthTest;", opcode = Opcodes.GETSTATIC)) | ||
private static DepthTest skyblocker$modifyDepthTestForOutlineLayer(DepthTest depthTest) { | ||
return SkyblockerRenderLayers.OUTLINE_ALWAYS; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/de/hysky/skyblocker/mixins/RenderPhaseDepthTestMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package de.hysky.skyblocker.mixins; | ||
|
||
import org.lwjgl.opengl.GL11; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyArg; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import com.mojang.blaze3d.systems.RenderSystem; | ||
|
||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.render.RenderPhase; | ||
import net.minecraft.client.render.WorldRenderer; | ||
|
||
@Mixin(RenderPhase.DepthTest.class) | ||
public class RenderPhaseDepthTestMixin { | ||
|
||
@ModifyArg(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderPhase;<init>(Ljava/lang/String;Ljava/lang/Runnable;Ljava/lang/Runnable;)V"), index = 1) | ||
private static Runnable skyblocker$modifyOutlineAlwaysStartAction(Runnable original, @Local(argsOnly = true) String depthFunctionName) { | ||
if (depthFunctionName.equals("outline_always")) { | ||
return () -> { | ||
WorldRenderer worldRenderer = MinecraftClient.getInstance().worldRenderer; | ||
|
||
if (worldRenderer != null && worldRenderer.atLeastOneMobHasCustomGlow()) { | ||
RenderSystem.enableDepthTest(); | ||
RenderSystem.depthFunc(GL11.GL_LEQUAL); | ||
} | ||
}; | ||
} | ||
|
||
return original; | ||
} | ||
|
||
@ModifyArg(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderPhase;<init>(Ljava/lang/String;Ljava/lang/Runnable;Ljava/lang/Runnable;)V"), index = 2) | ||
private static Runnable skyblocker$modifyOutlineAlwaysEndAction(Runnable original, @Local(argsOnly = true) String depthFunctionName) { | ||
if (depthFunctionName.equals("outline_always")) { | ||
return () -> { | ||
WorldRenderer worldRenderer = MinecraftClient.getInstance().worldRenderer; | ||
|
||
if (worldRenderer != null && worldRenderer.atLeastOneMobHasCustomGlow()) { | ||
RenderSystem.disableDepthTest(); | ||
RenderSystem.depthFunc(GL11.GL_LEQUAL); | ||
} | ||
}; | ||
} | ||
|
||
return original; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters