Created
July 20, 2013 05:57
-
-
Save Cazzar/6044032 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.cazzar.mods.jukeboxfix.asm; | |
import net.cazzar.corelib.asm.MethodTransformer; | |
import net.cazzar.corelib.lib.LogHelper; | |
import org.objectweb.asm.Opcodes; | |
import org.objectweb.asm.tree.*; | |
/** | |
* @Author: Cayde | |
*/ | |
public class JukeboxTransformer extends MethodTransformer { | |
private final String JUKEBOX_CLASS = "net.minecraft.tileentity.TileEntityRecordPlayer"; | |
public JukeboxTransformer() { | |
logger = new LogHelper("JukeboxFix"); | |
addClass(JUKEBOX_CLASS); | |
addMapping("updateEntity", "func_70316_g"); | |
} | |
@Override | |
public void transform(ClassNode classNode) { | |
InsnList updateEntity = new InsnList(); | |
updateEntity.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/Minecraft", "getMinecraft", "()Lnet/minecraft/client/Minecraft;")); | |
updateEntity.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/Minecraft", "sndManager", "Lnet/minecraft/client/audio/SoundManager;")); | |
updateEntity.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/audio/SoundManager", "sndSystem", "Lpaulscode/sound/SoundSystem;")); | |
updateEntity.add(new LdcInsnNode("streaming")); | |
updateEntity.add(new LdcInsnNode(new Float(0.5))); | |
updateEntity.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/Minecraft", "getMinecraft", "()Lnet/minecraft/client/Minecraft;")); | |
updateEntity.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/Minecraft", "gameSettings", "Lnet/minecraft/client/settings/GameSettings;")); | |
updateEntity.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/settings/GameSettings", "soundVolume", "F")); | |
updateEntity.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "paulscode/sound/SoundSystem", "setVolume", "(Ljava/lang/String;F)V")); | |
replaceMethod(classNode, "updateEntity", "()Z", updateEntity); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment