mirror of
https://github.com/TeamMidnightDust/VisualOverhaul.git
synced 2025-12-16 22:05:09 +01:00
VisualOverhaul 3.1.0 - 1.17 and small Refactor
Update to 1.17-pre1 and Java 16 Upgrade to MidnightLib, making the config more clean and accessible without modmenu
This commit is contained in:
78
src/main/java/eu/midnightdust/visualoverhaul/mixin/MixinSoundSystem.java
Normal file → Executable file
78
src/main/java/eu/midnightdust/visualoverhaul/mixin/MixinSoundSystem.java
Normal file → Executable file
@@ -1,40 +1,40 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.util.sound.SoundTest;
|
||||
import net.minecraft.client.sound.SoundInstance;
|
||||
import net.minecraft.client.sound.SoundSystem;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
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(SoundSystem.class)
|
||||
public abstract class MixinSoundSystem {
|
||||
|
||||
@Shadow private boolean started;
|
||||
|
||||
private BlockPos jukeboxPos;
|
||||
|
||||
@Inject(at = @At("TAIL"),method = "play(Lnet/minecraft/client/sound/SoundInstance;)V")
|
||||
public void onPlayRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
|
||||
if (soundInstance.getCategory().equals(SoundCategory.RECORDS) && this.started) {
|
||||
jukeboxPos = new BlockPos(soundInstance.getX(),soundInstance.getY(),soundInstance.getZ());
|
||||
SoundTest.soundPos.put(jukeboxPos, soundInstance.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"),method = "stop(Lnet/minecraft/client/sound/SoundInstance;)V")
|
||||
public void onStopRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
|
||||
if (soundInstance != null) {
|
||||
if (soundInstance.getCategory().equals(SoundCategory.RECORDS)) {
|
||||
jukeboxPos = new BlockPos(soundInstance.getX(), soundInstance.getY(), soundInstance.getZ());
|
||||
if (SoundTest.soundPos.containsKey(jukeboxPos)) {
|
||||
SoundTest.soundPos.remove(jukeboxPos, soundInstance.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.util.SoundTest;
|
||||
import net.minecraft.client.sound.SoundInstance;
|
||||
import net.minecraft.client.sound.SoundSystem;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
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(SoundSystem.class)
|
||||
public abstract class MixinSoundSystem {
|
||||
|
||||
@Shadow private boolean started;
|
||||
|
||||
private BlockPos jukeboxPos;
|
||||
|
||||
@Inject(at = @At("TAIL"),method = "play(Lnet/minecraft/client/sound/SoundInstance;)V")
|
||||
public void vo$onPlayRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
|
||||
if (soundInstance.getCategory().equals(SoundCategory.RECORDS) && this.started) {
|
||||
jukeboxPos = new BlockPos(soundInstance.getX(),soundInstance.getY(),soundInstance.getZ());
|
||||
SoundTest.soundPos.put(jukeboxPos, soundInstance.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"),method = "stop(Lnet/minecraft/client/sound/SoundInstance;)V")
|
||||
public void vo$onStopRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
|
||||
if (soundInstance != null) {
|
||||
if (soundInstance.getCategory().equals(SoundCategory.RECORDS)) {
|
||||
jukeboxPos = new BlockPos(soundInstance.getX(), soundInstance.getY(), soundInstance.getZ());
|
||||
if (SoundTest.soundPos.containsKey(jukeboxPos)) {
|
||||
SoundTest.soundPos.remove(jukeboxPos, soundInstance.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user