Decompile upstream Explosion Overhaul 0.2.3.0

This commit is contained in:
Gitea Runner
2026-05-04 10:03:58 +00:00
commit a8b3d372d7
212 changed files with 31516 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
/*
* Decompiled with CFR 0.152.
*/
package com.vinlanx.explosionoverhaul.mixin;
import com.mojang.blaze3d.audio.Channel;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(value={Channel.class})
public interface ChannelAccessor {
@Accessor(value="source")
public int explosionoverhaul$getSource();
}

View File

@@ -0,0 +1,58 @@
/*
* Decompiled with CFR 0.152.
*/
package com.vinlanx.explosionoverhaul.mixin;
import com.mojang.blaze3d.audio.Channel;
import com.vinlanx.explosionoverhaul.client.LowPassConcussionEffect;
import com.vinlanx.explosionoverhaul.client.SoundEngineAudioQueue;
import com.vinlanx.explosionoverhaul.client.SoundPhysicsCompatibility;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value={Channel.class})
public class ChannelLowpassMixin {
@Shadow
@Final
private int f_83642_;
@Inject(method={"play"}, at={@At(value="HEAD")})
private void onPlay(CallbackInfo ci) {
try {
boolean active = LowPassConcussionEffect.isActive();
if ("Sound engine".equals(Thread.currentThread().getName())) {
SoundEngineAudioQueue.drainNow();
}
if (active) {
SoundEngineAudioQueue.enqueueAudio(() -> LowPassConcussionEffect.attachFilterToSource(this.f_83642_));
if ("Sound engine".equals(Thread.currentThread().getName())) {
SoundEngineAudioQueue.drainNow();
}
}
}
catch (Throwable throwable) {
// empty catch block
}
}
@Inject(method={"stop"}, at={@At(value="HEAD")})
private void onStop(CallbackInfo ci) {
if (SoundPhysicsCompatibility.isCompatibilityEnabled()) {
SoundPhysicsCompatibility.onSourceStop(this.f_83642_);
}
try {
SoundEngineAudioQueue.enqueueAudio(() -> LowPassConcussionEffect.detachFilterFromSource(this.f_83642_));
if ("Sound engine".equals(Thread.currentThread().getName())) {
SoundEngineAudioQueue.drainNow();
}
}
catch (Throwable throwable) {
// empty catch block
}
}
}

View File

@@ -0,0 +1,92 @@
/*
* Decompiled with CFR 0.152.
*/
package com.vinlanx.explosionoverhaul.mixin;
import com.vinlanx.explosionoverhaul.ServerExplosionHandler;
import com.vinlanx.explosionoverhaul.api.IExplosionPower;
import com.vinlanx.explosionoverhaul.mixinhelper.ExplosionAccessor;
import java.util.List;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.ExplosionDamageCalculator;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
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.callback.CallbackInfo;
@Mixin(value={Explosion.class})
public abstract class ExplosionMixin
implements IExplosionPower,
ExplosionAccessor {
@Shadow
@Final
private Level f_46012_;
@Shadow
@Final
@Nullable
private Entity f_46016_;
@Shadow
@Final
private double f_46013_;
@Shadow
@Final
private double f_46014_;
@Shadow
@Final
private double f_46015_;
@Unique
private float explosionPower;
@Shadow
public abstract List<BlockPos> m_46081_();
@Inject(method={"<init>(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/Entity;DDDFZLnet/minecraft/world/level/Explosion$BlockInteraction;)V"}, at={@At(value="RETURN")})
private void capturePowerSimple(Level level, Entity source, double x, double y, double z, float power, boolean fire, Explosion.BlockInteraction interaction, CallbackInfo ci) {
this.explosionPower = power;
}
@Inject(method={"<init>(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/damagesource/DamageSource;Lnet/minecraft/world/level/ExplosionDamageCalculator;DDDFZLnet/minecraft/world/level/Explosion$BlockInteraction;)V"}, at={@At(value="RETURN")})
private void capturePowerComplex(Level level, @Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator damageCalculator, double x, double y, double z, float power, boolean fire, Explosion.BlockInteraction blockInteraction, CallbackInfo ci) {
this.explosionPower = power;
}
@Override
public float getPower() {
return this.explosionPower;
}
@Override
public void setPower(float power) {
this.explosionPower = power;
}
@Override
public Vec3 explosionoverhaul$getCenter() {
return new Vec3(this.f_46013_, this.f_46014_, this.f_46015_);
}
@Override
public Entity explosionoverhaul$getSource() {
return this.f_46016_;
}
@Inject(method={"finalizeExplosion(Z)V"}, at={@At(value="HEAD")})
private void onFinalizeExplosion(boolean spawnParticles, CallbackInfo ci) {
Level level = this.f_46012_;
if (level instanceof ServerLevel) {
ServerLevel serverLevel = (ServerLevel)level;
ServerExplosionHandler.handleExplosion(serverLevel, (Explosion)this, this.m_46081_());
}
}
}

View File

@@ -0,0 +1,31 @@
/*
* Decompiled with CFR 0.152.
*/
package com.vinlanx.explosionoverhaul.mixin;
import com.mojang.blaze3d.vertex.PoseStack;
import com.vinlanx.explosionoverhaul.client.Blur;
import net.minecraft.client.renderer.GameRenderer;
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={GameRenderer.class})
public class GameRendererBlurMixin {
@Inject(method={"renderLevel"}, at={@At(value="INVOKE", target="Lnet/minecraft/client/renderer/LevelRenderer;renderLevel(Lcom/mojang/blaze3d/vertex/PoseStack;FJZLnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/GameRenderer;Lnet/minecraft/client/renderer/LightTexture;Lorg/joml/Matrix4f;)V", shift=At.Shift.AFTER)})
private void explosionoverhaul$afterWorld(float tickDelta, long nanoTime, PoseStack poseStack, CallbackInfo ci) {
Blur.render(Blur.RenderStage.WORLD);
}
@Inject(method={"renderLevel"}, at={@At(value="INVOKE", target="Lnet/minecraft/client/renderer/GameRenderer;renderItemInHand(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/Camera;F)V", shift=At.Shift.AFTER)})
private void explosionoverhaul$afterHand(float tickDelta, long nanoTime, PoseStack poseStack, CallbackInfo ci) {
Blur.render(Blur.RenderStage.HAND);
}
@Inject(method={"render"}, at={@At(value="TAIL")})
private void explosionoverhaul$afterGui(float tickDelta, long nanoTime, boolean renderLevel, CallbackInfo ci) {
Blur.render(Blur.RenderStage.HUD);
}
}

View File

@@ -0,0 +1,42 @@
/*
* Decompiled with CFR 0.152.
*/
package com.vinlanx.explosionoverhaul.mixin;
import com.vinlanx.explosionoverhaul.client.LowPassConcussionEffect;
import com.vinlanx.explosionoverhaul.client.SoundEngineAudioQueue;
import com.vinlanx.explosionoverhaul.mixin.ChannelAccessor;
import net.minecraft.client.sounds.ChannelAccess;
import net.minecraft.client.sounds.SoundEngine;
import org.spongepowered.asm.mixin.Final;
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.callback.CallbackInfo;
@Mixin(value={SoundEngine.class})
public class SoundEngineAudioQueueMixin {
@Shadow
@Final
private ChannelAccess f_120224_;
@Unique
private boolean explosionoverhaul$wasActive = false;
@Inject(method={"tick(Z)V"}, at={@At(value="HEAD")})
private void explosionoverhaul$drainAudioQueue(boolean paused, CallbackInfo ci) {
boolean active = LowPassConcussionEffect.isActive();
boolean wasActive = this.explosionoverhaul$wasActive;
this.f_120224_.m_120137_(channels -> {
SoundEngineAudioQueue.drainNow();
if (active) {
channels.forEach(channel -> LowPassConcussionEffect.attachFilterToSource(((ChannelAccessor)channel).explosionoverhaul$getSource()));
} else if (wasActive) {
channels.forEach(channel -> LowPassConcussionEffect.detachFilterFromSource(((ChannelAccessor)channel).explosionoverhaul$getSource()));
}
});
this.explosionoverhaul$wasActive = active;
}
}

View File

@@ -0,0 +1,111 @@
/*
* Decompiled with CFR 0.152.
*/
package com.vinlanx.explosionoverhaul.mixin;
import com.sonicether.soundphysics.SoundPhysics;
import com.vinlanx.explosionoverhaul.client.SoundPhysicsCompatibility;
import org.lwjgl.openal.AL10;
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.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value={SoundPhysics.class}, remap=false)
public abstract class SoundPhysicsEnvironmentMixin {
@Inject(method={"setEnvironment"}, at={@At(value="HEAD")})
private static void onSetEnvironment(int sourceID, float sg0, float sg1, float sg2, float sg3, float sc0, float sc1, float sc2, float sc3, float dc, float dg, CallbackInfo ci) {
SoundPhysicsCompatibility.cacheParams(sourceID, sg0, sg1, sg2, sg3, sc0, sc1, sc2, sc3, dc, dg);
}
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=0, argsOnly=true)
private static float modifySendGain0(float value, int sourceID) {
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
return value;
}
return SoundPhysicsCompatibility.combineGain(value);
}
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=1, argsOnly=true)
private static float modifySendGain1(float value, int sourceID) {
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
return value;
}
return SoundPhysicsCompatibility.combineGain(value);
}
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=2, argsOnly=true)
private static float modifySendGain2(float value, int sourceID) {
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
return value;
}
return SoundPhysicsCompatibility.combineGain(value);
}
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=3, argsOnly=true)
private static float modifySendGain3(float value, int sourceID) {
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
return value;
}
return SoundPhysicsCompatibility.combineGain(value);
}
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=4, argsOnly=true)
private static float modifySendCutoff0(float value, int sourceID) {
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
return value;
}
return SoundPhysicsCompatibility.combineHF(value);
}
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=5, argsOnly=true)
private static float modifySendCutoff1(float value, int sourceID) {
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
return value;
}
return SoundPhysicsCompatibility.combineHF(value);
}
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=6, argsOnly=true)
private static float modifySendCutoff2(float value, int sourceID) {
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
return value;
}
return SoundPhysicsCompatibility.combineHF(value);
}
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=7, argsOnly=true)
private static float modifySendCutoff3(float value, int sourceID) {
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
return value;
}
return SoundPhysicsCompatibility.combineHF(value);
}
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=8, argsOnly=true)
private static float modifyDirectCutoff(float value, int sourceID) {
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
return value;
}
return SoundPhysicsCompatibility.combineHF(value);
}
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=9, argsOnly=true)
private static float modifyDirectGain(float value, int sourceID) {
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
return value;
}
return SoundPhysicsCompatibility.combineGain(value);
}
private static boolean isRelative(int sourceID) {
try {
return AL10.alGetSourcei((int)sourceID, (int)514) == 1;
}
catch (Throwable ignored) {
return false;
}
}
}