feat: rebuild JustASplash NeoForge 1.21.1 - hotkey Z splash, config screen, welcome, commands, vorbisspi ogg, jarJar
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package me.sashegdev.justasplash.mixin;
|
||||
|
||||
import com.mojang.blaze3d.audio.Library;
|
||||
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;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@Mixin(Library.class)
|
||||
public class LibraryMixin {
|
||||
@Inject(method = "init", at = @At("TAIL"))
|
||||
private void justasplash$unlimitedChannels(String deviceName, boolean hrtf, CallbackInfo ci) {
|
||||
try {
|
||||
Class<?> poolClass = Class.forName("com.mojang.blaze3d.audio.Library$CountingChannelPool");
|
||||
Constructor<?> ctor = poolClass.getDeclaredConstructor(int.class);
|
||||
ctor.setAccessible(true);
|
||||
Object pool1 = ctor.newInstance(128);
|
||||
Object pool2 = ctor.newInstance(128);
|
||||
Field streaming = Library.class.getDeclaredField("streamingChannels");
|
||||
streaming.setAccessible(true);
|
||||
streaming.set(this, pool1);
|
||||
Field staticCh = Library.class.getDeclaredField("staticChannels");
|
||||
staticCh.setAccessible(true);
|
||||
staticCh.set(this, pool2);
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user