updated patch mappings

This commit is contained in:
noil 2019-11-04 19:06:37 -05:00
parent 586e6ed5c1
commit 2394d544c1
5 changed files with 27 additions and 23 deletions

View File

@ -18,7 +18,7 @@ import static org.objectweb.asm.Opcodes.*;
public final class ChunkPatch extends ClassPatch {
public ChunkPatch() {
super("net.minecraft.world.chunk.Chunk", "axu");
super("net.minecraft.world.chunk.Chunk", "axw");
}
@MethodPatch(
@ -33,7 +33,7 @@ public final class ChunkPatch extends ClassPatch {
insnList.add(new InsnNode(DUP));
insnList.add(new FieldInsnNode(GETSTATIC, "me/rigamortis/seppuku/api/event/world/EventChunk$ChunkType", "UNLOAD", "Lme/rigamortis/seppuku/api/event/world/EventChunk$ChunkType;"));
insnList.add(new VarInsnNode(ALOAD, 0));
insnList.add(new MethodInsnNode(INVOKESPECIAL, Type.getInternalName(EventChunk.class), "<init>", env == PatchManager.Environment.IDE ? "(Lme/rigamortis/seppuku/api/event/world/EventChunk$ChunkType;Lnet/minecraft/world/chunk/Chunk;)V" : "(Lme/rigamortis/seppuku/api/event/world/EventChunk$ChunkType;Laxu;)V", false));
insnList.add(new MethodInsnNode(INVOKESPECIAL, Type.getInternalName(EventChunk.class), "<init>", env == PatchManager.Environment.IDE ? "(Lme/rigamortis/seppuku/api/event/world/EventChunk$ChunkType;Lnet/minecraft/world/chunk/Chunk;)V" : "(Lme/rigamortis/seppuku/api/event/world/EventChunk$ChunkType;Laxw;)V", false));
insnList.add(new VarInsnNode(ASTORE, 7));
insnList.add(new FieldInsnNode(GETSTATIC, Type.getInternalName(Seppuku.class), "INSTANCE", "Lme/rigamortis/seppuku/Seppuku;"));
insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(Seppuku.class), "getEventManager", "()Lteam/stiff/pomelo/EventManager;", false));

View File

@ -16,12 +16,14 @@ import static org.objectweb.asm.Opcodes.*;
public final class GuiBossOverlayPatch extends ClassPatch {
public GuiBossOverlayPatch() {
super("net.minecraft.client.gui.GuiBossOverlay");
super("net.minecraft.client.gui.GuiBossOverlay", "biz");
}
@MethodPatch(
mcpName = "renderBossHealth",
mcpDesc = "()V")
notchName = "a",
mcpDesc = "()V",
notchDesc = "()V")
public void renderBossHealth(MethodNode methodNode, PatchManager.Environment env) {
//create a list of instructions
final InsnList insnList = new InsnList();

View File

@ -17,14 +17,14 @@ import static org.objectweb.asm.Opcodes.*;
public final class GuiScreenPatch extends ClassPatch {
public GuiScreenPatch() {
super("net.minecraft.client.gui.GuiScreen", "bli");
super("net.minecraft.client.gui.GuiScreen", "blk");
}
@MethodPatch(
mcpName = "renderToolTip",
notchName = "a",
mcpDesc = "(Lnet/minecraft/item/ItemStack;II)V",
notchDesc = "(Lain;II)V")
notchDesc = "(Laip;II)V")
public void renderToolTip(MethodNode methodNode, PatchManager.Environment env) {
final InsnList list = new InsnList();
list.add(new TypeInsnNode(NEW, Type.getInternalName(EventRenderTooltip.class)));
@ -32,7 +32,7 @@ public final class GuiScreenPatch extends ClassPatch {
list.add(new VarInsnNode(ALOAD, 1));
list.add(new VarInsnNode(ILOAD, 2));
list.add(new VarInsnNode(ILOAD, 3));
list.add(new MethodInsnNode(INVOKESPECIAL, Type.getInternalName(EventRenderTooltip.class), "<init>", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/item/ItemStack;II)V" : "(Lain;II)V", false));
list.add(new MethodInsnNode(INVOKESPECIAL, Type.getInternalName(EventRenderTooltip.class), "<init>", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/item/ItemStack;II)V" : "(Laip;II)V", false));
list.add(new VarInsnNode(ASTORE, 7));
list.add(new FieldInsnNode(GETSTATIC, Type.getInternalName(Seppuku.class), "INSTANCE", "Lme/rigamortis/seppuku/Seppuku;"));
list.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(Seppuku.class), "getEventManager", "()Lteam/stiff/pomelo/EventManager;", false));

View File

@ -6,12 +6,16 @@ import me.rigamortis.seppuku.api.patch.ClassPatch;
import me.rigamortis.seppuku.api.patch.MethodPatch;
import me.rigamortis.seppuku.api.util.ASMUtil;
import me.rigamortis.seppuku.impl.management.PatchManager;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.client.Minecraft;
import net.minecraft.network.play.server.SPacketChunkData;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.*;
import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.VarInsnNode;
import static org.objectweb.asm.Opcodes.*;
import static org.objectweb.asm.Opcodes.ALOAD;
import static org.objectweb.asm.Opcodes.INVOKESTATIC;
/**
* created by noil on 11/3/19 at 3:45 PM
@ -19,7 +23,7 @@ import static org.objectweb.asm.Opcodes.*;
public final class NetHandlerPlayClientPatch extends ClassPatch {
public NetHandlerPlayClientPatch() {
super("net.minecraft.client.network.NetHandlerPlayClient", "brx");
super("net.minecraft.client.network.NetHandlerPlayClient", "brz");
}
@MethodPatch(
@ -28,19 +32,15 @@ public final class NetHandlerPlayClientPatch extends ClassPatch {
mcpDesc = "(Lnet/minecraft/network/play/server/SPacketChunkData;)V",
notchDesc = "(Lje;)V")
public void handleChunkData(MethodNode methodNode, PatchManager.Environment env) {
final AbstractInsnNode target = ASMUtil.findMethodInsn(methodNode, INVOKEVIRTUAL, Type.getInternalName(WorldClient.class), "markBlockRangeForRenderUpdate", "(IIIIII)V");
if (target != null) {
final InsnList insnList = new InsnList();
insnList.add(new VarInsnNode(ALOAD, 2));
insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "handleChunkDataHook", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/world/chunk/Chunk;)V" : "(Laxu;)V", false));
methodNode.instructions.insert(target, insnList);
}
final InsnList insnList = new InsnList();
insnList.add(new VarInsnNode(ALOAD, 1));
insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "handleChunkDataHook", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/network/play/server/SPacketChunkData;)V" : "(Lje;)V", false));
methodNode.instructions.insertBefore(ASMUtil.bottom(methodNode), insnList);
}
public static void handleChunkDataHook(Chunk chunk) {
if (chunk != null) {
final EventChunk event = new EventChunk(EventChunk.ChunkType.LOAD, chunk);
public static void handleChunkDataHook(SPacketChunkData chunkData) {
if (chunkData != null) {
final EventChunk event = new EventChunk(EventChunk.ChunkType.LOAD, Minecraft.getMinecraft().world.getChunk(chunkData.getChunkX(), chunkData.getChunkZ()));
Seppuku.INSTANCE.getEventManager().dispatchEvent(event);
}
}

View File

@ -25,6 +25,7 @@ public final class RenderManagerPatch extends ClassPatch {
/**
* This is where minecraft handles rendering of entities
*
* @param methodNode
* @param env
*/
@ -89,6 +90,7 @@ public final class RenderManagerPatch extends ClassPatch {
* Our renderEntity hook
* Used to disable rendering of certain entities or modify the
* way they render
*
* @param entity
* @param x
* @param y