mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-18 12:39:09 +00:00
MVP
This commit is contained in:
44 files changed
+2295
-1
No files matched your search
@@ -0,0 +1,18 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
public class AsmTransformException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 5128914670008752449L;
|
||||
|
||||
public AsmTransformException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public AsmTransformException(final Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public AsmTransformException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.util.Printer;
|
||||
import org.objectweb.asm.util.TraceMethodVisitor;
|
||||
import org.objectweb.asm.util.Textifier;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import java.util.ListIterator;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.IntInsnNode;
|
||||
import org.objectweb.asm.tree.LdcInsnNode;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
public class AsmUtil
|
||||
{
|
||||
public AsmUtil() {
|
||||
super();
|
||||
}
|
||||
|
||||
public static MethodNode findMethod(final ClassNode cn, final String name) {
|
||||
return findMethod(cn, name, false);
|
||||
}
|
||||
|
||||
public static MethodNode findMethod(final ClassNode cn, final String name, final boolean optional) {
|
||||
for (final MethodNode ret : cn.methods) {
|
||||
if (ret.name.equals(name)) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (optional) {
|
||||
return null;
|
||||
}
|
||||
throw new MethodNotFoundException(name);
|
||||
}
|
||||
|
||||
public static MethodNode findMethod(final ClassNode cn, final Name name) {
|
||||
return findMethod(cn, name, false);
|
||||
}
|
||||
|
||||
public static MethodNode findMethod(final ClassNode cn, final Name name, final boolean optional) {
|
||||
for (final MethodNode ret : cn.methods) {
|
||||
if (name.matches(ret)) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (optional) {
|
||||
return null;
|
||||
}
|
||||
throw new MethodNotFoundException(name.deobf);
|
||||
}
|
||||
|
||||
public static FieldNode findField(final ClassNode cn, final String name) {
|
||||
return findField(cn, name, false);
|
||||
}
|
||||
|
||||
public static FieldNode findField(final ClassNode cn, final String name, final boolean optional) {
|
||||
for (final FieldNode ret : cn.fields) {
|
||||
if (name.equals(ret.name)) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (optional) {
|
||||
return null;
|
||||
}
|
||||
throw new FieldNotFoundException(name);
|
||||
}
|
||||
|
||||
public static FieldNode findField(final ClassNode cn, final Name name) {
|
||||
return findField(cn, name, false);
|
||||
}
|
||||
|
||||
public static FieldNode findField(final ClassNode cn, final Name name, final boolean optional) {
|
||||
for (final FieldNode ret : cn.fields) {
|
||||
if (name.matches(ret)) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (optional) {
|
||||
return null;
|
||||
}
|
||||
throw new FieldNotFoundException(name.deobf);
|
||||
}
|
||||
|
||||
public static void makePublic(final MethodNode x) {
|
||||
x.access = ((x.access & 0xFFFFFFF9) | 0x1);
|
||||
}
|
||||
|
||||
public static void makePublic(final FieldNode x) {
|
||||
x.access = ((x.access & 0xFFFFFFF9) | 0x1);
|
||||
}
|
||||
|
||||
public static boolean transformInlinedSizeMethod(final ClassNode cn, final MethodNode method, final int oldValue, final int newValue) {
|
||||
return transformInlinedSizeMethod(cn, method, oldValue, newValue, false);
|
||||
}
|
||||
|
||||
public static boolean transformInlinedSizeMethod(final ClassNode cn, final MethodNode method, final int oldValue, final int newValue, final boolean optional) {
|
||||
boolean found = false;
|
||||
boolean foundOnce = false;
|
||||
final int i = 0;
|
||||
final ListIterator<AbstractInsnNode> it = (ListIterator<AbstractInsnNode>)method.instructions.iterator();
|
||||
while (it.hasNext()) {
|
||||
final AbstractInsnNode insn = it.next();
|
||||
if (insn.getOpcode() == 3 && oldValue == 0) {
|
||||
found = true;
|
||||
}
|
||||
else if (insn.getOpcode() == 4 && oldValue == 1) {
|
||||
found = true;
|
||||
}
|
||||
else if (insn.getOpcode() == 5 && oldValue == 2) {
|
||||
found = true;
|
||||
}
|
||||
else if (insn.getOpcode() == 6 && oldValue == 3) {
|
||||
found = true;
|
||||
}
|
||||
else if (insn.getOpcode() == 7 && oldValue == 4) {
|
||||
found = true;
|
||||
}
|
||||
else if (insn.getOpcode() == 8 && oldValue == 5) {
|
||||
found = true;
|
||||
}
|
||||
else if (insn.getOpcode() == 18) {
|
||||
final LdcInsnNode node = (LdcInsnNode)insn;
|
||||
if (node.cst instanceof Integer && (int)node.cst == oldValue) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
else if (insn.getOpcode() == 17 || insn.getOpcode() == 16) {
|
||||
final IntInsnNode node2 = (IntInsnNode)insn;
|
||||
if (node2.operand == oldValue) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
foundOnce = true;
|
||||
if (newValue == 0) {
|
||||
it.set(new InsnNode(3));
|
||||
}
|
||||
else if (newValue == 1) {
|
||||
it.set(new InsnNode(4));
|
||||
}
|
||||
else if (newValue == 2) {
|
||||
it.set(new InsnNode(5));
|
||||
}
|
||||
else if (newValue == 3) {
|
||||
it.set(new InsnNode(6));
|
||||
}
|
||||
else if (newValue == 4) {
|
||||
it.set(new InsnNode(7));
|
||||
}
|
||||
else if (newValue == 5) {
|
||||
it.set(new InsnNode(8));
|
||||
}
|
||||
else if (newValue >= -128 && newValue <= 127) {
|
||||
it.set(new IntInsnNode(16, newValue));
|
||||
}
|
||||
else if (newValue >= -32768 && newValue <= 32767) {
|
||||
it.set(new IntInsnNode(17, newValue));
|
||||
}
|
||||
else {
|
||||
it.set(new LdcInsnNode((Object)Integer.valueOf(newValue)));
|
||||
}
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
if (!foundOnce && !optional) {
|
||||
throw new AsmTransformException("can't find constant value " + oldValue + " in method " + method.name);
|
||||
}
|
||||
return foundOnce;
|
||||
}
|
||||
|
||||
public static void dump(final InsnList list) {
|
||||
final Textifier textifier = new Textifier();
|
||||
final TraceMethodVisitor visitor = new TraceMethodVisitor((Printer)textifier);
|
||||
list.accept((MethodVisitor)visitor);
|
||||
final PrintWriter writer = new PrintWriter(System.out);
|
||||
textifier.print(writer);
|
||||
writer.flush();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.falsepattern.endlessids.asm.transformer.WorldEditBaseBlock;
|
||||
import com.falsepattern.endlessids.asm.transformer.MFQM;
|
||||
import com.falsepattern.endlessids.asm.transformer.UndergroundBiomesBiomeUndergroundDecorator;
|
||||
import com.falsepattern.endlessids.asm.transformer.UndergroundBiomesOreUBifier;
|
||||
import com.falsepattern.endlessids.asm.transformer.CofhBlockHelper;
|
||||
import com.falsepattern.endlessids.asm.transformer.FmlRegistry;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaWorld;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaItemInWorldManager;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaPlayerControllerMP;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaRenderGlobal;
|
||||
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.VanillaS21PacketChunkData;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaNetHandlerPlayClient;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaDataWatcher;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaExtendedBlockStorage;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaChunk;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaAnvilChunkLoader;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaStatList;
|
||||
import com.falsepattern.endlessids.asm.transformer.VanillaBlockFire;
|
||||
import com.falsepattern.endlessids.asm.transformer.SelfHooks;
|
||||
import java.util.Map;
|
||||
|
||||
public enum ClassEdit
|
||||
{
|
||||
//SelfHooks(new SelfHooks(), new String[] { "com.falsepattern.endlessids.Hooks" }),
|
||||
VanillaBlockFire(new VanillaBlockFire(), new String[] { "net.minecraft.block.BlockFire" }),
|
||||
VanillaStatList(new VanillaStatList(), new String[] { "net.minecraft.stats.StatList" }),
|
||||
//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" }),
|
||||
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" }),
|
||||
VanillaS24PacketBlockActivation(new VanillaS24PacketBlockActivation(), new String[] { "net.minecraft.network.play.server.S24PacketBlockAction" }),
|
||||
VanillaS26PacketMapChunkBulk(new VanillaS26PacketMapChunkBulk(), new String[] { "net.minecraft.network.play.server.S26PacketMapChunkBulk" }),
|
||||
VanillaRenderGlobal(new VanillaRenderGlobal(), new String[] { "net.minecraft.client.renderer.RenderGlobal" }),
|
||||
VanillaPlayerControllerMP(new VanillaPlayerControllerMP(), new String[] { "net.minecraft.client.multiplayer.PlayerControllerMP" }),
|
||||
VanillaItemInWorldManager(new VanillaItemInWorldManager(), new String[] { "net.minecraft.server.management.ItemInWorldManager" }),
|
||||
//VanillaWorld(new VanillaWorld(), new String[] { "net.minecraft.world.World" }),
|
||||
FmlRegistry(new FmlRegistry(), new String[] { "cpw.mods.fml.common.registry.GameData", "cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry" }),
|
||||
CofhBlockHelper(new CofhBlockHelper(), new String[] { "cofh.lib.util.helpers.BlockHelper" }),
|
||||
UndergroundBiomesOreUBifier(new UndergroundBiomesOreUBifier(), new String[] { "exterminatorJeff.undergroundBiomes.worldGen.OreUBifier" }),
|
||||
UndergroundBiomesBiomeUndergroundDecorator(new UndergroundBiomesBiomeUndergroundDecorator(), new String[] { "exterminatorJeff.undergroundBiomes.worldGen.BiomeUndergroundDecorator" }),
|
||||
MFQM(new MFQM(), new String[] { "MoreFunQuicksandMod.main.MFQM" }),
|
||||
WorldEditBaseBlock(new WorldEditBaseBlock(), new String[] { "com.sk89q.worldedit.blocks.BaseBlock" });
|
||||
|
||||
private static final Map<String, ClassEdit> editMap;
|
||||
private final IClassNodeTransformer transformer;
|
||||
private final String[] classNames;
|
||||
|
||||
ClassEdit(final IClassNodeTransformer transformer, final String[] classNames) {
|
||||
this.transformer = transformer;
|
||||
this.classNames = classNames;
|
||||
}
|
||||
|
||||
public static ClassEdit get(final String className) {
|
||||
return ClassEdit.editMap.get(className);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name();
|
||||
}
|
||||
|
||||
public IClassNodeTransformer getTransformer() {
|
||||
return this.transformer;
|
||||
}
|
||||
|
||||
static {
|
||||
editMap = new HashMap<>();
|
||||
for (final ClassEdit edit : values()) {
|
||||
for (final String name : edit.classNames) {
|
||||
ClassEdit.editMap.put(name, edit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
public class Constants
|
||||
{
|
||||
public static final int maxBlockId = 32767;
|
||||
public static final int blockIdMask = 65535;
|
||||
public static final int ebsIdArrayLength = 4096;
|
||||
public static final int ebsIdArraySize = 8192;
|
||||
public static final int vanillaEbsSize = 12288;
|
||||
public static final int vanillaSize = 196864;
|
||||
public static final int newEbsSize = 14336;
|
||||
public static final int newSize = 229632;
|
||||
public static final int maxDataWatcherId = 127;
|
||||
|
||||
public Constants() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
public class FieldNotFoundException extends AsmTransformException
|
||||
{
|
||||
public FieldNotFoundException(final String field) {
|
||||
super("can't find field " + field);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
public interface IClassNodeTransformer
|
||||
{
|
||||
void transform(final ClassNode p0, final boolean p1);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.objectweb.asm.util.CheckClassAdapter;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
|
||||
public class IETransformer implements IClassTransformer
|
||||
{
|
||||
private static final boolean enablePreVerification = false;
|
||||
private static final boolean enablePostVerification = true;
|
||||
public static final Logger logger;
|
||||
public static boolean isObfuscated;
|
||||
private static Boolean isClient;
|
||||
|
||||
public IETransformer() {
|
||||
super();
|
||||
}
|
||||
|
||||
public byte[] transform(final String name, final String transformedName, final byte[] bytes) {
|
||||
if (bytes == null) {
|
||||
return bytes;
|
||||
}
|
||||
final ClassEdit edit = ClassEdit.get(transformedName);
|
||||
if (edit == null) {
|
||||
return bytes;
|
||||
}
|
||||
IETransformer.logger.debug("Patching {} with {}...", new Object[] { transformedName, edit.getName() });
|
||||
final ClassNode cn = new ClassNode(327680);
|
||||
final ClassReader reader = new ClassReader(bytes);
|
||||
final int readFlags = 0;
|
||||
reader.accept((ClassVisitor)cn, 0);
|
||||
try {
|
||||
edit.getTransformer().transform(cn, IETransformer.isObfuscated);
|
||||
}
|
||||
catch (AsmTransformException t) {
|
||||
IETransformer.logger.error("Error transforming {} with {}: {}", new Object[] { transformedName, edit.getName(), t.getMessage() });
|
||||
throw t;
|
||||
}
|
||||
catch (Throwable t2) {
|
||||
IETransformer.logger.error("Error transforming {} with {}: {}", new Object[] { transformedName, edit.getName(), t2.getMessage() });
|
||||
throw new RuntimeException(t2);
|
||||
}
|
||||
final ClassWriter writer = new ClassWriter(0);
|
||||
try {
|
||||
final ClassVisitor check = (ClassVisitor)new CheckClassAdapter((ClassVisitor)writer);
|
||||
cn.accept(check);
|
||||
}
|
||||
catch (Throwable t3) {
|
||||
IETransformer.logger.error("Error verifying {} transformed with {}: {}", new Object[] { transformedName, edit.getName(), t3.getMessage() });
|
||||
throw new RuntimeException(t3);
|
||||
}
|
||||
IETransformer.logger.debug("Patched {} successfully.", new Object[] { edit.getName() });
|
||||
return writer.toByteArray();
|
||||
}
|
||||
|
||||
public static boolean isClient() {
|
||||
if (IETransformer.isClient == null) {
|
||||
IETransformer.isClient = Boolean.valueOf(IETransformer.class.getResource("/net/minecraft/client/main/Main.class") != null);
|
||||
}
|
||||
return IETransformer.isClient;
|
||||
}
|
||||
|
||||
static {
|
||||
logger = LogManager.getLogger("NEID");
|
||||
IETransformer.isClient = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
public class MethodNotFoundException extends AsmTransformException
|
||||
{
|
||||
public MethodNotFoundException(final String method) {
|
||||
super("can't find method " + method);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package com.falsepattern.endlessids.asm;
|
||||
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
public enum Name
|
||||
{
|
||||
hooks("com/falsepattern/endlessids/Hooks"),
|
||||
hooks_create16BArray(Name.hooks, "create16BArray", null, null, "()[S"),
|
||||
hooks_getBlockData(Name.hooks, "getBlockData", null, null, "(Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;)[B"),
|
||||
hooks_setBlockData(Name.hooks, "setBlockData", null, null, "(Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;[BI)V"),
|
||||
hooks_writeChunkToNbt(Name.hooks, "writeChunkToNbt", null, null, "(Lnet/minecraft/nbt/NBTTagCompound;Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;)V"),
|
||||
hooks_readChunkFromNbt(Name.hooks, "readChunkFromNbt", null, null, "(Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;Lnet/minecraft/nbt/NBTTagCompound;)V"),
|
||||
hooks_getBlockId(Name.hooks, "getBlockId", null, null, "(Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;III)I"),
|
||||
hooks_getBlockById(Name.hooks, "getBlock", null, null, "(Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;III)Lnet/minecraft/block/Block;"),
|
||||
hooks_setBlockId(Name.hooks, "setBlockId", null, null, "(Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;IIII)V"),
|
||||
hooks_getIdFromBlockWithCheck(Name.hooks, "getIdFromBlockWithCheck", null, null, "(Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)I"),
|
||||
acl("net/minecraft/world/chunk/storage/AnvilChunkLoader", "aqk"),
|
||||
block("net/minecraft/block/Block", "aji"),
|
||||
chunk("net/minecraft/world/chunk/Chunk", "apx"),
|
||||
extendedBlockStorage("net/minecraft/world/chunk/storage/ExtendedBlockStorage", "apz"),
|
||||
iChunkProvider("net/minecraft/world/chunk/IChunkProvider", "apu"),
|
||||
nbtTagCompound("net/minecraft/nbt/NBTTagCompound", "dh"),
|
||||
nhpc("net/minecraft/client/network/NetHandlerPlayClient", "bjb"),
|
||||
nibbleArray("net/minecraft/world/chunk/NibbleArray", "apv"),
|
||||
packet("net/minecraft/network/Packet", "ft"),
|
||||
packetBuffer("net/minecraft/network/PacketBuffer", "et"),
|
||||
s22("net/minecraft/network/play/server/S22PacketMultiBlockChange", "gk"),
|
||||
s21("net/minecraft/network/play/server/S21PacketChunkData", "gx"),
|
||||
s21_extracted("net/minecraft/network/play/server/S21PacketChunkData$Extracted", "gy"),
|
||||
world("net/minecraft/world/World", "ahb"),
|
||||
dataWatcher("net/minecraft/entity/DataWatcher", "te"),
|
||||
dataWatcher_watchableObject("net/minecraft/entity/DataWatcher$WatchableObject", "tf"),
|
||||
renderGlobal("net/minecraft/client/renderer/RenderGlobal", "bma"),
|
||||
playerControllerMP("net/minecraft/client/multiplayer/PlayerControllerMP", "bje"),
|
||||
itemInWorldManager("net/minecraft/server/management/ItemInWorldManager", "mx"),
|
||||
entityPlayer("net/minecraft/entity/player/EntityPlayer", "yz"),
|
||||
ebs_getBlock(Name.extendedBlockStorage, "getBlockByExtId", "a", "func_150819_a", "(III)Lnet/minecraft/block/Block;"),
|
||||
ebs_setBlock(Name.extendedBlockStorage, "func_150818_a", "a", null, "(IIILnet/minecraft/block/Block;)V"),
|
||||
ebs_getBlockLSBArray(Name.extendedBlockStorage, "getBlockLSBArray", "g", "func_76658_g", "()[B"),
|
||||
ebs_getBlockMSBArray(Name.extendedBlockStorage, "getBlockMSBArray", "i", "func_76660_i", "()Lnet/minecraft/world/chunk/NibbleArray;"),
|
||||
ebs_setBlockMSBArray(Name.extendedBlockStorage, "setBlockMSBArray", "a", "func_76673_a", "(Lnet/minecraft/world/chunk/NibbleArray;)V"),
|
||||
ebs_isEmpty(Name.extendedBlockStorage, "isEmpty", "a", "func_76663_a", "()Z"),
|
||||
ebs_removeInvalidBlocks(Name.extendedBlockStorage, "removeInvalidBlocks", "e", "func_76672_e", "()V"),
|
||||
dataWatcher_addObject(Name.dataWatcher, "addObject", "a", "func_75682_a", "(ILjava/lang/Object;)V"),
|
||||
dataWatcher_writeWatchableObjectToPacketBuffer(Name.dataWatcher, "writeWatchableObjectToPacketBuffer", "a", "func_151510_a", "(Lnet/minecraft/network/PacketBuffer;Lnet/minecraft/entity/DataWatcher$WatchableObject;)V"),
|
||||
dataWatcher_readWatchedListFromPacketBuffer(Name.dataWatcher, "readWatchedListFromPacketBuffer", "b", "func_151508_b", "(Lnet/minecraft/network/PacketBuffer;)Ljava/util/List;"),
|
||||
dataWatcher_writeWatchedListToPacketBuffer(Name.dataWatcher, "writeWatchedListToPacketBuffer", "a", "func_151507_a", "(Ljava/util/List;Lnet/minecraft/network/PacketBuffer;)V"),
|
||||
dataWatcher_func_151509_a(Name.dataWatcher, "func_151509_a", "a", "func_151509_a", "(Lnet/minecraft/network/PacketBuffer;)V"),
|
||||
ebs_blockRefCount(Name.extendedBlockStorage, "blockRefCount", "b", "field_76682_b", "I"),
|
||||
ebs_tickRefCount(Name.extendedBlockStorage, "tickRefCount", "c", "field_76683_c", "I"),
|
||||
acl_writeChunkToNBT(Name.acl, "writeChunkToNBT", "a", "func_75820_a", "(Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/world/World;Lnet/minecraft/nbt/NBTTagCompound;)V"),
|
||||
acl_readChunkFromNBT(Name.acl, "readChunkFromNBT", "a", "func_75823_a", "(Lnet/minecraft/world/World;Lnet/minecraft/nbt/NBTTagCompound;)Lnet/minecraft/world/chunk/Chunk;"),
|
||||
block_getIdFromBlock(Name.block, "getIdFromBlock", "b", "func_149682_b", "(Lnet/minecraft/block/Block;)I"),
|
||||
chunk_fillChunk(Name.chunk, "fillChunk", "a", "func_76607_a", "([BIIZ)V"),
|
||||
packet_readPacketData(Name.packet, "readPacketData", "a", "func_148837_a", "(Lnet/minecraft/network/PacketBuffer;)V"),
|
||||
packet_writePacketData(Name.packet, "writePacketData", "b", "func_148840_b", "(Lnet/minecraft/network/PacketBuffer;)V"),
|
||||
nhpc_handleMultiBlockChange(Name.nhpc, "handleMultiBlockChange", "a", "func_147287_a", "(Lnet/minecraft/network/play/server/S22PacketMultiBlockChange;)V"),
|
||||
s22_init_server(Name.s22, "<init>", null, null, "(I[SLnet/minecraft/world/chunk/Chunk;)V"),
|
||||
s21_undefined1(Name.s21, "func_149275_c", "c", null, "()I"),
|
||||
s21_undefined2(Name.s21, "func_149269_a", "a", null, "(Lnet/minecraft/world/chunk/Chunk;ZI)Lnet/minecraft/network/play/server/S21PacketChunkData$Extracted;"),
|
||||
renderGlobal_playAuxSFX(Name.renderGlobal, "playAuxSFX", "a", "func_72706_a", "(Lnet/minecraft/entity/player/EntityPlayer;IIIII)V"),
|
||||
playerControllerMP_onPlayerDestroyBlock(Name.playerControllerMP, "onPlayerDestroyBlock", "a", "func_78751_a", "(IIII)Z"),
|
||||
itemInWorldManager_tryHarvestBlock(Name.itemInWorldManager, "tryHarvestBlock", "b", "func_73084_b", "(III)Z"),
|
||||
world_breakBlock(Name.world, "func_147480_a", "a", null, "(IIIZ)Z"),
|
||||
ub_bud("exterminatorJeff/undergroundBiomes/worldGen/BiomeUndergroundDecorator"),
|
||||
ub_bud_replaceChunkOres_world(Name.ub_bud, "replaceChunkOres", null, null, "(IILnet/minecraft/world/World;)V"),
|
||||
ub_bud_replaceChunkOres_iChunkProvider(Name.ub_bud, "replaceChunkOres", null, null, "(Lnet/minecraft/world/chunk/IChunkProvider;II)V"),
|
||||
MFQM("MoreFunQuicksandMod/main/MFQM"),
|
||||
MFQM_preInit(Name.MFQM, "preInit", null, null, "(Lcpw/mods/fml/common/event/FMLPreInitializationEvent;)V");
|
||||
|
||||
public final Name clazz;
|
||||
public final String deobf;
|
||||
public final String obf;
|
||||
public final String srg;
|
||||
public final String desc;
|
||||
public String obfDesc;
|
||||
|
||||
Name(final String deobf) {
|
||||
this(deobf, deobf);
|
||||
}
|
||||
|
||||
Name(final String deobf, final String obf) {
|
||||
this.clazz = null;
|
||||
this.deobf = deobf;
|
||||
this.obf = obf;
|
||||
this.srg = deobf;
|
||||
this.desc = null;
|
||||
}
|
||||
|
||||
Name(final Name clazz, final String deobf, final String obf, final String srg, final String desc) {
|
||||
this.clazz = clazz;
|
||||
this.deobf = deobf;
|
||||
this.obf = ((obf != null) ? obf : deobf);
|
||||
this.srg = ((srg != null) ? srg : deobf);
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public boolean matches(final MethodNode x) {
|
||||
assert this.desc.startsWith("(");
|
||||
return (this.obf.equals(x.name) && this.obfDesc.equals(x.desc)) || (this.srg.equals(x.name) && this.desc.equals(x.desc)) || (this.deobf.equals(x.name) && this.desc.equals(x.desc));
|
||||
}
|
||||
|
||||
public boolean matches(final FieldNode x) {
|
||||
assert !this.desc.startsWith("(");
|
||||
return (this.obf.equals(x.name) && this.obfDesc.equals(x.desc)) || (this.srg.equals(x.name) && this.desc.equals(x.desc)) || (this.deobf.equals(x.name) && this.desc.equals(x.desc));
|
||||
}
|
||||
|
||||
public boolean matches(final MethodInsnNode x, final boolean obfuscated) {
|
||||
assert this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return (this.clazz.obf.equals(x.owner) && this.obf.equals(x.name) && this.obfDesc.equals(x.desc)) || (this.clazz.srg.equals(x.owner) && this.srg.equals(x.name) && this.desc.equals(x.desc));
|
||||
}
|
||||
return this.clazz.deobf.equals(x.owner) && this.deobf.equals(x.name) && this.desc.equals(x.desc);
|
||||
}
|
||||
|
||||
public boolean matches(final FieldInsnNode x, final boolean obfuscated) {
|
||||
assert !this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return (this.clazz.obf.equals(x.owner) && this.obf.equals(x.name) && this.obfDesc.equals(x.desc)) || (this.clazz.srg.equals(x.owner) && this.srg.equals(x.name) && this.desc.equals(x.desc));
|
||||
}
|
||||
return this.clazz.deobf.equals(x.owner) && this.deobf.equals(x.name) && this.desc.equals(x.desc);
|
||||
}
|
||||
|
||||
public MethodInsnNode staticInvocation(final boolean obfuscated) {
|
||||
assert this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return new MethodInsnNode(184, this.clazz.srg, this.srg, this.desc, false);
|
||||
}
|
||||
return new MethodInsnNode(184, this.clazz.deobf, this.deobf, this.desc, false);
|
||||
}
|
||||
|
||||
public MethodInsnNode virtualInvocation(final boolean obfuscated) {
|
||||
assert this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return new MethodInsnNode(182, this.clazz.srg, this.srg, this.desc, false);
|
||||
}
|
||||
return new MethodInsnNode(182, this.clazz.deobf, this.deobf, this.desc, false);
|
||||
}
|
||||
|
||||
public FieldInsnNode staticGet(final boolean obfuscated) {
|
||||
assert !this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return new FieldInsnNode(178, this.clazz.srg, this.srg, this.desc);
|
||||
}
|
||||
return new FieldInsnNode(178, this.clazz.deobf, this.deobf, this.desc);
|
||||
}
|
||||
|
||||
public FieldInsnNode virtualGet(final boolean obfuscated) {
|
||||
assert !this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return new FieldInsnNode(180, this.clazz.srg, this.srg, this.desc);
|
||||
}
|
||||
return new FieldInsnNode(180, this.clazz.deobf, this.deobf, this.desc);
|
||||
}
|
||||
|
||||
public FieldInsnNode staticSet(final boolean obfuscated) {
|
||||
assert !this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return new FieldInsnNode(179, this.clazz.srg, this.srg, this.desc);
|
||||
}
|
||||
return new FieldInsnNode(179, this.clazz.deobf, this.deobf, this.desc);
|
||||
}
|
||||
|
||||
public FieldInsnNode virtualSet(final boolean obfuscated) {
|
||||
assert !this.desc.startsWith("(");
|
||||
if (obfuscated) {
|
||||
return new FieldInsnNode(181, this.clazz.srg, this.srg, this.desc);
|
||||
}
|
||||
return new FieldInsnNode(181, this.clazz.deobf, this.deobf, this.desc);
|
||||
}
|
||||
|
||||
private static void translateDescs() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (final Name name : values()) {
|
||||
if (name.desc != null) {
|
||||
int pos;
|
||||
int endPos;
|
||||
for (pos = 0, endPos = -1; (pos = name.desc.indexOf(76, pos)) != -1; pos = endPos + 1) {
|
||||
sb.append(name.desc, endPos + 1, pos);
|
||||
endPos = name.desc.indexOf(59, pos + 1);
|
||||
String cName = name.desc.substring(pos + 1, endPos);
|
||||
for (final Name name2 : values()) {
|
||||
if (name2.deobf.equals(cName)) {
|
||||
cName = name2.obf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
sb.append('L');
|
||||
sb.append(cName);
|
||||
sb.append(';');
|
||||
}
|
||||
sb.append(name.desc, endPos + 1, name.desc.length());
|
||||
name.obfDesc = sb.toString();
|
||||
sb.setLength(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
translateDescs();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class CofhBlockHelper implements IClassNodeTransformer
|
||||
{
|
||||
public CofhBlockHelper() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, "<clinit>");
|
||||
if (!AsmUtil.transformInlinedSizeMethod(cn, method, 4096, 32768, true)) {
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 1024, 32768);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class FmlRegistry implements IClassNodeTransformer
|
||||
{
|
||||
public FmlRegistry() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final FieldNode field = AsmUtil.findField(cn, "MAX_BLOCK_ID", true);
|
||||
if (field != null) {
|
||||
field.value = Integer.valueOf(32767);
|
||||
}
|
||||
boolean found = false;
|
||||
for (final MethodNode method : cn.methods) {
|
||||
if (AsmUtil.transformInlinedSizeMethod(cn, method, 4095, 32767, true)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
throw new AsmTransformException("can't find 4095 constant in any method");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
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 MFQM implements IClassNodeTransformer
|
||||
{
|
||||
public MFQM() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
if (IEConfig.extendDataWatcher) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, Name.MFQM_preInit);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 31, 127);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class SelfHooks implements IClassNodeTransformer
|
||||
{
|
||||
public SelfHooks() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
MethodNode method = AsmUtil.findMethod(cn, "get");
|
||||
this.transformGet(cn, method);
|
||||
method = AsmUtil.findMethod(cn, "setBlockRefCount");
|
||||
this.transformSetBlockRefCount(cn, method, obfuscated);
|
||||
method = AsmUtil.findMethod(cn, "setTickRefCount");
|
||||
this.transformSetTickRefCount(cn, method, obfuscated);
|
||||
}
|
||||
|
||||
private void transformGet(final ClassNode cn, final MethodNode method) {
|
||||
final InsnList code = method.instructions;
|
||||
code.clear();
|
||||
code.add((AbstractInsnNode)new VarInsnNode(25, 0));
|
||||
code.add((AbstractInsnNode)new FieldInsnNode(180, Type.getArgumentTypes(method.desc)[0].getInternalName(), "block16BArray", "[S"));
|
||||
code.add((AbstractInsnNode)new InsnNode(176));
|
||||
method.localVariables = null;
|
||||
method.maxStack = 1;
|
||||
}
|
||||
|
||||
private void transformSetBlockRefCount(final ClassNode cn, final MethodNode method, final boolean isObf) {
|
||||
final InsnList code = method.instructions;
|
||||
code.clear();
|
||||
code.add((AbstractInsnNode)new VarInsnNode(25, 0));
|
||||
code.add((AbstractInsnNode)new VarInsnNode(21, 1));
|
||||
code.add((AbstractInsnNode)Name.ebs_blockRefCount.virtualSet(isObf));
|
||||
code.add((AbstractInsnNode)new InsnNode(177));
|
||||
method.localVariables = null;
|
||||
method.maxStack = 2;
|
||||
}
|
||||
|
||||
private void transformSetTickRefCount(final ClassNode cn, final MethodNode method, final boolean isObf) {
|
||||
final InsnList code = method.instructions;
|
||||
code.clear();
|
||||
code.add((AbstractInsnNode)new VarInsnNode(25, 0));
|
||||
code.add((AbstractInsnNode)new VarInsnNode(21, 1));
|
||||
code.add((AbstractInsnNode)Name.ebs_tickRefCount.virtualSet(isObf));
|
||||
code.add((AbstractInsnNode)new InsnNode(177));
|
||||
method.localVariables = null;
|
||||
method.maxStack = 2;
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import java.util.ListIterator;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class UndergroundBiomesBiomeUndergroundDecorator implements IClassNodeTransformer
|
||||
{
|
||||
public UndergroundBiomesBiomeUndergroundDecorator() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
MethodNode method = AsmUtil.findMethod(cn, Name.ub_bud_replaceChunkOres_world);
|
||||
this.transformReplaceChunkOres(cn, method, obfuscated, 1);
|
||||
method = AsmUtil.findMethod(cn, Name.ub_bud_replaceChunkOres_iChunkProvider);
|
||||
this.transformReplaceChunkOres(cn, method, obfuscated, 0);
|
||||
}
|
||||
|
||||
private void transformReplaceChunkOres(final ClassNode cn, final MethodNode method, final boolean obfuscated, final int varOffset) {
|
||||
final InsnList code = method.instructions;
|
||||
final ListIterator<AbstractInsnNode> iterator = (ListIterator<AbstractInsnNode>)code.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final AbstractInsnNode insn = (AbstractInsnNode)iterator.next();
|
||||
if (insn.getOpcode() == 182 && Name.ebs_getBlockLSBArray.matches((MethodInsnNode)insn, obfuscated)) {
|
||||
iterator.remove();
|
||||
iterator.add((AbstractInsnNode)new VarInsnNode(21, 9 + varOffset));
|
||||
iterator.add((AbstractInsnNode)new VarInsnNode(21, 18 + varOffset));
|
||||
iterator.add((AbstractInsnNode)new VarInsnNode(21, 10 + varOffset));
|
||||
iterator.add((AbstractInsnNode)Name.hooks_getBlockId.staticInvocation(obfuscated));
|
||||
while (((AbstractInsnNode)iterator.next()).getOpcode() != 54) {
|
||||
iterator.remove();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class UndergroundBiomesOreUBifier implements IClassNodeTransformer
|
||||
{
|
||||
public UndergroundBiomesOreUBifier() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, "renewBlockReplacers");
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 4096, 32768, false);
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import java.util.ListIterator;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||
import org.objectweb.asm.tree.LdcInsnNode;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaAnvilChunkLoader implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaAnvilChunkLoader() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
MethodNode method = AsmUtil.findMethod(cn, Name.acl_writeChunkToNBT);
|
||||
this.transformWriteChunkToNBT(cn, method, obfuscated);
|
||||
method = AsmUtil.findMethod(cn, Name.acl_readChunkFromNBT);
|
||||
this.transformReadChunkFromNBT(cn, method, obfuscated);
|
||||
}
|
||||
|
||||
private void transformWriteChunkToNBT(final ClassNode cn, final MethodNode method, final boolean obfuscated) {
|
||||
final InsnList code = method.instructions;
|
||||
final ListIterator<AbstractInsnNode> iterator = (ListIterator<AbstractInsnNode>)code.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final AbstractInsnNode insn = (AbstractInsnNode)iterator.next();
|
||||
if (insn.getOpcode() == 18 && ((LdcInsnNode)insn).cst.equals("Blocks")) {
|
||||
iterator.remove();
|
||||
iterator.next();
|
||||
iterator.next();
|
||||
iterator.remove();
|
||||
iterator.next();
|
||||
iterator.remove();
|
||||
iterator.add((AbstractInsnNode)Name.hooks_writeChunkToNbt.staticInvocation(obfuscated));
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new AsmTransformException("can't find Blocks LDC");
|
||||
}
|
||||
|
||||
private void transformReadChunkFromNBT(final ClassNode cn, final MethodNode method, final boolean obfuscated) {
|
||||
final InsnList code = method.instructions;
|
||||
int part = 0;
|
||||
final ListIterator<AbstractInsnNode> iterator = (ListIterator<AbstractInsnNode>)code.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final AbstractInsnNode insn = (AbstractInsnNode)iterator.next();
|
||||
if (part == 0) {
|
||||
if (insn.getOpcode() != 18 || !((LdcInsnNode)insn).cst.equals("Blocks")) {
|
||||
continue;
|
||||
}
|
||||
iterator.set((AbstractInsnNode)Name.hooks_readChunkFromNbt.staticInvocation(obfuscated));
|
||||
++part;
|
||||
}
|
||||
else if (part == 1) {
|
||||
iterator.remove();
|
||||
if (insn.getOpcode() != 182) {
|
||||
continue;
|
||||
}
|
||||
final MethodInsnNode node = (MethodInsnNode)insn;
|
||||
if (!Name.ebs_setBlockMSBArray.matches(node, obfuscated)) {
|
||||
continue;
|
||||
}
|
||||
++part;
|
||||
}
|
||||
else {
|
||||
if (insn.getType() == 14) {
|
||||
iterator.remove();
|
||||
++part;
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (part != 3) {
|
||||
throw new AsmTransformException("no match for part " + part);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaBlockFire implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaBlockFire() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
boolean found = false;
|
||||
for (final MethodNode method : cn.methods) {
|
||||
if (AsmUtil.transformInlinedSizeMethod(cn, method, 4096, 32768, true)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
throw new AsmTransformException("can't find 4096 constant in any method");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import java.util.ListIterator;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||
import org.objectweb.asm.tree.JumpInsnNode;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.LdcInsnNode;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
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 org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaChunk implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaChunk() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, Name.chunk_fillChunk, true);
|
||||
if (method == null) {
|
||||
return;
|
||||
}
|
||||
method.localVariables = null;
|
||||
int part = 0;
|
||||
final ListIterator<AbstractInsnNode> it = (ListIterator<AbstractInsnNode>)method.instructions.iterator();
|
||||
while (it.hasNext()) {
|
||||
AbstractInsnNode insn = (AbstractInsnNode)it.next();
|
||||
if (part == 0) {
|
||||
if (insn.getOpcode() != 182 || !Name.ebs_getBlockLSBArray.matches((MethodInsnNode)insn, obfuscated)) {
|
||||
continue;
|
||||
}
|
||||
it.set((AbstractInsnNode)new VarInsnNode(25, 1));
|
||||
it.add((AbstractInsnNode)new VarInsnNode(21, 6));
|
||||
it.add((AbstractInsnNode)Name.hooks_setBlockData.staticInvocation(obfuscated));
|
||||
++part;
|
||||
}
|
||||
else if (part == 1) {
|
||||
if (insn.getOpcode() == 96) {
|
||||
it.set((AbstractInsnNode)new VarInsnNode(21, 6));
|
||||
it.add((AbstractInsnNode)new LdcInsnNode((Object)Integer.valueOf(8192)));
|
||||
it.add((AbstractInsnNode)new InsnNode(96));
|
||||
++part;
|
||||
}
|
||||
else {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (part == 2 && insn.getOpcode() == 182 && Name.ebs_getBlockMSBArray.matches((MethodInsnNode)insn, obfuscated)) {
|
||||
while (((AbstractInsnNode)it.previous()).getOpcode() != 3) {}
|
||||
while (((AbstractInsnNode)it.previous()).getType() != 8) {}
|
||||
do {
|
||||
insn = it.next();
|
||||
} while (insn.getOpcode() != 161 && insn.getOpcode() != 162);
|
||||
it.set((AbstractInsnNode)new JumpInsnNode((insn.getOpcode() == 161) ? 163 : 161, ((JumpInsnNode)insn).label));
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
throw new AsmTransformException("no match for part " + part);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import java.util.ListIterator;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaExtendedBlockStorage implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaExtendedBlockStorage() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
cn.fields.add(new FieldNode(1, "block16BArray", "[S", (String)null, (Object)null));
|
||||
AsmUtil.makePublic(AsmUtil.findField(cn, Name.ebs_blockRefCount));
|
||||
AsmUtil.makePublic(AsmUtil.findField(cn, Name.ebs_tickRefCount));
|
||||
MethodNode method = AsmUtil.findMethod(cn, "<init>");
|
||||
this.transformConstructor(cn, method, obfuscated);
|
||||
method = AsmUtil.findMethod(cn, Name.ebs_getBlock);
|
||||
this.transformGetBlock(cn, method, obfuscated);
|
||||
method = AsmUtil.findMethod(cn, Name.ebs_setBlock);
|
||||
this.transformSetBlock(cn, method, obfuscated);
|
||||
method = AsmUtil.findMethod(cn, Name.ebs_getBlockMSBArray);
|
||||
this.transformGetBlockMSBArray(cn, method);
|
||||
method = AsmUtil.findMethod(cn, Name.ebs_removeInvalidBlocks);
|
||||
this.transformRemoveInvalidBlocks(cn, method);
|
||||
}
|
||||
|
||||
private void transformConstructor(final ClassNode cn, final MethodNode method, final boolean obfuscated) {
|
||||
final InsnList code = method.instructions;
|
||||
final ListIterator<AbstractInsnNode> iterator = (ListIterator<AbstractInsnNode>)code.iterator();
|
||||
if (iterator.hasNext()) {
|
||||
AbstractInsnNode insn = (AbstractInsnNode)iterator.next();
|
||||
insn = insn.getNext().getNext();
|
||||
final InsnList toInsert = new InsnList();
|
||||
toInsert.add((AbstractInsnNode)new VarInsnNode(25, 0));
|
||||
toInsert.add((AbstractInsnNode)Name.hooks_create16BArray.staticInvocation(obfuscated));
|
||||
toInsert.add((AbstractInsnNode)new FieldInsnNode(181, cn.name, "block16BArray", "[S"));
|
||||
method.instructions.insert(insn, toInsert);
|
||||
}
|
||||
method.maxStack = Math.max(method.maxStack, 2);
|
||||
}
|
||||
|
||||
private void transformGetBlock(final ClassNode cn, final MethodNode method, final boolean obfuscated) {
|
||||
final InsnList code = method.instructions;
|
||||
code.clear();
|
||||
code.add((AbstractInsnNode)new VarInsnNode(25, 0));
|
||||
code.add((AbstractInsnNode)new VarInsnNode(21, 1));
|
||||
code.add((AbstractInsnNode)new VarInsnNode(21, 2));
|
||||
code.add((AbstractInsnNode)new VarInsnNode(21, 3));
|
||||
code.add((AbstractInsnNode)Name.hooks_getBlockById.staticInvocation(obfuscated));
|
||||
code.add((AbstractInsnNode)new InsnNode(176));
|
||||
method.localVariables = null;
|
||||
method.maxStack = 4;
|
||||
}
|
||||
|
||||
private void transformSetBlock(final ClassNode cn, final MethodNode method, final boolean obfuscated) {
|
||||
final InsnList code = method.instructions;
|
||||
int part = 0;
|
||||
final ListIterator<AbstractInsnNode> iterator = (ListIterator<AbstractInsnNode>)code.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final AbstractInsnNode insn = (AbstractInsnNode)iterator.next();
|
||||
if (part == 0) {
|
||||
iterator.remove();
|
||||
if (insn.getOpcode() != 184) {
|
||||
continue;
|
||||
}
|
||||
++part;
|
||||
iterator.add((AbstractInsnNode)new VarInsnNode(25, 0));
|
||||
iterator.add((AbstractInsnNode)new VarInsnNode(21, 1));
|
||||
iterator.add((AbstractInsnNode)new VarInsnNode(21, 2));
|
||||
iterator.add((AbstractInsnNode)new VarInsnNode(21, 3));
|
||||
iterator.add((AbstractInsnNode)Name.ebs_getBlock.virtualInvocation(obfuscated));
|
||||
}
|
||||
else if (part == 1) {
|
||||
if (insn.getOpcode() != 184) {
|
||||
continue;
|
||||
}
|
||||
iterator.set((AbstractInsnNode)new VarInsnNode(25, 6));
|
||||
iterator.add((AbstractInsnNode)Name.hooks_getIdFromBlockWithCheck.staticInvocation(obfuscated));
|
||||
++part;
|
||||
}
|
||||
else {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
if (part != 2) {
|
||||
throw new AsmTransformException("no match for part " + part);
|
||||
}
|
||||
code.add((AbstractInsnNode)new VarInsnNode(54, 5));
|
||||
code.add((AbstractInsnNode)new VarInsnNode(25, 0));
|
||||
code.add((AbstractInsnNode)new VarInsnNode(21, 1));
|
||||
code.add((AbstractInsnNode)new VarInsnNode(21, 2));
|
||||
code.add((AbstractInsnNode)new VarInsnNode(21, 3));
|
||||
code.add((AbstractInsnNode)new VarInsnNode(21, 5));
|
||||
code.add((AbstractInsnNode)Name.hooks_setBlockId.staticInvocation(obfuscated));
|
||||
code.add((AbstractInsnNode)new InsnNode(177));
|
||||
method.localVariables = null;
|
||||
--method.maxLocals;
|
||||
method.maxStack = Math.max(method.maxStack, 5);
|
||||
}
|
||||
|
||||
private void transformGetBlockMSBArray(final ClassNode cn, final MethodNode method) {
|
||||
final InsnList code = method.instructions;
|
||||
code.clear();
|
||||
code.add((AbstractInsnNode)new InsnNode(1));
|
||||
code.add((AbstractInsnNode)new InsnNode(176));
|
||||
method.localVariables = null;
|
||||
method.maxStack = 1;
|
||||
}
|
||||
|
||||
private void transformRemoveInvalidBlocks(final ClassNode cn, final MethodNode method) {
|
||||
final InsnList code = method.instructions;
|
||||
code.clear();
|
||||
code.add((AbstractInsnNode)new VarInsnNode(25, 0));
|
||||
code.add((AbstractInsnNode)new MethodInsnNode(184, "com/falsepattern/endlessids/Hooks", "removeInvalidBlocksHook", "(L" + cn.name + ";)V", false));
|
||||
code.add((AbstractInsnNode)new InsnNode(177));
|
||||
method.localVariables = null;
|
||||
method.maxStack = 1;
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaItemInWorldManager implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaItemInWorldManager() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, Name.itemInWorldManager_tryHarvestBlock);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 12, 16);
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import java.util.ListIterator;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||
import org.objectweb.asm.tree.IntInsnNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaNetHandlerPlayClient implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaNetHandlerPlayClient() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, Name.nhpc_handleMultiBlockChange);
|
||||
final InsnList code = method.instructions;
|
||||
int part = 0;
|
||||
final ListIterator<AbstractInsnNode> iterator = (ListIterator<AbstractInsnNode>)code.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
AbstractInsnNode insn = (AbstractInsnNode)iterator.next();
|
||||
if (part == 0) {
|
||||
if (insn.getOpcode() != 25 || ((VarInsnNode)insn).var != 4) {
|
||||
continue;
|
||||
}
|
||||
++part;
|
||||
}
|
||||
else if (part == 1) {
|
||||
if (insn.getOpcode() != 25 || ((VarInsnNode)insn).var != 4) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
insn = iterator.next();
|
||||
iterator.set((AbstractInsnNode)new InsnNode(3));
|
||||
++part;
|
||||
}
|
||||
else if (part == 2) {
|
||||
if (insn.getOpcode() != 21 || ((VarInsnNode)insn).var != 7) {
|
||||
continue;
|
||||
}
|
||||
iterator.set((AbstractInsnNode)new VarInsnNode(25, 4));
|
||||
iterator.add((AbstractInsnNode)new MethodInsnNode(182, "java/io/DataInputStream", "readShort", "()S", false));
|
||||
++part;
|
||||
}
|
||||
else if (part == 3) {
|
||||
if (insn.getOpcode() == 54) {
|
||||
++part;
|
||||
}
|
||||
else {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
else if (part == 4) {
|
||||
if (insn.getOpcode() != 21 || ((VarInsnNode)insn).var != 7) {
|
||||
continue;
|
||||
}
|
||||
iterator.set((AbstractInsnNode)new VarInsnNode(25, 4));
|
||||
iterator.add((AbstractInsnNode)new MethodInsnNode(182, "java/io/DataInputStream", "readByte", "()B", false));
|
||||
iterator.add((AbstractInsnNode)new IntInsnNode(16, 15));
|
||||
iterator.add((AbstractInsnNode)new InsnNode(126));
|
||||
++part;
|
||||
}
|
||||
else {
|
||||
if (part != 5) {
|
||||
continue;
|
||||
}
|
||||
if (insn.getOpcode() == 54) {
|
||||
return;
|
||||
}
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
throw new AsmTransformException("no match for part " + part);
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaPlayerControllerMP implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaPlayerControllerMP() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, Name.playerControllerMP_onPlayerDestroyBlock);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 12, 16);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaRenderGlobal implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaRenderGlobal() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, Name.renderGlobal_playAuxSFX);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 4095, 65535);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 12, 16);
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import java.util.ListIterator;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaS21PacketChunkData implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaS21PacketChunkData() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
MethodNode method = AsmUtil.findMethod(cn, "<clinit>");
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 196864, 229632, false);
|
||||
method = AsmUtil.findMethod(cn, Name.s21_undefined1);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 196864, 229632, false);
|
||||
method = AsmUtil.findMethod(cn, Name.packet_readPacketData);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 12288, 14336, false);
|
||||
method = AsmUtil.findMethod(cn, Name.s21_undefined2);
|
||||
this.transformCreateData(cn, method, obfuscated);
|
||||
}
|
||||
|
||||
private void transformCreateData(final ClassNode cn, final MethodNode method, final boolean obfuscated) {
|
||||
final InsnList code = method.instructions;
|
||||
final ListIterator<AbstractInsnNode> iterator = (ListIterator<AbstractInsnNode>)code.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final AbstractInsnNode insn = (AbstractInsnNode)iterator.next();
|
||||
if (insn.getOpcode() == 182) {
|
||||
final MethodInsnNode node = (MethodInsnNode)insn;
|
||||
if (Name.ebs_getBlockLSBArray.matches(node, obfuscated)) {
|
||||
iterator.set((AbstractInsnNode)Name.hooks_getBlockData.staticInvocation(obfuscated));
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
throw new AsmTransformException("can't find getBlockLSBArray INVOKEVIRTUAL");
|
||||
}
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import java.util.ListIterator;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaS22PacketMultiBlockChange implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaS22PacketMultiBlockChange() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, Name.s22_init_server);
|
||||
final InsnList code = method.instructions;
|
||||
int part = 0;
|
||||
final ListIterator<AbstractInsnNode> iterator = (ListIterator<AbstractInsnNode>)code.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final AbstractInsnNode insn = (AbstractInsnNode)iterator.next();
|
||||
if (part == 0) {
|
||||
if (insn.getOpcode() != 7) {
|
||||
continue;
|
||||
}
|
||||
iterator.set((AbstractInsnNode)new InsnNode(8));
|
||||
++part;
|
||||
}
|
||||
else if (part == 1) {
|
||||
if (insn.getOpcode() != 184) {
|
||||
continue;
|
||||
}
|
||||
final MethodInsnNode node = (MethodInsnNode)insn;
|
||||
if (!Name.block_getIdFromBlock.matches(node, obfuscated)) {
|
||||
continue;
|
||||
}
|
||||
iterator.add((AbstractInsnNode)new MethodInsnNode(182, "java/io/DataOutputStream", "writeShort", "(I)V", false));
|
||||
++part;
|
||||
}
|
||||
else if (part == 2) {
|
||||
if (insn.getOpcode() == 25) {
|
||||
++part;
|
||||
}
|
||||
else {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
else if (part == 3) {
|
||||
if (insn.getOpcode() != 182) {
|
||||
continue;
|
||||
}
|
||||
iterator.add((AbstractInsnNode)new VarInsnNode(25, 6));
|
||||
iterator.add((AbstractInsnNode)new InsnNode(95));
|
||||
iterator.add((AbstractInsnNode)new MethodInsnNode(182, "java/io/DataOutputStream", "writeByte", "(I)V", false));
|
||||
++part;
|
||||
}
|
||||
else {
|
||||
iterator.remove();
|
||||
if (insn.getOpcode() == 182) {
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
throw new AsmTransformException("no match for part " + part);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaS24PacketBlockActivation implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaS24PacketBlockActivation() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
MethodNode method = AsmUtil.findMethod(cn, Name.packet_readPacketData);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 4095, 65535);
|
||||
method = AsmUtil.findMethod(cn, Name.packet_writePacketData);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 4095, 65535);
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaS26PacketMapChunkBulk implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaS26PacketMapChunkBulk() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, Name.packet_readPacketData);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 8192, 12288, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaStatList implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaStatList() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, "<clinit>");
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 4096, 32768, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import com.falsepattern.endlessids.asm.Name;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class VanillaWorld implements IClassNodeTransformer
|
||||
{
|
||||
public VanillaWorld() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, Name.world_breakBlock);
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 12, 16);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import lombok.val;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.LdcInsnNode;
|
||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||
|
||||
public class WorldEditBaseBlock implements IClassNodeTransformer
|
||||
{
|
||||
public WorldEditBaseBlock() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final MethodNode method = AsmUtil.findMethod(cn, "internalSetId", true);
|
||||
if (method == null) {
|
||||
return;
|
||||
}
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 4095, 32767);
|
||||
final InsnList code = method.instructions;
|
||||
val iter = code.iterator();
|
||||
while (iter.hasNext()) {
|
||||
val insn = iter.next();
|
||||
if (insn.getType() == 9 && ((LdcInsnNode)insn).cst instanceof String) {
|
||||
final String string = (String)((LdcInsnNode)insn).cst;
|
||||
if (string.contains("4095")) {
|
||||
((LdcInsnNode)insn).cst = string.replace("4095", Integer.toString(32767));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user