NTM:Space compat rework and update (#1675)

This commit is contained in:
Kotmatross authored and GitHub committed 2026-04-18 09:14:49 -07:00
1 parent 91f2cf9dfb
commit fbd07cc575
10 files changed
+221 -325

No files matched your search

+1 -1
View File
@@ -121,7 +121,7 @@ dependencies {
compileOnly("com.github.GTNewHorizons:NotEnoughIds:2.1.10:dev")
compileOnly(rfg.deobf("maven.modrinth:ntmspace:X5634_H261"))
compileOnly(rfg.deobf("maven.modrinth:ntmspace:X5663_H261"))
compileOnly(rfg.deobf("curse.maven:campfirebackport-387444:4611675"))
compileOnly(rfg.deobf("curse.maven:xaeros-minimap-263420:5060684"))
@@ -45,23 +45,9 @@ public class CompatConfig {
@Config.RequiresMcRestart
public static boolean fixSecurityCraft;
@Config.Comment("Apply tweaks to NTM:Space")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean tweakNTMSpace;
@Config.Comment("Apply fixes to NTM:Space")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixNTMSpace;
@Config.Comment("Disables rendering of the planet below the player at high altitudes [Requires tweakNTMSpace]")
@Config.DefaultEnum("ShadersOnly")
public static altitudePlanetRendererState NTMSpace_disableAltitudePlanetRenderer;
public enum altitudePlanetRendererState {
Always,
ShadersOnly,
Never
}
}
@@ -380,17 +380,16 @@ public enum Mixins implements IMixins {
.addRequiredMod(TargetedMod.MINEFACTORY_RELOADED)
.setApplyIf(() -> CompatConfig.fixMinefactoryReloaded)
.addClientMixins("client.minefactoryreloaded.MixinRedNetCableRenderer")),
NTM_SPACE_TWEAKS(new MixinBuilder("Support for 'Disable Horizon' & 'disableAltitudePlanetRenderer' options in NTM:Space")
.setPhase(Phase.LATE)
.addRequiredMod(TargetedMod.NTM_SPACE)
.setApplyIf(() -> CompatConfig.tweakNTMSpace)
.addClientMixins("client.ntmSpace.MixinSkyProviderCelestial_Tweaks")),
NTM_SPACE_SHADER_COMPAT(new MixinBuilder("Multiple shader fixes for NTM:Space")
NTM_SPACE_COMPAT(new MixinBuilder("Multiple fixes for NTM:Space")
.setPhase(Phase.LATE)
.addRequiredMod(TargetedMod.NTM_SPACE)
.setApplyIf(() -> CompatConfig.fixNTMSpace && AngelicaConfig.enableIris)
.addClientMixins("client.ntmSpace.MixinSkyProviderCelestial_ShaderCompat", "client.ntmSpace.MixinSkyProviderLaytheSunset")),
.addClientMixins(
"client.ntmSpace.MixinSkyProviderCelestial",
"client.ntmSpace.MixinSkyProviderOrbit",
"client.ntmSpace.MixinSkyProviderLaytheSunset"
)),
SPEEDUP_CAMPFIRE_BACKPORT_ANIMATIONS(new MixinBuilder("Add animation speedup support to Campfire Backport")
.setPhase(Phase.LATE)
@@ -0,0 +1,9 @@
package com.gtnewhorizons.angelica.utils;
import net.minecraft.util.ResourceLocation;
public class WorkaroundUtils {
public static ResourceLocation GL_TEXTURE_2D_WORKAROUND = new ResourceLocation("angelica:textures/shaders_workaround.png");
}
+1 -1
View File
@@ -100,7 +100,7 @@ public enum Settings {
ChunkRebuildManager.setMaxTicksWaiting((int) this.option.getStore());
}
},
HORIZON(new NotFineOptionTickBox(true, OptionImpact.LOW)),
HORIZON(new NotFineOptionTickBox(false, OptionImpact.LOW)),
TERRAIN_FOG(new NotFineOptionTickBox(true, OptionImpact.LOW)),
FOG_NEAR_DISTANCE(new NotFineOptionSliderPercentage(75, 1, 100, 1, OptionImpact.LOW)),
GUI_BACKGROUND(new NotFineOptionCycling<>(BackgroundSelect.DEFAULT, null)) {
@@ -0,0 +1,132 @@
package com.gtnewhorizons.angelica.mixins.late.client.ntmSpace;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.utils.WorkaroundUtils;
import com.hbm.dim.CelestialBody;
import com.hbm.dim.SkyProviderCelestial;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalIntRef;
import jss.notfine.core.Settings;
import net.coderbot.iris.Iris;
import net.coderbot.iris.pipeline.WorldRenderingPhase;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
import org.objectweb.asm.Opcodes;
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.Inject;
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
/**
* Ported with additional fixes from the ShaderFixer mod
* @author kotmatross28729
*/
@Mixin(value = SkyProviderCelestial.class, priority = 100)
public class MixinSkyProviderCelestial {
/**
* Avoid program rebinding due to pipeline.setInputs
*/
@WrapWithCondition(method = {
"renderSunset",
"renderCelestials",
"renderAtmosphereGlow",
}, at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V"), remap = false)
private boolean iris$common$redirectTex2D(int cap) {
return this.iris$common$redirectTexture(cap);
}
/**
* Avoid program rebinding due to pipeline.setInputs | Doesn't affect texture disabling before glSkyList
*/
@WrapWithCondition(method = "render",
slice = @Slice(from = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", ordinal = 1)),
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V"), remap = false)
private boolean iris$common$redirectTex2DException(int cap) {
return this.iris$common$redirectTexture(cap);
}
@Unique
private boolean iris$common$redirectTexture(int cap) {
if (cap == GL11.GL_TEXTURE_2D) {
Minecraft.getMinecraft().renderEngine.bindTexture(WorkaroundUtils.GL_TEXTURE_2D_WORKAROUND);
return false;
}
return true;
}
/**
* Force skybox to render with the default program | Fix various issues with shaders enabled
*/
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderHelper;disableStandardItemLighting()V"), remap = false)
public void iris$main$renderInDefaultProgram(CallbackInfo ci, @Share("main$previousProgram") LocalIntRef main$previousProgram) {
main$previousProgram.set(GLStateManager.getActiveProgram());
GLStateManager.glUseProgram(0);
}
@WrapOperation(method = "render",
at = @At(value = "INVOKE", target = "Lcom/hbm/dim/SkyProviderCelestial;renderSun(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;Lcom/hbm/dim/CelestialBody;DDFF)V"), remap = false)
private void iris$main$renderSunInShaderProgram(SkyProviderCelestial instance, float partialTicks, WorldClient world, Minecraft mc, CelestialBody sun, double sunSize, double coronaSize, float visibility, float pressure, Operation<Void> original, @Share("main$previousProgram") LocalIntRef main$previousProgram){
GLStateManager.glUseProgram(main$previousProgram.get());
original.call(instance, partialTicks, world, mc, sun, sunSize, coronaSize, visibility, pressure);
GLStateManager.glUseProgram(0);
}
@Inject(method = "render", at = @At(value = "TAIL"), remap = false)
public void iris$main$restorePreviousProgram(CallbackInfo ci, @Share("main$previousProgram") LocalIntRef main$previousProgram) {
GLStateManager.glUseProgram(main$previousProgram.get());
}
@Inject(method = "renderSun", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;draw()I"),
slice = @Slice(
from = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glColor4f(FFFF)V", ordinal = 0),
to = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glColor4f(FFFF)V", ordinal = 1)
)
)
private void iris$sun$disableBlanking(CallbackInfo ci) {
Tessellator.instance.vertexCount = 0;
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;draw()I"),
slice = @Slice(
from = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glCallList(I)V", ordinal = 1),
to = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glCallList(I)V", ordinal = 2)
)
)
private void iris$main$disableVoid(CallbackInfo ci) {
Tessellator.instance.vertexCount = 0;
}
@WrapWithCondition(method = "render", at = {
@At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glCallList(I)V", ordinal = 1),
@At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glCallList(I)V", ordinal = 2)
}, remap = false)
private boolean angelica$renderHorizon(int i) {
return (boolean) Settings.HORIZON.option.getStore();
}
@Inject(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/Tessellator;instance:Lnet/minecraft/client/renderer/Tessellator;", opcode = Opcodes.GETSTATIC))
private void iris$renderSky$beginNormalSky(CallbackInfo ci) {
Iris.getPipelineManager().getPipeline().ifPresent(p -> p.setPhase(WorldRenderingPhase.SKY));
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glRotatef(FFFF)V", ordinal = 2), remap = false)
private void iris$renderSky$tiltSun(CallbackInfo ci) {
Iris.getPipelineManager().getPipeline().ifPresent(
p -> GLStateManager.glRotatef(p.getSunPathRotation(), 0.0F, 0.0F, 1.0F)
);
}
@Inject(method = "renderSun", at = @At(value = "HEAD"), remap = false)
private void iris$setSunRenderStage(CallbackInfo ci) {
Iris.getPipelineManager().getPipeline().ifPresent(p -> p.setPhase(WorldRenderingPhase.SUN));
}
}
@@ -1,259 +0,0 @@
package com.gtnewhorizons.angelica.mixins.late.client.ntmSpace;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.hbm.dim.SkyProviderCelestial;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.llamalad7.mixinextras.sugar.Local;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalIntRef;
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
import net.coderbot.iris.Iris;
import net.coderbot.iris.pipeline.WorldRenderingPhase;
import net.coderbot.iris.pipeline.WorldRenderingPipeline;
import net.irisshaders.iris.api.v0.IrisApi;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
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.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
/**
* Ported with additional fixes from the ShaderFixer mod
* @author kotmatross28729
*/
@Mixin(value = SkyProviderCelestial.class, priority = 100)
public class MixinSkyProviderCelestial_ShaderCompat {
/// Simple white 2x2 texture
@Unique
private static ResourceLocation GL_TEXTURE_2D_WORKAROUND = new ResourceLocation("angelica:textures/shaders_workaround.png");
// Fixes
/**
* Disables {@link GL11#glDisable(int GL_TEXTURE_2D)} call
* @see #iris$atmosphereBlend$renderInDefaultProgram(CallbackInfo, Minecraft, LocalIntRef)
*/
@WrapWithCondition(method = "renderSunset", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", ordinal = 0), remap = false)
private boolean iris$sunset$revertTextureDisable(int i) {
return false;
}
/**
* Disables {@link GL11#glEnable(int GL_TEXTURE_2D)} call
* @see #iris$atmosphereBlend$renderInDefaultProgram(CallbackInfo, Minecraft, LocalIntRef)
*/
@WrapWithCondition(method = "renderSunset", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V", ordinal = 0), remap = false)
private boolean iris$sunsetBlend$revertTextureEnable(int i) {
return false;
}
/**
* Forces sunset to render with the default program
* <p>
* Fixes sunset not rendering at all with shaders enabled
*/
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/hbm/dim/SkyProviderCelestial;renderSunset(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;FFLnet/minecraft/util/ResourceLocation;)V"), remap = false)
public void iris$sunset$renderInDefaultProgram(CallbackInfo ci, @Local(argsOnly = true) Minecraft mc, @Share("sunset$previousProgram") LocalIntRef sunset$previousProgram) {
sunset$previousProgram.set(GLStateManager.getActiveProgram());
GLStateManager.glUseProgram(0);
mc.getTextureManager().bindTexture(GL_TEXTURE_2D_WORKAROUND);
}
/**
* Sets the program back before {@link #iris$sunset$renderInDefaultProgram(CallbackInfo, Minecraft, LocalIntRef)} call
*/
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/hbm/dim/SkyProviderCelestial;renderSunset(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;FFLnet/minecraft/util/ResourceLocation;)V", shift = At.Shift.AFTER), remap = false)
public void iris$sunset$restorePreviousProgram(CallbackInfo ci, @Share("sunset$previousProgram") LocalIntRef sunset$previousProgram) {
GLStateManager.glUseProgram(sunset$previousProgram.get());
}
/**
* Disables sun blanking with shaders enabled (shaders ignore it anyway)
* <p>
* Fixes the huge white square near the sun with shaders enabled
*/
@Inject(method = "renderSun", at = @At(value="INVOKE", target="Lnet/minecraft/client/renderer/Tessellator;draw()I", ordinal = 1))
private void iris$sun$disableBlanking(CallbackInfo ci) {
if(IrisApi.getInstance().isShaderPackInUse())
Tessellator.instance.vertexCount = 0;
}
/**
* Moves the sun a little closer to the camera
* <p>
* Fixes z-fighting between the sun and the shader skybox
*/
@ModifyArg(method = "renderSun",
slice = @Slice(
from = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V", ordinal = 8),
to = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;draw()I", ordinal = 3)),
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V"),
index = 1)
private double iris$sun$offsetY(double original) {
return original - 0.3D;
}
/**
* In accordance with {@link #iris$sun$offsetY(double)} - moves the flare closer to the camera
*/
@ModifyArg(method = "renderSun",
slice = @Slice(
from = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V", ordinal = 12),
to = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;draw()I", ordinal = 4)),
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;addVertexWithUV(DDDDD)V"),
index = 1)
private double iris$sunFlare$offsetY(double original) {
return original - 0.3D;
}
/**
* Disables {@link GL11#glDisable(int GL_TEXTURE_2D)} call
* @see #iris$atmosphereBlend$renderInDefaultProgram(CallbackInfo, Minecraft, LocalIntRef)
*/
@WrapWithCondition(method = "renderCelestials", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", ordinal = 2), remap = false)
private boolean iris$atmosphereBlend$revertTextureDisable(int i) {
return false;
}
/**
* Disables {@link GL11#glEnable(int GL_TEXTURE_2D)} call
* @see #iris$atmosphereBlend$renderInDefaultProgram(CallbackInfo, Minecraft, LocalIntRef)
*/
@WrapWithCondition(method = "renderCelestials", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V", ordinal = 3), remap = false)
private boolean iris$atmosphereBlend$revertTextureEnable(int i) {
return false;
}
/**
* Forces atmosphere blend to render with the default program
* <p>
* Sometimes shaders have serious visual issues if something is rendered with {@link GL11#glDisable(int GL_TEXTURE_2D)}
* <p>
* Using {@link net.minecraft.client.renderer.texture.TextureManager#bindTexture(ResourceLocation GL_TEXTURE_2D_WORKAROUND)}, we achieve the same effect as {@link GL11#glDisable(int GL_TEXTURE_2D)}, except it works with shaders
*/
@Inject(method = "renderCelestials", at = @At(value="INVOKE", target="Lnet/minecraft/client/renderer/Tessellator;startDrawingQuads()V", ordinal = 10))
private void iris$atmosphereBlend$renderInDefaultProgram(CallbackInfo ci, @Local(argsOnly = true) Minecraft mc, @Share("atmo$previousProgram") LocalIntRef atmo$previousProgram) {
atmo$previousProgram.set(GLStateManager.getActiveProgram());
GLStateManager.glUseProgram(0);
mc.getTextureManager().bindTexture(GL_TEXTURE_2D_WORKAROUND);
}
/**
* Sets the program back before {@link #iris$atmosphereBlend$renderInDefaultProgram(CallbackInfo, Minecraft, LocalIntRef)} call
*/
@Inject(method = "renderCelestials", at = @At(value="INVOKE", target="Lnet/minecraft/client/renderer/Tessellator;draw()I", ordinal = 10, shift = At.Shift.AFTER))
private void iris$atmosphereBlend$restorePreviousProgram(CallbackInfo ci, @Share("atmo$previousProgram") LocalIntRef atmo$previousProgram) {
GLStateManager.glUseProgram(atmo$previousProgram.get());
}
/**
* Forces celestial bodies to render with the default program
* <p>
* Requires `iris$atmosphereBlend$.*`
* <p>
* Fixes many bugs, such as:
* <p>
* - [All Shaders] At certain time, celestial bodies are rendered as a just solid color squares
* <p>
* - [All Shaders] Some celestial bodies appear as heavily (70-90%) translucent
* <p>
* - [Complementary 5.5/6.x] Stars render on top of celestial bodies; not behind them
* <p>
* - [Complementary 5.5.x] Celestial bodies have incorrect colors near the sun
* <p>
* - [Complementary 5.6.x] Celestial bodies don't render at all far from the sun
*/
@Inject(method = "renderCelestials", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;startDrawingQuads()V", ordinal = 5))
private void iris$celestials$renderInDefaultProgram(CallbackInfo ci, @Share("celestials$previousProgram") LocalIntRef celestials$previousProgram) {
celestials$previousProgram.set(GLStateManager.getActiveProgram());
GLStateManager.glUseProgram(0);
}
/**
* Sets the program back before {@link #iris$celestials$renderInDefaultProgram(CallbackInfo, LocalIntRef)} call
*/
@Inject(method = "renderCelestials", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;draw()I", ordinal = 5, shift = At.Shift.AFTER))
private void iris$celestials$restorePreviousProgram(CallbackInfo ci, @Share("celestials$previousProgram") LocalIntRef celestials$previousProgram) {
GLStateManager.glUseProgram(celestials$previousProgram.get());
}
/**
* Forces celestial body ring (back) to render with the default program
* @see #iris$celestials$renderInDefaultProgram(CallbackInfo, LocalIntRef)
*/
@Inject(method = "renderCelestials", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;startDrawingQuads()V", ordinal = 0))
private void iris$ringsBack$renderInDefaultProgram(CallbackInfo ci, @Share("ringsBack$previousProgram") LocalIntRef ringsBack$previousProgram) {
ringsBack$previousProgram.set(GLStateManager.getActiveProgram());
GLStateManager.glUseProgram(0);
}
/**
* Sets the program back before {@link #iris$ringsBack$renderInDefaultProgram(CallbackInfo, LocalIntRef)} call
*/
@Inject(method = "renderCelestials", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;draw()I", ordinal = 0, shift = At.Shift.AFTER))
private void iris$ringsBack$restorePreviousProgram(CallbackInfo ci, @Share("ringsBack$previousProgram") LocalIntRef ringsBack$previousProgram) {
GLStateManager.glUseProgram(ringsBack$previousProgram.get());
}
/**
* Forces celestial body ring (front) to render with the default program
* @see #iris$celestials$renderInDefaultProgram(CallbackInfo, LocalIntRef)
*/
@Inject(method = "renderCelestials", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;startDrawingQuads()V", ordinal = 11))
private void iris$ringsFront$renderInDefaultProgram(CallbackInfo ci, @Share("ringsFront$previousProgram") LocalIntRef ringsFront$previousProgram) {
ringsFront$previousProgram.set(GLStateManager.getActiveProgram());
GLStateManager.glUseProgram(0);
}
/**
* Sets the program back before {@link #iris$ringsFront$renderInDefaultProgram(CallbackInfo, LocalIntRef)} call
*/
@Inject(method = "renderCelestials", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;draw()I", ordinal = 11, shift = At.Shift.AFTER))
private void iris$ringsFront$restorePreviousProgram(CallbackInfo ci, @Share("ringsFront$previousProgram") LocalIntRef ringsFront$previousProgram) {
GLStateManager.glUseProgram(ringsFront$previousProgram.get());
}
// Pipeline setup
@Inject(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/Tessellator;instance:Lnet/minecraft/client/renderer/Tessellator;"))
private void iris$renderSky$beginNormalSky(CallbackInfo ci, @Share("pipeline") LocalRef<WorldRenderingPipeline> pipeline) {
pipeline.set(Iris.getPipelineManager().getPipelineNullable());
if(pipeline.get() != null)
pipeline.get().setPhase(WorldRenderingPhase.SKY);
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/EntityClientPlayerMP;getPosition(F)Lnet/minecraft/util/Vec3;"))
private void iris$setVoidRenderStage(CallbackInfo ci, @Share("pipeline") LocalRef<WorldRenderingPipeline> pipeline) {
if(pipeline.get() != null)
pipeline.get().setPhase(WorldRenderingPhase.VOID);
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glRotatef(FFFF)V", ordinal = 2), remap = false)
private void iris$renderSky$tiltSun(CallbackInfo ci, @Share("pipeline") LocalRef<WorldRenderingPipeline> pipeline) {
if(pipeline.get() != null)
GLStateManager.glRotatef(pipeline.get().getSunPathRotation(), 0.0F, 0.0F, 1.0F);
}
@Inject(method = "renderSun", at = @At(value = "FIELD", target = "Lcom/hbm/dim/CelestialBody;texture:Lnet/minecraft/util/ResourceLocation;"), remap = false)
private void iris$setSunRenderStage(CallbackInfo ci) {
Iris.getPipelineManager().getPipeline().ifPresent(p -> p.setPhase(WorldRenderingPhase.SUN));
}
@Inject(method = "renderSunset", at = @At(value = "INVOKE", target = "Lcom/hbm/dim/SkyProviderCelestial;calcSunriseSunsetColors(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;FF)[F"), remap = false)
private void iris$setSunsetRenderStage(CallbackInfo ci) {
Iris.getPipelineManager().getPipeline().ifPresent(p -> p.setPhase(WorldRenderingPhase.SUNSET));
}
@Inject(method = "renderStars", at = @At(value = "HEAD"), remap = false)
private void iris$setStarRenderStage(CallbackInfo ci, @Share("pipeline") LocalRef<WorldRenderingPipeline> pipeline) {
Iris.getPipelineManager().getPipeline().ifPresent(p -> p.setPhase(WorldRenderingPhase.STARS));
}
}
@@ -1,29 +0,0 @@
package com.gtnewhorizons.angelica.mixins.late.client.ntmSpace;
import com.gtnewhorizons.angelica.config.CompatConfig;
import com.hbm.dim.SkyProviderCelestial;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import jss.notfine.core.Settings;
import net.irisshaders.iris.api.v0.IrisApi;
import net.minecraft.client.renderer.Tessellator;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = SkyProviderCelestial.class, priority = 100)
public class MixinSkyProviderCelestial_Tweaks {
@WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glCallList(I)V", ordinal = 2), remap = false)
private boolean angelica$renderHorizon(int i) {
return (boolean) Settings.HORIZON.option.getStore();
}
@Inject(method = "render", at = @At(value="INVOKE", target="Lnet/minecraft/client/renderer/Tessellator;draw()I", ordinal = 1))
private void angelica$disableAltitudePlanetRenderer(CallbackInfo ci) {
if(CompatConfig.NTMSpace_disableAltitudePlanetRenderer == CompatConfig.altitudePlanetRendererState.Always || (IrisApi.getInstance().isShaderPackInUse() && CompatConfig.NTMSpace_disableAltitudePlanetRenderer == CompatConfig.altitudePlanetRendererState.ShadersOnly)) {
Tessellator.instance.vertexCount = 0;
}
}
}
@@ -1,7 +1,9 @@
package com.gtnewhorizons.angelica.mixins.late.client.ntmSpace;
import com.gtnewhorizons.angelica.utils.WorkaroundUtils;
import com.hbm.dim.laythe.SkyProviderLaytheSunset;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -10,19 +12,15 @@ import org.spongepowered.asm.mixin.injection.At;
public class MixinSkyProviderLaytheSunset {
/**
* Disables {@link GL11#glDisable(int GL_TEXTURE_2D)} call
* Avoid program rebinding due to pipeline.setInputs
*/
@WrapWithCondition(method = "renderSunset", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", ordinal = 0), remap = false)
private boolean iris$sunset$revertTextureDisable(int i) {
return false;
@WrapWithCondition(method = "renderSunset", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V"), remap = false)
private boolean iris$sunset$redirectTex2D(int cap) {
if(cap == GL11.GL_TEXTURE_2D) {
Minecraft.getMinecraft().renderEngine.bindTexture(WorkaroundUtils.GL_TEXTURE_2D_WORKAROUND);
return false;
}
return true;
}
/**
* Disables {@link GL11#glEnable(int GL_TEXTURE_2D)} call
*/
@WrapWithCondition(method = "renderSunset", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V", ordinal = 0), remap = false)
private boolean iris$sunsetBlend$revertTextureEnable(int i) {
return false;
}
}
@@ -0,0 +1,60 @@
package com.gtnewhorizons.angelica.mixins.late.client.ntmSpace;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.utils.WorkaroundUtils;
import com.hbm.dim.CelestialBody;
import com.hbm.dim.orbit.SkyProviderOrbit;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalIntRef;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = SkyProviderOrbit.class, priority = 100)
public class MixinSkyProviderOrbit {
/**
* Avoid program rebinding due to pipeline.setInputs
*/
@WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V"), remap = false)
private boolean iris$common$redirectTex2D(int cap) {
if (cap == GL11.GL_TEXTURE_2D) {
Minecraft.getMinecraft().renderEngine.bindTexture(WorkaroundUtils.GL_TEXTURE_2D_WORKAROUND);
return false;
}
return true;
}
/**
* Force skybox to render with the default program | Fix various issues with shaders enabled
*/
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderHelper;disableStandardItemLighting()V"), remap = false)
public void iris$main$renderInDefaultProgram(CallbackInfo ci, @Share("main$previousProgram") LocalIntRef main$previousProgram) {
main$previousProgram.set(GLStateManager.getActiveProgram());
GLStateManager.glUseProgram(0);
}
@WrapOperation(method = "render",
at = @At(value = "INVOKE", target = "Lcom/hbm/dim/orbit/SkyProviderOrbit;renderSun(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;Lcom/hbm/dim/CelestialBody;DDFF)V"), remap = false)
private void iris$main$renderSunInShaderProgram(SkyProviderOrbit instance, float partialTicks, WorldClient world, Minecraft mc, CelestialBody sun, double sunSize, double coronaSize, float visibility, float pressure, Operation<Void> original, @Share("main$previousProgram") LocalIntRef main$previousProgram){
GLStateManager.glUseProgram(main$previousProgram.get());
original.call(instance, partialTicks, world, mc, sun, sunSize, coronaSize, visibility, pressure);
GLStateManager.glUseProgram(0);
}
/**
* Sets the program back before {@link #iris$main$renderInDefaultProgram(CallbackInfo, LocalIntRef)} call
*/
@Inject(method = "render", at = @At(value = "TAIL"), remap = false)
public void iris$main$restorePreviousProgram(CallbackInfo ci, @Share("main$previousProgram") LocalIntRef main$previousProgram) {
GLStateManager.glUseProgram(main$previousProgram.get());
}
}