Skip to content

Commit

Permalink
Move hook classes out of asm package
Browse files Browse the repository at this point in the history
  • Loading branch information
Meldexun committed Feb 15, 2022
1 parent 00c2e6d commit 2e24bca
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected void registerTransformers() {
new MethodInsnNode(Opcodes.INVOKESTATIC, "meldexun/reachfix/util/ReachFixUtil", "isEnabled", "()Z", false),
new JumpInsnNode(Opcodes.IFEQ, (LabelNode) popNode1),
new VarInsnNode(Opcodes.FLOAD, 1),
new MethodInsnNode(Opcodes.INVOKESTATIC, "meldexun/reachfix/asm/hook/client/EntityRendererHook", "getMouseOver", "(F)V", false),
new MethodInsnNode(Opcodes.INVOKESTATIC, "meldexun/reachfix/hook/client/EntityRendererHook", "getMouseOver", "(F)V", false),
new InsnNode(Opcodes.RETURN),
popNode1
));
Expand All @@ -42,7 +42,7 @@ protected void registerTransformers() {
new JumpInsnNode(Opcodes.IFEQ, (LabelNode) popNode11),
new VarInsnNode(Opcodes.ALOAD, 0),
new VarInsnNode(Opcodes.ALOAD, 3),
new MethodInsnNode(Opcodes.INVOKESTATIC, "meldexun/reachfix/asm/hook/NetHandlerPlayServerHook", "isEntityInRange", "(Lnet/minecraft/network/NetHandlerPlayServer;Lnet/minecraft/entity/Entity;)Z", false),
new MethodInsnNode(Opcodes.INVOKESTATIC, "meldexun/reachfix/hook/NetHandlerPlayServerHook", "isEntityInRange", "(Lnet/minecraft/network/NetHandlerPlayServer;Lnet/minecraft/entity/Entity;)Z", false),
new JumpInsnNode(Opcodes.IFNE, (LabelNode) popNode12),
new InsnNode(Opcodes.RETURN),
popNode11
Expand All @@ -56,22 +56,22 @@ protected void registerTransformers() {

methodNode.instructions.insert(targetNode1, ASMUtil.listOf(
new VarInsnNode(Opcodes.ALOAD, 0),
new MethodInsnNode(Opcodes.INVOKESTATIC, "meldexun/reachfix/asm/hook/NetHandlerPlayServerHook", "getEyeHeightMinusOnePointFive", "(Lnet/minecraft/network/NetHandlerPlayServer;)D", false),
new MethodInsnNode(Opcodes.INVOKESTATIC, "meldexun/reachfix/hook/NetHandlerPlayServerHook", "getEyeHeightMinusOnePointFive", "(Lnet/minecraft/network/NetHandlerPlayServer;)D", false),
new InsnNode(Opcodes.DADD)
));
});
this.registerMethodTransformer("bsc", "a", "(Lams;)V", "net/minecraft/client/network/NetworkPlayerInfo", "setGameType", "(Lnet/minecraft/world/GameType;)V", methodNode -> {
methodNode.instructions.insert(ASMUtil.listOf(
new VarInsnNode(Opcodes.ALOAD, 0),
new VarInsnNode(Opcodes.ALOAD, 1),
new MethodInsnNode(Opcodes.INVOKESTATIC, "meldexun/reachfix/asm/hook/client/NetworkPlayerInfoHook", "onUpdateGameMode", "(Lnet/minecraft/client/network/NetworkPlayerInfo;Lnet/minecraft/world/GameType;)V", false)
new MethodInsnNode(Opcodes.INVOKESTATIC, "meldexun/reachfix/hook/client/NetworkPlayerInfoHook", "onUpdateGameMode", "(Lnet/minecraft/client/network/NetworkPlayerInfo;Lnet/minecraft/world/GameType;)V", false)
));
});
this.registerMethodTransformer("or", "a", "(Lams;)V", "net/minecraft/server/management/PlayerInteractionManager", "setGameType", "(Lnet/minecraft/world/GameType;)V", methodNode -> {
methodNode.instructions.insert(ASMUtil.listOf(
new VarInsnNode(Opcodes.ALOAD, 0),
new VarInsnNode(Opcodes.ALOAD, 1),
new MethodInsnNode(Opcodes.INVOKESTATIC, "meldexun/reachfix/asm/hook/PlayerInteractionManagerHook", "onUpdateGameMode", "(Lnet/minecraft/server/management/PlayerInteractionManager;Lnet/minecraft/world/GameType;)V", false)
new MethodInsnNode(Opcodes.INVOKESTATIC, "meldexun/reachfix/hook/PlayerInteractionManagerHook", "onUpdateGameMode", "(Lnet/minecraft/server/management/PlayerInteractionManager;Lnet/minecraft/world/GameType;)V", false)
));
});
// @formatter:on
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package meldexun.reachfix.asm.hook;
package meldexun.reachfix.hook;

import meldexun.reachfix.util.ReachFixUtil;
import net.minecraft.entity.Entity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package meldexun.reachfix.asm.hook;
package meldexun.reachfix.hook;

import meldexun.reachfix.util.ReachFixUtil;
import net.minecraft.server.management.PlayerInteractionManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package meldexun.reachfix.asm.hook.client;
package meldexun.reachfix.hook.client;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package meldexun.reachfix.asm.hook.client;
package meldexun.reachfix.hook.client;

import meldexun.reachfix.util.ReachFixUtil;
import net.minecraft.client.Minecraft;
Expand Down

0 comments on commit 2e24bca

Please sign in to comment.