Use vanilla sound engine to play render success sound (fixes #286)

This commit is contained in:
Jonas Herzig
2021-02-17 03:39:19 +01:00
parent 5f0218929b
commit 56e5df65d5
6 changed files with 28 additions and 41 deletions

View File

@@ -80,9 +80,16 @@ import org.lwjgl.glfw.GLFW;
//$$ import java.io.IOException;
//#endif
//#if MC>=11400
import net.minecraft.client.sound.PositionedSoundInstance;
//#else
//$$ import net.minecraft.client.audio.PositionedSoundRecord;
//#endif
//#if MC>=10904
import com.replaymod.render.blend.mixin.ParticleAccessor;
import net.minecraft.client.particle.Particle;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.math.Vec3d;
//#endif
@@ -758,6 +765,20 @@ public class MCVer {
}
}
public static void playSound(Identifier sound) {
getMinecraft().getSoundManager().play(
//#if MC>=11400
PositionedSoundInstance.master(new SoundEvent(sound), 1.0F)
//#elseif MC>=10904
//$$ PositionedSoundRecord.getMasterRecord(new SoundEvent(sound), 1.0F)
//#elseif MC>=10800
//$$ PositionedSoundRecord.create(sound, 1.0F)
//#else
//$$ PositionedSoundRecord.createPositionedSoundRecord(sound, 1.0F)
//#endif
);
}
//#if MC>=11400
private static Boolean hasOptifine;
public static boolean hasOptifine() {