mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-22 09:39:38 +00:00
DataWatcher
This commit is contained in:
4 files changed
+112
-82
No files matched your search
@@ -14,7 +14,6 @@ import com.falsepattern.endlessids.asm.transformer.VanillaS26PacketMapChunkBulk;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaS24PacketBlockActivation;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaS22PacketMultiBlockChange;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaNetHandlerPlayClient;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaDataWatcher;
|
||||
import java.util.Map;
|
||||
|
||||
public enum ClassEdit
|
||||
@@ -25,7 +24,7 @@ public enum ClassEdit
|
||||
//VanillaAnvilChunkLoader(new VanillaAnvilChunkLoader(), new String[] { "net.minecraft.world.chunk.storage.AnvilChunkLoader" }),
|
||||
//VanillaChunk(new VanillaChunk(), new String[] { "net.minecraft.world.chunk.Chunk" }),
|
||||
//VanillaExtendedBlockStorage(new VanillaExtendedBlockStorage(), new String[] { "net.minecraft.world.chunk.storage.ExtendedBlockStorage" }),
|
||||
VanillaDataWatcher(new VanillaDataWatcher(), new String[] { "net.minecraft.entity.DataWatcher" }),
|
||||
//VanillaDataWatcher(new VanillaDataWatcher(), new String[] { "net.minecraft.entity.DataWatcher" }),
|
||||
VanillaNetHandlerPlayClient(new VanillaNetHandlerPlayClient(), new String[] { "net.minecraft.client.network.NetHandlerPlayClient" }),
|
||||
//VanillaS21PacketChunkData(new VanillaS21PacketChunkData(), new String[] { "net.minecraft.network.play.server.S21PacketChunkData" }),
|
||||
VanillaS22PacketMultiBlockChange(new VanillaS22PacketMultiBlockChange(), new String[] { "net.minecraft.network.play.server.S22PacketMultiBlockChange" }),
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import java.util.ListIterator;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import com.falsepattern.endlessids.IEConfig;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaDataWatcher implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaDataWatcher() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
if (IEConfig.extendDataWatcher) {
|
||||
MethodNode method = AsmUtil.findMethod(cn, Name.dataWatcher_addObject);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 31, 127);
|
||||
method = AsmUtil.findMethod(cn, Name.dataWatcher_writeWatchableObjectToPacketBuffer);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 31, 127);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 255, 1023);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 5, 7);
|
||||
final ListIterator<AbstractInsnNode> it = (ListIterator<AbstractInsnNode>)method.instructions.iterator();
|
||||
while (it.hasNext()) {
|
||||
final AbstractInsnNode insn = (AbstractInsnNode)it.next();
|
||||
if (insn.getOpcode() == 182 && ((MethodInsnNode)insn).name.equals("writeByte")) {
|
||||
it.set((AbstractInsnNode)new MethodInsnNode(182, "net/minecraft/network/PacketBuffer", "writeShort", "(I)Lio/netty/buffer/ByteBuf;", false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
method = AsmUtil.findMethod(cn, Name.dataWatcher_readWatchedListFromPacketBuffer);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 127, 32767);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 224, 896);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 31, 127);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 5, 7);
|
||||
int num = 0;
|
||||
ListIterator<AbstractInsnNode> it2 = (ListIterator<AbstractInsnNode>)method.instructions.iterator();
|
||||
while (it2.hasNext()) {
|
||||
final AbstractInsnNode insn2 = (AbstractInsnNode)it2.next();
|
||||
if (insn2.getOpcode() == 182 && ((MethodInsnNode)insn2).name.equals("readByte")) {
|
||||
if (++num == 2) {
|
||||
continue;
|
||||
}
|
||||
it2.set((AbstractInsnNode)new MethodInsnNode(182, "net/minecraft/network/PacketBuffer", "readShort", "()S", false));
|
||||
if (num == 3) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
method = AsmUtil.findMethod(cn, Name.dataWatcher_writeWatchedListToPacketBuffer);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 127, 32767);
|
||||
it2 = (ListIterator<AbstractInsnNode>)method.instructions.iterator();
|
||||
while (it2.hasNext()) {
|
||||
final AbstractInsnNode insn2 = (AbstractInsnNode)it2.next();
|
||||
if (insn2.getOpcode() == 182 && ((MethodInsnNode)insn2).name.equals("writeByte")) {
|
||||
it2.set((AbstractInsnNode)new MethodInsnNode(182, "net/minecraft/network/PacketBuffer", "writeShort", "(I)Lio/netty/buffer/ByteBuf;", false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
method = AsmUtil.findMethod(cn, Name.dataWatcher_func_151509_a);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 127, 32767);
|
||||
it2 = (ListIterator<AbstractInsnNode>)method.instructions.iterator();
|
||||
while (it2.hasNext()) {
|
||||
final AbstractInsnNode insn2 = (AbstractInsnNode)it2.next();
|
||||
if (insn2.getOpcode() == 182 && ((MethodInsnNode)insn2).name.equals("writeByte")) {
|
||||
it2.set((AbstractInsnNode)new MethodInsnNode(182, "net/minecraft/network/PacketBuffer", "writeShort", "(I)Lio/netty/buffer/ByteBuf;", false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user