fix an issue with sanity shaders and update version number
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ mod_name=Mind & Motion
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=All Rights Reserved
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.4.4
|
||||
mod_version=1.4.5
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.mojang.logging.LogUtils;
|
||||
import net.fretux.mindmotion.ConfigMM;
|
||||
import net.fretux.mindmotion.client.ClientData;
|
||||
import net.fretux.mindmotion.client.shader.VentShaderHandler;
|
||||
import net.fretux.mindmotion.mixin.PostChainAccessor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.PostChain;
|
||||
import net.minecraft.client.renderer.PostPass;
|
||||
@@ -28,6 +27,7 @@ public class SanityShaderHandler {
|
||||
ResourceLocation.fromNamespaceAndPath("mindmotion", "shaders/post/desaturate.json");
|
||||
|
||||
private static float currentStrength = 0f;
|
||||
private static boolean shaderErrorLogged = false;
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final Field PASSES_FIELD =
|
||||
ObfuscationReflectionHelper.findField(PostChain.class, "f_110009_");
|
||||
@@ -37,11 +37,17 @@ public class SanityShaderHandler {
|
||||
try {
|
||||
return (List<PostPass>) PASSES_FIELD.get(chain);
|
||||
} catch (IllegalAccessException e) {
|
||||
LOGGER.error("Failed to access PostChain.passes", e);
|
||||
logShaderError("Failed to access sanity shader passes", e);
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
|
||||
private static void logShaderError(String message, Throwable error) {
|
||||
if (shaderErrorLogged) return;
|
||||
shaderErrorLogged = true;
|
||||
LOGGER.error(message, error);
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderWorld(RenderLevelStageEvent event) {
|
||||
@@ -85,23 +91,8 @@ public class SanityShaderHandler {
|
||||
if (current == null) {
|
||||
try {
|
||||
mc.gameRenderer.loadEffect(DESAT_EFFECT);
|
||||
PostChain chain = mc.gameRenderer.currentEffect();
|
||||
LOGGER.info("Loaded post chain = {}", chain != null);
|
||||
if (chain != null) {
|
||||
try {
|
||||
for (PostPass pass : safeGetPasses(chain)) {
|
||||
EffectInstance fx = pass.getEffect();
|
||||
LOGGER.info("pass fx={}", fx != null ? fx.getName() : "null");
|
||||
if (fx != null) {
|
||||
LOGGER.info(" Desat uniform={}", fx.getUniform("Desat") != null);
|
||||
}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error("Failed to read PostChain passes via reflection", t);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Failed to read PostChain passes via reflection", e);
|
||||
logShaderError("Failed to load sanity post-processing shader", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -174,7 +165,7 @@ public class SanityShaderHandler {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.info("Error loading post chain{}", e.getMessage());
|
||||
logShaderError("Failed to update sanity shader uniforms", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,20 +94,5 @@ public class SyncStatsS2CPacket {
|
||||
ClientData.MADNESS_DECAY_DELAY_TICKS = msg.madnessDecayDelayTicks;
|
||||
});
|
||||
ctx.get().setPacketHandled(true);
|
||||
|
||||
System.out.println(
|
||||
"[Client] Sanity: " + msg.sanity +
|
||||
", Insanity: " + msg.insanity +
|
||||
", Tempo: " + msg.tempo +
|
||||
", VentCD: " + msg.ventCooldown +
|
||||
", MaxSanity: " + msg.maxSanity +
|
||||
", MaxTempo: " + msg.maxTempo +
|
||||
", SanityEnabled: " + msg.sanityEnabled +
|
||||
", TempoEnabled: " + msg.tempoEnabled +
|
||||
", Madness: " + msg.madness +
|
||||
", MaxMadness: " + msg.maxMadness
|
||||
+ ", MadnessDecayPerTick: " + msg.madnessDecayPerTick +
|
||||
", MadnessDecayDelayTicks: " + msg.madnessDecayDelayTicks
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,8 +84,8 @@ void main() {
|
||||
float warp = intensity * 0.012 + PulseStrength * 0.006;
|
||||
shockUV += fromCenter * warp * dist;
|
||||
|
||||
// Chromatic aberration that ramps up with insanity
|
||||
vec2 chromaOffset = fromCenter * (0.002 + intensity * 0.004);
|
||||
// Chromatic aberration must disappear completely when no insanity effect is active.
|
||||
vec2 chromaOffset = fromCenter * intensity * 0.006;
|
||||
float r = texture(DiffuseSampler, shockUV + chromaOffset).r;
|
||||
float g = texture(DiffuseSampler, shockUV).g;
|
||||
float b = texture(DiffuseSampler, shockUV - chromaOffset).b;
|
||||
@@ -150,7 +150,8 @@ void main() {
|
||||
|
||||
float contrast = 1.0 + intensity * 0.35;
|
||||
col.rgb = (col.rgb - 0.5) * contrast + 0.5;
|
||||
col.rgb = filmicTone(col.rgb, 1.05 + intensity * 0.2);
|
||||
vec3 toneMapped = filmicTone(col.rgb, 1.05 + intensity * 0.2);
|
||||
col.rgb = mix(col.rgb, toneMapped, intensity);
|
||||
col.rgb = clamp(col.rgb, 0.0, 1.0);
|
||||
fragColor = vec4(col.rgb, 1.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user