mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-25 06:24:27 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
e7852e123f
commit
3bbdeaabaa
216 files changed
+2335
-2312
No files matched your search
@@ -1,10 +1,12 @@
|
||||
package mcp.mobius.mobiuscore.asm;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
|
||||
import cpw.mods.fml.common.DummyModContainer;
|
||||
import cpw.mods.fml.common.LoadController;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class CoreContainer extends DummyModContainer {
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package mcp.mobius.mobiuscore.asm;
|
||||
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
|
||||
@IFMLLoadingPlugin.MCVersion("1.7.10")
|
||||
@IFMLLoadingPlugin.TransformerExclusions("mcp.mobius.mobiuscore.asm")
|
||||
public class CoreDescription implements IFMLLoadingPlugin {
|
||||
@@ -14,7 +16,7 @@ public class CoreDescription implements IFMLLoadingPlugin {
|
||||
|
||||
@Override
|
||||
public String[] getASMTransformerClass() {
|
||||
return new String[] {"mcp.mobius.mobiuscore.asm.CoreTransformer"};
|
||||
return new String[] { "mcp.mobius.mobiuscore.asm.CoreTransformer" };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,13 +2,16 @@ package mcp.mobius.mobiuscore.asm;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import mcp.mobius.mobiuscore.asm.transformers.common.*;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.crucible.TransformerWorldCrucible;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.forge.TransformerWorld;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.kcauldron.TransformerWorldKCauldron;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.mcpc.TransformerWorldCauldron;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.thermos.TransformerWorldThermos;
|
||||
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.util.TraceClassVisitor;
|
||||
@@ -70,7 +73,7 @@ public class CoreTransformer implements IClassTransformer {
|
||||
}
|
||||
|
||||
// if (srgname.equals("cpw.mods.fml.common.network.internal.FMLProxyPacket")){
|
||||
// bytes = new TransformerFMLProxyPacket().transform(name, srgname, bytes);
|
||||
// bytes = new TransformerFMLProxyPacket().transform(name, srgname, bytes);
|
||||
// }
|
||||
|
||||
if (srgname.equals("cpw.mods.fml.common.eventhandler.ASMEventHandler")) {
|
||||
|
||||
@@ -21,11 +21,8 @@ public final class MethodDescriptor {
|
||||
}
|
||||
|
||||
/*
|
||||
public MethodDescriptor(String name, String vdesc, String cdesc){
|
||||
this.methodName = name;
|
||||
this.vanillaDesc = vdesc;
|
||||
this.coremodDesc = cdesc;
|
||||
}
|
||||
*/
|
||||
* public MethodDescriptor(String name, String vdesc, String cdesc){ this.methodName = name; this.vanillaDesc =
|
||||
* vdesc; this.coremodDesc = cdesc; }
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -1,144 +1,89 @@
|
||||
package mcp.mobius.mobiuscore.asm;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
public enum ObfTable {
|
||||
|
||||
WORLD_UPDATEENTITIES("ahb", "h", "()V", "net/minecraft/world/World", "updateEntities", "()V"),
|
||||
WORLD_UPDATEENTITY(
|
||||
"ahb", "g", "(Lsa;)V", "net/minecraft/world/World", "updateEntity", "(Lnet/minecraft/entity/Entity;)V"),
|
||||
WORLD_UPDATEENTITY("ahb", "g", "(Lsa;)V", "net/minecraft/world/World", "updateEntity",
|
||||
"(Lnet/minecraft/entity/Entity;)V"),
|
||||
TILEENTITY_UPDATEENTITY("aor", "h", "()V", "net/minecraft/tileentity/TileEntity", "updateEntity", "()V"),
|
||||
|
||||
WORLDSERVER_TICK("mt", "b", "()V", "net/minecraft/world/WorldServer", "tick", "()V"),
|
||||
WORLD_PROVIDER(
|
||||
"mt", "t", "Laqo;", "net/minecraft/world/WorldServer", "provider", "Lnet/minecraft/world/WorldProvider;"),
|
||||
WORLD_PROVIDER("mt", "t", "Laqo;", "net/minecraft/world/WorldServer", "provider",
|
||||
"Lnet/minecraft/world/WorldProvider;"),
|
||||
WORLDPROVIDER_DIMID("aqo", "i", "I", "net/minecraft/world/WorldProvider", "dimensionId", "I"),
|
||||
|
||||
SERIALIZER_ENCODE(
|
||||
"fa",
|
||||
"a",
|
||||
"(Lio/netty/channel/ChannelHandlerContext;Lft;Lio/netty/buffer/ByteBuf;)V",
|
||||
"net/minecraft/util/MessageSerializer",
|
||||
"encode",
|
||||
SERIALIZER_ENCODE("fa", "a", "(Lio/netty/channel/ChannelHandlerContext;Lft;Lio/netty/buffer/ByteBuf;)V",
|
||||
"net/minecraft/util/MessageSerializer", "encode",
|
||||
"(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;Lio/netty/buffer/ByteBuf;)V"),
|
||||
DESERIALIZER_DECODE(
|
||||
"ez",
|
||||
"decode",
|
||||
DESERIALIZER_DECODE("ez", "decode",
|
||||
"(Lio/netty/channel/ChannelHandlerContext;Lio/netty/buffer/ByteBuf;Ljava/util/List;)V",
|
||||
"net/minecraft/util/MessageDeserializer",
|
||||
"decode",
|
||||
"net/minecraft/util/MessageDeserializer", "decode",
|
||||
"(Lio/netty/channel/ChannelHandlerContext;Lio/netty/buffer/ByteBuf;Ljava/util/List;)V"),
|
||||
|
||||
PACKET_WRITEPACKETDATA(
|
||||
"ft",
|
||||
"b",
|
||||
"(Let;)V",
|
||||
"net/minecraft/network/Packet",
|
||||
"writePacketData",
|
||||
PACKET_WRITEPACKETDATA("ft", "b", "(Let;)V", "net/minecraft/network/Packet", "writePacketData",
|
||||
"(Lnet/minecraft/network/PacketBuffer;)V"),
|
||||
PACKET_READPACKETDATA(
|
||||
"ft",
|
||||
"a",
|
||||
"(Let;)V",
|
||||
"net/minecraft/network/Packet",
|
||||
"readPacketData",
|
||||
PACKET_READPACKETDATA("ft", "a", "(Let;)V", "net/minecraft/network/Packet", "readPacketData",
|
||||
"(Lnet/minecraft/network/PacketBuffer;)V"),
|
||||
PACKET_GENERATEPACKET(
|
||||
"ft",
|
||||
"a",
|
||||
"(Lcom/google/common/collect/BiMap;I)Lpk;",
|
||||
"net/minecraft/network/Packet",
|
||||
"generatePacket",
|
||||
"(Lcom/google/common/collect/BiMap;I)Lnet/minecraft/network/Packet;"),
|
||||
PACKET_GENERATEPACKET("ft", "a", "(Lcom/google/common/collect/BiMap;I)Lpk;", "net/minecraft/network/Packet",
|
||||
"generatePacket", "(Lcom/google/common/collect/BiMap;I)Lnet/minecraft/network/Packet;"),
|
||||
PACKETBUFFER_READABLE("et", "readableBytes", "()I", "net/minecraft/network/PacketBuffer", "readableBytes", "()I"),
|
||||
PACKETBUFFER_CAPACITY("et", "capacity", "()I", "net/minecraft/network/PacketBuffer", "capacity", "()I"),
|
||||
|
||||
RENDERMANAGER_RENDERENTITY(
|
||||
"bnn",
|
||||
"a",
|
||||
"(Lsa;FZ)Z",
|
||||
"net/minecraft/client/renderer/entity/RenderManager",
|
||||
"renderEntityStatic",
|
||||
"(Lnet/minecraft/entity/Entity;FZ)Z"),
|
||||
RENDERMANAGER_RENDERPOSYAW(
|
||||
"bnn",
|
||||
"a",
|
||||
"(Lsa;DDDFF)Z",
|
||||
"net/minecraft/client/renderer/entity/RenderManager",
|
||||
"renderEntityWithPosYaw",
|
||||
"(Lnet/minecraft/entity/Entity;DDDFF)Z"),
|
||||
RENDERMANAGER_RENDER(
|
||||
"bnn",
|
||||
"a",
|
||||
"(Lsa;DDDFFZ)Z",
|
||||
"net/minecraft/client/renderer/entity/RenderManager",
|
||||
"func_147939_a",
|
||||
"(Lnet/minecraft/entity/Entity;DDDFFZ)Z"),
|
||||
RENDERMANAGER_RENDERENTITY("bnn", "a", "(Lsa;FZ)Z", "net/minecraft/client/renderer/entity/RenderManager",
|
||||
"renderEntityStatic", "(Lnet/minecraft/entity/Entity;FZ)Z"),
|
||||
RENDERMANAGER_RENDERPOSYAW("bnn", "a", "(Lsa;DDDFF)Z", "net/minecraft/client/renderer/entity/RenderManager",
|
||||
"renderEntityWithPosYaw", "(Lnet/minecraft/entity/Entity;DDDFF)Z"),
|
||||
RENDERMANAGER_RENDER("bnn", "a", "(Lsa;DDDFFZ)Z", "net/minecraft/client/renderer/entity/RenderManager",
|
||||
"func_147939_a", "(Lnet/minecraft/entity/Entity;DDDFFZ)Z"),
|
||||
|
||||
TERENDER_RENDERAT(
|
||||
"bml",
|
||||
"a",
|
||||
"(Laor;DDDF)V",
|
||||
"net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer",
|
||||
"renderTileEntityAt",
|
||||
"(Lnet/minecraft/tileentity/TileEntity;DDDF)V"),
|
||||
TERENDER_RENDERAT("bml", "a", "(Laor;DDDF)V", "net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer",
|
||||
"renderTileEntityAt", "(Lnet/minecraft/tileentity/TileEntity;DDDF)V"),
|
||||
|
||||
FMLCH_PREWORLDTICK(
|
||||
"cpw/mods/fml/common/FMLCommonHandler",
|
||||
"onPreWorldTick",
|
||||
"(Lahb;)V",
|
||||
"cpw/mods/fml/common/FMLCommonHandler",
|
||||
"onPreWorldTick",
|
||||
"(Lnet/minecraft/world/World;)V"),
|
||||
FMLCH_POSTWORLDTICK(
|
||||
"cpw/mods/fml/common/FMLCommonHandler",
|
||||
"onPostWorldTick",
|
||||
"(Lahb;)V",
|
||||
"cpw/mods/fml/common/FMLCommonHandler",
|
||||
"onPostWorldTick",
|
||||
"(Lnet/minecraft/world/World;)V"),
|
||||
FMLCH_PREWORLDTICK("cpw/mods/fml/common/FMLCommonHandler", "onPreWorldTick", "(Lahb;)V",
|
||||
"cpw/mods/fml/common/FMLCommonHandler", "onPreWorldTick", "(Lnet/minecraft/world/World;)V"),
|
||||
FMLCH_POSTWORLDTICK("cpw/mods/fml/common/FMLCommonHandler", "onPostWorldTick", "(Lahb;)V",
|
||||
"cpw/mods/fml/common/FMLCommonHandler", "onPostWorldTick", "(Lnet/minecraft/world/World;)V"),
|
||||
|
||||
FMLPP_PROCESSPACKET(
|
||||
"cpw/mods/fml/common/network/internal/FMLProxyPacket",
|
||||
"a",
|
||||
"(Lfb;)V",
|
||||
"cpw/mods/fml/common/network/internal/FMLProxyPacket",
|
||||
"processPacket",
|
||||
FMLPP_PROCESSPACKET("cpw/mods/fml/common/network/internal/FMLProxyPacket", "a", "(Lfb;)V",
|
||||
"cpw/mods/fml/common/network/internal/FMLProxyPacket", "processPacket",
|
||||
"(Lnet/minecraft/network/INetHandler;)V"),
|
||||
|
||||
WORLD_INIT(
|
||||
"ahb",
|
||||
"<init>",
|
||||
"(Lazc;Ljava/lang/String;Lahj;Laqo;Lqi;)V",
|
||||
"net/minecraft/world/World",
|
||||
"<init>",
|
||||
WORLD_INIT("ahb", "<init>", "(Lazc;Ljava/lang/String;Lahj;Laqo;Lqi;)V", "net/minecraft/world/World", "<init>",
|
||||
"(Lnet/minecraft/world/storage/ISaveHandler;Ljava/lang/String;Lnet/minecraft/world/WorldSettings;Lnet/minecraft/world/WorldProvider;Lnet/minecraft/profiler/Profiler;)V"),
|
||||
WORLD_LOADEDENTS(
|
||||
"ahb", "e", "Ljava/util/List;", "net/minecraft/world/World", "loadedEntityList", "Ljava/util/List;"),
|
||||
WORLD_LOADEDTILES(
|
||||
"ahb", "g", "Ljava/util/List;", "net/minecraft/world/World", "loadedTileEntityList", "Ljava/util/List;"),
|
||||
/*
|
||||
NETWORKLISTEN_NETWORKTICK ("nc", "c", "()V", "net/minecraft/network/NetworkSystem", "networkTick", "()V"),
|
||||
TCPCONN_READPACKET ("co", "i", "()Z", "net/minecraft/network/TcpConnection", "readPacket", "()Z"),
|
||||
TCPCONN_SENDPACKET ("co", "a", "(Z)Ley;", "net/minecraft/network/TcpConnection", "func_74460_a", "(Z)Lnet/minecraft/network/packet/Packet;"),
|
||||
TCPCONN_NETWORKSOCKET ("co", "j", "Ljava/net/Socket;", "net/minecraft/network/TcpConnection", "networkSocket", "Ljava/net/Socket;"),
|
||||
MEMCONN_ADDSENDQUEUE ("cn", "a", "(Ley;)V", "net/minecraft/network/MemoryConnection", "addToSendQueue", "(Lnet/minecraft/network/packet/Packet;)V"),
|
||||
MEMCONN_PROCESSREAD ("cn", "b", "()V", "net/minecraft/network/MemoryConnection", "processReadPackets", "()V"),
|
||||
MEMCONN_PAIREDCONN ("cn", "d", "Lcn;", "net/minecraft/network/MemoryConnection", "pairedConnection", "Lnet/minecraft/network/MemoryConnection;"),
|
||||
MEMCONN_PROCESSORCACHE ("cn", "b", "(Ley;)V", "net/minecraft/network/MemoryConnection", "processOrCachePacket", "(Lnet/minecraft/network/packet/Packet;)V"),
|
||||
MEMCONN_MYNETHANDLER ("cn", "e", "Lez;", "net/minecraft/network/MemoryConnection", "myNetHandler", "Lnet/minecraft/network/packet/NetHandler;");
|
||||
*/
|
||||
WORLD_LOADEDENTS("ahb", "e", "Ljava/util/List;", "net/minecraft/world/World", "loadedEntityList",
|
||||
"Ljava/util/List;"),
|
||||
WORLD_LOADEDTILES("ahb", "g", "Ljava/util/List;", "net/minecraft/world/World", "loadedTileEntityList",
|
||||
"Ljava/util/List;"),
|
||||
/*
|
||||
* NETWORKLISTEN_NETWORKTICK ("nc", "c", "()V", "net/minecraft/network/NetworkSystem", "networkTick", "()V"),
|
||||
* TCPCONN_READPACKET ("co", "i", "()Z", "net/minecraft/network/TcpConnection", "readPacket", "()Z"),
|
||||
* TCPCONN_SENDPACKET ("co", "a", "(Z)Ley;", "net/minecraft/network/TcpConnection", "func_74460_a",
|
||||
* "(Z)Lnet/minecraft/network/packet/Packet;"), TCPCONN_NETWORKSOCKET ("co", "j", "Ljava/net/Socket;",
|
||||
* "net/minecraft/network/TcpConnection", "networkSocket", "Ljava/net/Socket;"), MEMCONN_ADDSENDQUEUE ("cn", "a",
|
||||
* "(Ley;)V", "net/minecraft/network/MemoryConnection", "addToSendQueue",
|
||||
* "(Lnet/minecraft/network/packet/Packet;)V"), MEMCONN_PROCESSREAD ("cn", "b", "()V",
|
||||
* "net/minecraft/network/MemoryConnection", "processReadPackets", "()V"), MEMCONN_PAIREDCONN ("cn", "d", "Lcn;",
|
||||
* "net/minecraft/network/MemoryConnection", "pairedConnection", "Lnet/minecraft/network/MemoryConnection;"),
|
||||
* MEMCONN_PROCESSORCACHE ("cn", "b", "(Ley;)V", "net/minecraft/network/MemoryConnection", "processOrCachePacket",
|
||||
* "(Lnet/minecraft/network/packet/Packet;)V"), MEMCONN_MYNETHANDLER ("cn", "e", "Lez;",
|
||||
* "net/minecraft/network/MemoryConnection", "myNetHandler", "Lnet/minecraft/network/packet/NetHandler;");
|
||||
*/
|
||||
|
||||
// PACKET_PROCESSPACKET ("ey", "a", "(Lez;)V", "net/minecraft/network/packet/Packet", "processPacket",
|
||||
// "(Lnet/minecraft/network/packet/NetHandler;)V"),
|
||||
// PACKET_WRITEPACKET ("ey", "a", "(Llp;Ljava/io/DataInput;ZLjava/net/Socket;)Ley;",
|
||||
// "net/minecraft/network/packet/Packet", "writePacket",
|
||||
// "(Lnet/minecraft/network/packet/Packet;Ljava/io/DataOutput;)V"),
|
||||
// PACKET_READPACKET ("ey", "a", "(Llp;Ljava/io/DataInput;ZLjava/net/Socket;)Ley;",
|
||||
// "net/minecraft/network/packet/Packet", "readPacket",
|
||||
// "(Lnet/minecraft/logging/ILogAgent;Ljava/io/DataInput;ZLjava/net/Socket;)Lnet/minecraft/network/packet/Packet;"),
|
||||
;
|
||||
// PACKET_PROCESSPACKET ("ey", "a", "(Lez;)V", "net/minecraft/network/packet/Packet", "processPacket",
|
||||
// "(Lnet/minecraft/network/packet/NetHandler;)V"),
|
||||
// PACKET_WRITEPACKET ("ey", "a", "(Llp;Ljava/io/DataInput;ZLjava/net/Socket;)Ley;",
|
||||
// "net/minecraft/network/packet/Packet", "writePacket",
|
||||
// "(Lnet/minecraft/network/packet/Packet;Ljava/io/DataOutput;)V"),
|
||||
// PACKET_READPACKET ("ey", "a", "(Llp;Ljava/io/DataInput;ZLjava/net/Socket;)Ley;",
|
||||
// "net/minecraft/network/packet/Packet", "readPacket",
|
||||
// "(Lnet/minecraft/logging/ILogAgent;Ljava/io/DataInput;ZLjava/net/Socket;)Lnet/minecraft/network/packet/Packet;"),
|
||||
;
|
||||
|
||||
private static Boolean isObfuscated = null;
|
||||
private static ServerType serverType;
|
||||
@@ -193,8 +138,7 @@ MEMCONN_PAIREDCONN ("cn", "d", "Lcn;", "net/minecraft/network/MemoryC
|
||||
ObfTable.isObfuscated = false;
|
||||
}
|
||||
|
||||
} catch (IOException e1) {
|
||||
}
|
||||
} catch (IOException e1) {}
|
||||
|
||||
return ObfTable.isObfuscated;
|
||||
}
|
||||
@@ -212,12 +156,12 @@ MEMCONN_PAIREDCONN ("cn", "d", "Lcn;", "net/minecraft/network/MemoryC
|
||||
CoreDescription.log.info("Switching injection mode to KCAULDRON");
|
||||
} else if (FMLCommonHandler.instance().getModName().contains("cauldron")
|
||||
|| FMLCommonHandler.instance().getModName().contains("mcpc")) {
|
||||
serverType = ServerType.Cauldron;
|
||||
CoreDescription.log.info("Switching injection mode to CAULDRON");
|
||||
} else {
|
||||
serverType = ServerType.Forge;
|
||||
CoreDescription.log.info("Switching injection mode to FORGE");
|
||||
}
|
||||
serverType = ServerType.Cauldron;
|
||||
CoreDescription.log.info("Switching injection mode to CAULDRON");
|
||||
} else {
|
||||
serverType = ServerType.Forge;
|
||||
CoreDescription.log.info("Switching injection mode to FORGE");
|
||||
}
|
||||
return serverType;
|
||||
}
|
||||
|
||||
@@ -239,8 +183,7 @@ MEMCONN_PAIREDCONN ("cn", "d", "Lcn;", "net/minecraft/network/MemoryC
|
||||
}
|
||||
|
||||
/*
|
||||
public FieldInsnNode getFieldNode(){
|
||||
return new FieldInsnNode(Opcodes.GETFIELD, this.getClazz(), this.getName(), this.getDescriptor());
|
||||
}
|
||||
*/
|
||||
* public FieldInsnNode getFieldNode(){ return new FieldInsnNode(Opcodes.GETFIELD, this.getClazz(), this.getName(),
|
||||
* this.getDescriptor()); }
|
||||
*/
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package mcp.mobius.mobiuscore.asm;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
@@ -9,6 +7,9 @@ import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.TypeInsnNode;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
public class Opcode {
|
||||
|
||||
public static InsnNode DUP() {
|
||||
|
||||
@@ -8,9 +8,11 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import mcp.mobius.mobiuscore.asm.CoreDescription;
|
||||
import mcp.mobius.mobiuscore.asm.MethodDescriptor;
|
||||
import mcp.mobius.mobiuscore.asm.Opcode;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
@@ -37,8 +39,8 @@ public abstract class TransformerBase {
|
||||
return findPattern(methodNode, false, pattern);
|
||||
}
|
||||
|
||||
protected ArrayList<ArrayList<AbstractInsnNode>> findPattern(
|
||||
MethodNode methodNode, boolean dumpOpcodes, AbstractInsnNode... pattern) {
|
||||
protected ArrayList<ArrayList<AbstractInsnNode>> findPattern(MethodNode methodNode, boolean dumpOpcodes,
|
||||
AbstractInsnNode... pattern) {
|
||||
InsnList instructions = methodNode.instructions;
|
||||
ArrayList<ArrayList<AbstractInsnNode>> returnList = new ArrayList<ArrayList<AbstractInsnNode>>();
|
||||
|
||||
@@ -49,8 +51,7 @@ public abstract class TransformerBase {
|
||||
if (dumpOpcodes) printInsnNode(currNode);
|
||||
|
||||
// We found the first element of the pattern. We are starting matching all the elements
|
||||
if (this.areInsnEqual(currNode, pattern[0]))
|
||||
;
|
||||
if (this.areInsnEqual(currNode, pattern[0]));
|
||||
{
|
||||
boolean match = true;
|
||||
|
||||
@@ -58,9 +59,9 @@ public abstract class TransformerBase {
|
||||
// false if at least one inst doesn't match
|
||||
for (int indexPatternInst = 0; indexPatternInst < pattern.length; indexPatternInst++) {
|
||||
try {
|
||||
match = match
|
||||
&& this.areInsnEqual(
|
||||
instructions.get(indexFirstInst + indexPatternInst), pattern[indexPatternInst]);
|
||||
match = match && this.areInsnEqual(
|
||||
instructions.get(indexFirstInst + indexPatternInst),
|
||||
pattern[indexPatternInst]);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
return returnList; // This can only happen if there is less than the number of pattern elements
|
||||
// in the remaining instructions. We can return the current results directly.
|
||||
@@ -100,13 +101,15 @@ public abstract class TransformerBase {
|
||||
if (insn1 instanceof MethodInsnNode) {
|
||||
if ((((MethodInsnNode) insn1).owner.equals(((MethodInsnNode) insn2).owner))
|
||||
&& (((MethodInsnNode) insn1).name.equals(((MethodInsnNode) insn2).name))
|
||||
&& (((MethodInsnNode) insn1).desc.equals(((MethodInsnNode) insn2).desc))) return true;
|
||||
&& (((MethodInsnNode) insn1).desc.equals(((MethodInsnNode) insn2).desc)))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (insn1 instanceof FieldInsnNode) {
|
||||
if ((((FieldInsnNode) insn1).owner.equals(((FieldInsnNode) insn2).owner))
|
||||
&& (((FieldInsnNode) insn1).name.equals(((FieldInsnNode) insn2).name))
|
||||
&& (((FieldInsnNode) insn1).desc.equals(((FieldInsnNode) insn2).desc))) return true;
|
||||
&& (((FieldInsnNode) insn1).desc.equals(((FieldInsnNode) insn2).desc)))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (insn1 instanceof InsnNode) {
|
||||
@@ -131,43 +134,52 @@ public abstract class TransformerBase {
|
||||
break;
|
||||
|
||||
case AbstractInsnNode.VAR_INSN:
|
||||
CoreDescription.log.info(String.format(
|
||||
"VAR_INSN : %s %s",
|
||||
Opcode.Instructions.inverse().get(insnNode.getOpcode()), ((VarInsnNode) insnNode).var));
|
||||
CoreDescription.log.info(
|
||||
String.format(
|
||||
"VAR_INSN : %s %s",
|
||||
Opcode.Instructions.inverse().get(insnNode.getOpcode()),
|
||||
((VarInsnNode) insnNode).var));
|
||||
break;
|
||||
|
||||
case AbstractInsnNode.METHOD_INSN:
|
||||
CoreDescription.log.info(String.format(
|
||||
"METHOD_INSN : %s %s %s %s",
|
||||
Opcode.Instructions.inverse().get(insnNode.getOpcode()),
|
||||
((MethodInsnNode) insnNode).owner,
|
||||
((MethodInsnNode) insnNode).name,
|
||||
((MethodInsnNode) insnNode).desc));
|
||||
CoreDescription.log.info(
|
||||
String.format(
|
||||
"METHOD_INSN : %s %s %s %s",
|
||||
Opcode.Instructions.inverse().get(insnNode.getOpcode()),
|
||||
((MethodInsnNode) insnNode).owner,
|
||||
((MethodInsnNode) insnNode).name,
|
||||
((MethodInsnNode) insnNode).desc));
|
||||
break;
|
||||
|
||||
case AbstractInsnNode.INSN:
|
||||
CoreDescription.log.info(String.format(
|
||||
"INSN : %s", Opcode.Instructions.inverse().get(insnNode.getOpcode())));
|
||||
CoreDescription.log.info(
|
||||
String.format("INSN : %s", Opcode.Instructions.inverse().get(insnNode.getOpcode())));
|
||||
break;
|
||||
|
||||
case AbstractInsnNode.TYPE_INSN:
|
||||
CoreDescription.log.info(String.format(
|
||||
"TYPE_INSN : %s %s",
|
||||
Opcode.Instructions.inverse().get(insnNode.getOpcode()), ((TypeInsnNode) insnNode).desc));
|
||||
CoreDescription.log.info(
|
||||
String.format(
|
||||
"TYPE_INSN : %s %s",
|
||||
Opcode.Instructions.inverse().get(insnNode.getOpcode()),
|
||||
((TypeInsnNode) insnNode).desc));
|
||||
break;
|
||||
|
||||
case AbstractInsnNode.FIELD_INSN:
|
||||
CoreDescription.log.info(String.format(
|
||||
"FIELD_INSN : %s %s %s %s",
|
||||
Opcode.Instructions.inverse().get(insnNode.getOpcode()),
|
||||
((FieldInsnNode) insnNode).owner,
|
||||
((FieldInsnNode) insnNode).name,
|
||||
((FieldInsnNode) insnNode).desc));
|
||||
CoreDescription.log.info(
|
||||
String.format(
|
||||
"FIELD_INSN : %s %s %s %s",
|
||||
Opcode.Instructions.inverse().get(insnNode.getOpcode()),
|
||||
((FieldInsnNode) insnNode).owner,
|
||||
((FieldInsnNode) insnNode).name,
|
||||
((FieldInsnNode) insnNode).desc));
|
||||
break;
|
||||
|
||||
default:
|
||||
CoreDescription.log.info(String.format(
|
||||
" %s %s", Opcode.Instructions.inverse().get(insnNode.getOpcode()), insnNode));
|
||||
CoreDescription.log.info(
|
||||
String.format(
|
||||
" %s %s",
|
||||
Opcode.Instructions.inverse().get(insnNode.getOpcode()),
|
||||
insnNode));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -180,16 +192,16 @@ public abstract class TransformerBase {
|
||||
}
|
||||
}
|
||||
|
||||
private void applyPayloadAfter(
|
||||
InsnList instructions, ArrayList<AbstractInsnNode> match, AbstractInsnNode[] payload_pattern) {
|
||||
private void applyPayloadAfter(InsnList instructions, ArrayList<AbstractInsnNode> match,
|
||||
AbstractInsnNode[] payload_pattern) {
|
||||
InsnList payload = new InsnList();
|
||||
for (int i = 0; i < payload_pattern.length; i++) payload.add(payload_pattern[i]);
|
||||
|
||||
instructions.insert(match.get(match.size() - 1), payload);
|
||||
}
|
||||
|
||||
private void applyPayloadBefore(
|
||||
InsnList instructions, ArrayList<AbstractInsnNode> match, AbstractInsnNode[] payload_pattern) {
|
||||
private void applyPayloadBefore(InsnList instructions, ArrayList<AbstractInsnNode> match,
|
||||
AbstractInsnNode[] payload_pattern) {
|
||||
InsnList payload = new InsnList();
|
||||
for (int i = 0; i < payload_pattern.length; i++) payload.add(payload_pattern[i]);
|
||||
|
||||
@@ -272,7 +284,8 @@ public abstract class TransformerBase {
|
||||
zip.close();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(
|
||||
"Error overriding " + transformedName + " from " + CoreDescription.location.getName(), e);
|
||||
"Error overriding " + transformedName + " from " + CoreDescription.location.getName(),
|
||||
e);
|
||||
}
|
||||
|
||||
return bytes;
|
||||
@@ -296,12 +309,14 @@ public abstract class TransformerBase {
|
||||
MethodNode vanillaMethodNode = null;
|
||||
for (MethodNode node : vanillaNode.methods) {
|
||||
try {
|
||||
if (node != null
|
||||
&& node.desc.equals(methodDesc.getDescriptor())
|
||||
if (node != null && node.desc.equals(methodDesc.getDescriptor())
|
||||
&& (node.name.equals(methodDesc.getMethodName()))) {
|
||||
CoreDescription.log.info(String.format(
|
||||
"Found method node %s.%s %s in Vanilla.",
|
||||
className, methodDesc.getMethodName(), methodDesc.getDescriptor()));
|
||||
CoreDescription.log.info(
|
||||
String.format(
|
||||
"Found method node %s.%s %s in Vanilla.",
|
||||
className,
|
||||
methodDesc.getMethodName(),
|
||||
methodDesc.getDescriptor()));
|
||||
vanillaMethodNode = node;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -312,12 +327,14 @@ public abstract class TransformerBase {
|
||||
MethodNode coremodMethodNode = null;
|
||||
for (MethodNode node : coremodNode.methods) {
|
||||
try {
|
||||
if (node != null
|
||||
&& node.desc.equals(methodDesc.getDescriptor())
|
||||
if (node != null && node.desc.equals(methodDesc.getDescriptor())
|
||||
&& (node.name.equals(methodDesc.getMethodName()))) {
|
||||
CoreDescription.log.info(String.format(
|
||||
"Found method node %s.%s %s in Coremod.",
|
||||
className, methodDesc.getMethodName(), methodDesc.getDescriptor()));
|
||||
CoreDescription.log.info(
|
||||
String.format(
|
||||
"Found method node %s.%s %s in Coremod.",
|
||||
className,
|
||||
methodDesc.getMethodName(),
|
||||
methodDesc.getDescriptor()));
|
||||
coremodMethodNode = node;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -326,14 +343,20 @@ public abstract class TransformerBase {
|
||||
}
|
||||
|
||||
if (vanillaMethodNode == null) {
|
||||
CoreDescription.log.fatal(String.format(
|
||||
"Method node %s.%s %s not found in Vanilla ! This is going to crash !.",
|
||||
className, methodDesc.getMethodName(), methodDesc.getDescriptor()));
|
||||
CoreDescription.log.fatal(
|
||||
String.format(
|
||||
"Method node %s.%s %s not found in Vanilla ! This is going to crash !.",
|
||||
className,
|
||||
methodDesc.getMethodName(),
|
||||
methodDesc.getDescriptor()));
|
||||
}
|
||||
if (coremodMethodNode == null) {
|
||||
CoreDescription.log.fatal(String.format(
|
||||
"Method node %s.%s %s not found in Coremod ! This is going to crash !.",
|
||||
className, methodDesc.getMethodName(), methodDesc.getDescriptor()));
|
||||
CoreDescription.log.fatal(
|
||||
String.format(
|
||||
"Method node %s.%s %s not found in Coremod ! This is going to crash !.",
|
||||
className,
|
||||
methodDesc.getMethodName(),
|
||||
methodDesc.getDescriptor()));
|
||||
}
|
||||
|
||||
vanillaNode.methods.remove(vanillaMethodNode);
|
||||
@@ -364,12 +387,14 @@ public abstract class TransformerBase {
|
||||
MethodNode coremodMethodNode = null;
|
||||
for (MethodNode node : coremodNode.methods) {
|
||||
try {
|
||||
if (node != null
|
||||
&& node.desc.equals(methodDesc.getDescriptor())
|
||||
if (node != null && node.desc.equals(methodDesc.getDescriptor())
|
||||
&& (node.name.equals(methodDesc.getMethodName()))) {
|
||||
CoreDescription.log.info(String.format(
|
||||
"Found method node %s.%s %s in Coremod. Injecting !",
|
||||
className, methodDesc.getMethodName(), methodDesc.getDescriptor()));
|
||||
CoreDescription.log.info(
|
||||
String.format(
|
||||
"Found method node %s.%s %s in Coremod. Injecting !",
|
||||
className,
|
||||
methodDesc.getMethodName(),
|
||||
methodDesc.getDescriptor()));
|
||||
coremodMethodNode = node;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -378,9 +403,12 @@ public abstract class TransformerBase {
|
||||
}
|
||||
|
||||
if (coremodMethodNode == null) {
|
||||
CoreDescription.log.fatal(String.format(
|
||||
"Method node %s.%s %s not found in Coremod ! This is going to crash !.",
|
||||
className, methodDesc.getMethodName(), methodDesc.getDescriptor()));
|
||||
CoreDescription.log.fatal(
|
||||
String.format(
|
||||
"Method node %s.%s %s not found in Coremod ! This is going to crash !.",
|
||||
className,
|
||||
methodDesc.getMethodName(),
|
||||
methodDesc.getDescriptor()));
|
||||
}
|
||||
|
||||
coremodMethodNode.accept(vanillaNode);
|
||||
@@ -413,13 +441,15 @@ public abstract class TransformerBase {
|
||||
|
||||
if (obf.equals(searge))
|
||||
CoreDescription.log.info(String.format("Found %s with checksum %s", searge, hashtext.toUpperCase()));
|
||||
else
|
||||
CoreDescription.log.info(String.format(
|
||||
"[MobiusCore] Found %s [ %s ] with checksum %s", searge, obf, hashtext.toUpperCase()));
|
||||
else CoreDescription.log.info(
|
||||
String.format(
|
||||
"[MobiusCore] Found %s [ %s ] with checksum %s",
|
||||
searge,
|
||||
obf,
|
||||
hashtext.toUpperCase()));
|
||||
|
||||
return hashtext.toUpperCase();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
|
||||
return "00000000000000000000000000000000";
|
||||
}
|
||||
|
||||
+24
-33
@@ -5,6 +5,7 @@ import static org.objectweb.asm.Opcodes.*;
|
||||
import mcp.mobius.mobiuscore.asm.Opcode;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
@@ -32,44 +33,34 @@ public class TransformerASMEventHandler extends TransformerBase {
|
||||
ASMEH_INVOKE = "invoke (Lcpw/mods/fml/common/eventhandler/Event;)V";
|
||||
ASMEH_INIT = "<init> (Ljava/lang/Object;Ljava/lang/reflect/Method;Lcpw/mods/fml/common/ModContainer;)V";
|
||||
|
||||
ASMEH_INVOKE_PATTERN = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.GETFIELD(
|
||||
"cpw/mods/fml/common/eventhandler/ASMEventHandler.handler Lcpw/mods/fml/common/eventhandler/IEventListener;"),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEINTERFACE(
|
||||
"cpw/mods/fml/common/eventhandler/IEventListener.invoke (Lcpw/mods/fml/common/eventhandler/Event;)V")
|
||||
};
|
||||
ASMEH_INVOKE_PATTERN = new AbstractInsnNode[] { Opcode.ALOAD(-1), Opcode.GETFIELD(
|
||||
"cpw/mods/fml/common/eventhandler/ASMEventHandler.handler Lcpw/mods/fml/common/eventhandler/IEventListener;"),
|
||||
Opcode.ALOAD(-1), Opcode.INVOKEINTERFACE(
|
||||
"cpw/mods/fml/common/eventhandler/IEventListener.invoke (Lcpw/mods/fml/common/eventhandler/Event;)V") };
|
||||
|
||||
ASMEH_INIT_PAYLOAD_PRE = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.ALOAD(2),
|
||||
Opcode.INVOKEVIRTUAL("java/lang/reflect/Method.getDeclaringClass ()Ljava/lang/Class;"),
|
||||
Opcode.INVOKEVIRTUAL("java/lang/Class.getCanonicalName ()Ljava/lang/String;"),
|
||||
Opcode.PUTFIELD("cpw/mods/fml/common/eventhandler/ASMEventHandler.package_ Ljava/lang/String;"),
|
||||
};
|
||||
ASMEH_INIT_PAYLOAD_PRE = new AbstractInsnNode[] { Opcode.ALOAD(0), Opcode.ALOAD(2),
|
||||
Opcode.INVOKEVIRTUAL("java/lang/reflect/Method.getDeclaringClass ()Ljava/lang/Class;"),
|
||||
Opcode.INVOKEVIRTUAL("java/lang/Class.getCanonicalName ()Ljava/lang/String;"),
|
||||
Opcode.PUTFIELD("cpw/mods/fml/common/eventhandler/ASMEventHandler.package_ Ljava/lang/String;"), };
|
||||
|
||||
ASMEH_INVOKE_PAYLOAD_PRE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.EVENT_INVOKE.name(), profilerType),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "()V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.EVENT_INVOKE.name(), profilerType),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "()V") };
|
||||
|
||||
ASMEH_INVOKE_PAYLOAD_POST = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.EVENT_INVOKE.name(), profilerType),
|
||||
Opcode.ALOAD(1),
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.GETFIELD("cpw/mods/fml/common/eventhandler/ASMEventHandler.package_ Ljava/lang/String;"),
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.GETFIELD(
|
||||
"cpw/mods/fml/common/eventhandler/ASMEventHandler.handler Lcpw/mods/fml/common/eventhandler/IEventListener;"),
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.GETFIELD(
|
||||
"cpw/mods/fml/common/eventhandler/ASMEventHandler.owner Lcpw/mods/fml/common/ModContainer;"),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
profilerClass,
|
||||
"stop",
|
||||
"(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.EVENT_INVOKE.name(), profilerType), Opcode.ALOAD(1),
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.GETFIELD("cpw/mods/fml/common/eventhandler/ASMEventHandler.package_ Ljava/lang/String;"),
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.GETFIELD(
|
||||
"cpw/mods/fml/common/eventhandler/ASMEventHandler.handler Lcpw/mods/fml/common/eventhandler/IEventListener;"),
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.GETFIELD(
|
||||
"cpw/mods/fml/common/eventhandler/ASMEventHandler.owner Lcpw/mods/fml/common/ModContainer;"),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
profilerClass,
|
||||
"stop",
|
||||
"(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V") };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+9
-14
@@ -4,6 +4,7 @@ import mcp.mobius.mobiuscore.asm.ObfTable;
|
||||
import mcp.mobius.mobiuscore.asm.Opcode;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
@@ -37,26 +38,20 @@ public class TransformerFMLCommonHandler extends TransformerBase {
|
||||
FMLCH_ONPOSTWORLDTICK = ObfTable.FMLCH_POSTWORLDTICK.getFullDescriptor();
|
||||
|
||||
FMLCH_PAYLOAD_PRESERVERTICK = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TICK.name(), profilerType),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "()V"),
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TICK.name(), profilerType),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "()V"), };
|
||||
|
||||
FMLCH_PAYLOAD_POSTSERVERTICK = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TICK.name(), profilerType),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "()V"),
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TICK.name(), profilerType),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "()V"), };
|
||||
|
||||
FMLCH_PAYLOAD_PREWORLDTICK = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.DIMENSION_TICK.name(), profilerType),
|
||||
Opcode.ALOAD(1),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.DIMENSION_TICK.name(), profilerType), Opcode.ALOAD(1),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V") };
|
||||
|
||||
FMLCH_PAYLOAD_POSTWORLDTICK = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.DIMENSION_TICK.name(), profilerType),
|
||||
Opcode.ALOAD(1),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.DIMENSION_TICK.name(), profilerType), Opcode.ALOAD(1),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V") };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+6
-10
@@ -3,6 +3,7 @@ package mcp.mobius.mobiuscore.asm.transformers.common;
|
||||
import mcp.mobius.mobiuscore.asm.Opcode;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
@@ -20,19 +21,14 @@ public class TransformerFMLOutboundHandler extends TransformerBase {
|
||||
String profilerClass = ProfilerSection.getClassName();
|
||||
String profilerType = ProfilerSection.getTypeName();
|
||||
|
||||
FMLOH_WRITE =
|
||||
"write (Lio/netty/channel/ChannelHandlerContext;Ljava/lang/Object;Lio/netty/channel/ChannelPromise;)V";
|
||||
FMLOH_WRITE = "write (Lio/netty/channel/ChannelHandlerContext;Ljava/lang/Object;Lio/netty/channel/ChannelPromise;)V";
|
||||
|
||||
FMLOH_WRITE_PATTERN = new AbstractInsnNode[] {
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
"cpw/mods/fml/common/network/handshake/NetworkDispatcher.sendProxy (Lcpw/mods/fml/common/network/internal/FMLProxyPacket;)V"),
|
||||
};
|
||||
FMLOH_WRITE_PATTERN = new AbstractInsnNode[] { Opcode.INVOKEVIRTUAL(
|
||||
"cpw/mods/fml/common/network/handshake/NetworkDispatcher.sendProxy (Lcpw/mods/fml/common/network/internal/FMLProxyPacket;)V"), };
|
||||
|
||||
FMLOH_WRITE_PAYLOAD = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.PACKET_OUTBOUND.name(), profilerType),
|
||||
Opcode.ALOAD(4),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V"),
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.PACKET_OUTBOUND.name(), profilerType), Opcode.ALOAD(4),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V"), };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-4
@@ -4,6 +4,7 @@ import mcp.mobius.mobiuscore.asm.ObfTable;
|
||||
import mcp.mobius.mobiuscore.asm.Opcode;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
@@ -23,10 +24,8 @@ public class TransformerFMLProxyPacket extends TransformerBase {
|
||||
FMLPP_PROCESS = ObfTable.FMLPP_PROCESSPACKET.getFullDescriptor();
|
||||
|
||||
FMLPP_PROCESS_PAYLOAD = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.PACKET_INBOUND.name(), profilerType),
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V"),
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.PACKET_INBOUND.name(), profilerType), Opcode.ALOAD(0),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V"), };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+33
-23
@@ -3,6 +3,7 @@ package mcp.mobius.mobiuscore.asm.transformers.common;
|
||||
import mcp.mobius.mobiuscore.asm.ObfTable;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
@@ -26,31 +27,40 @@ public class TransformerMessageDeserializer extends TransformerBase {
|
||||
|
||||
DESERIALIZER_DECODE = ObfTable.DESERIALIZER_DECODE.getFullDescriptor();
|
||||
|
||||
DESERIALIZER_PATTERN = new AbstractInsnNode[] {
|
||||
new VarInsnNode(Opcodes.ALOAD, -1),
|
||||
new VarInsnNode(Opcodes.ALOAD, -1),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKEVIRTUAL,
|
||||
ObfTable.PACKET_READPACKETDATA.getClazz(),
|
||||
ObfTable.PACKET_READPACKETDATA.getName(),
|
||||
ObfTable.PACKET_READPACKETDATA.getDescriptor(),
|
||||
false),
|
||||
};
|
||||
DESERIALIZER_PATTERN = new AbstractInsnNode[] { new VarInsnNode(Opcodes.ALOAD, -1),
|
||||
new VarInsnNode(Opcodes.ALOAD, -1),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKEVIRTUAL,
|
||||
ObfTable.PACKET_READPACKETDATA.getClazz(),
|
||||
ObfTable.PACKET_READPACKETDATA.getName(),
|
||||
ObfTable.PACKET_READPACKETDATA.getDescriptor(),
|
||||
false), };
|
||||
|
||||
DESERIALIZER_PAYLOAD = new AbstractInsnNode[] {
|
||||
new FieldInsnNode(Opcodes.GETSTATIC, profilerClass, ProfilerSection.PACKET_INBOUND.name(), profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 7),
|
||||
new VarInsnNode(Opcodes.ALOAD, 5),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKEVIRTUAL,
|
||||
ObfTable.PACKETBUFFER_CAPACITY.getClazz(),
|
||||
ObfTable.PACKETBUFFER_CAPACITY.getName(),
|
||||
ObfTable.PACKETBUFFER_CAPACITY.getDescriptor(),
|
||||
false),
|
||||
new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKEVIRTUAL, profilerClass, "start", "(Ljava/lang/Object;Ljava/lang/Object;)V", false),
|
||||
};
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETSTATIC,
|
||||
profilerClass,
|
||||
ProfilerSection.PACKET_INBOUND.name(),
|
||||
profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 7), new VarInsnNode(Opcodes.ALOAD, 5),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKEVIRTUAL,
|
||||
ObfTable.PACKETBUFFER_CAPACITY.getClazz(),
|
||||
ObfTable.PACKETBUFFER_CAPACITY.getName(),
|
||||
ObfTable.PACKETBUFFER_CAPACITY.getDescriptor(),
|
||||
false),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"java/lang/Integer",
|
||||
"valueOf",
|
||||
"(I)Ljava/lang/Integer;",
|
||||
false),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKEVIRTUAL,
|
||||
profilerClass,
|
||||
"start",
|
||||
"(Ljava/lang/Object;Ljava/lang/Object;)V",
|
||||
false), };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+33
-23
@@ -3,6 +3,7 @@ package mcp.mobius.mobiuscore.asm.transformers.common;
|
||||
import mcp.mobius.mobiuscore.asm.ObfTable;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
@@ -26,31 +27,40 @@ public class TransformerMessageSerializer extends TransformerBase {
|
||||
|
||||
SERIALIZER_ENCODE = ObfTable.SERIALIZER_ENCODE.getFullDescriptor();
|
||||
|
||||
SERIALIZER_PATTERN = new AbstractInsnNode[] {
|
||||
new VarInsnNode(Opcodes.ALOAD, -1),
|
||||
new VarInsnNode(Opcodes.ALOAD, -1),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKEVIRTUAL,
|
||||
ObfTable.PACKET_WRITEPACKETDATA.getClazz(),
|
||||
ObfTable.PACKET_WRITEPACKETDATA.getName(),
|
||||
ObfTable.PACKET_WRITEPACKETDATA.getDescriptor(),
|
||||
false)
|
||||
};
|
||||
SERIALIZER_PATTERN = new AbstractInsnNode[] { new VarInsnNode(Opcodes.ALOAD, -1),
|
||||
new VarInsnNode(Opcodes.ALOAD, -1),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKEVIRTUAL,
|
||||
ObfTable.PACKET_WRITEPACKETDATA.getClazz(),
|
||||
ObfTable.PACKET_WRITEPACKETDATA.getName(),
|
||||
ObfTable.PACKET_WRITEPACKETDATA.getDescriptor(),
|
||||
false) };
|
||||
|
||||
SERIALIZER_PAYLOAD = new AbstractInsnNode[] {
|
||||
new FieldInsnNode(Opcodes.GETSTATIC, profilerClass, ProfilerSection.PACKET_OUTBOUND.name(), profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 2),
|
||||
new VarInsnNode(Opcodes.ALOAD, 5),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKEVIRTUAL,
|
||||
ObfTable.PACKETBUFFER_READABLE.getClazz(),
|
||||
ObfTable.PACKETBUFFER_READABLE.getName(),
|
||||
ObfTable.PACKETBUFFER_READABLE.getDescriptor(),
|
||||
false),
|
||||
new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKEVIRTUAL, profilerClass, "start", "(Ljava/lang/Object;Ljava/lang/Object;)V", false),
|
||||
};
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETSTATIC,
|
||||
profilerClass,
|
||||
ProfilerSection.PACKET_OUTBOUND.name(),
|
||||
profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 2), new VarInsnNode(Opcodes.ALOAD, 5),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKEVIRTUAL,
|
||||
ObfTable.PACKETBUFFER_READABLE.getClazz(),
|
||||
ObfTable.PACKETBUFFER_READABLE.getName(),
|
||||
ObfTable.PACKETBUFFER_READABLE.getDescriptor(),
|
||||
false),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"java/lang/Integer",
|
||||
"valueOf",
|
||||
"(I)Ljava/lang/Integer;",
|
||||
false),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKEVIRTUAL,
|
||||
profilerClass,
|
||||
"start",
|
||||
"(Ljava/lang/Object;Ljava/lang/Object;)V",
|
||||
false), };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+12
-13
@@ -3,6 +3,7 @@ package mcp.mobius.mobiuscore.asm.transformers.common;
|
||||
import mcp.mobius.mobiuscore.asm.ObfTable;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
@@ -26,22 +27,20 @@ public class TransformerRenderManager extends TransformerBase {
|
||||
String profilerClass = ProfilerSection.getClassName();
|
||||
String profilerType = ProfilerSection.getTypeName();
|
||||
|
||||
// RM_RENDERENT = ObfTable.RENDERMANAGER_RENDERENTITY.getFullDescriptor();
|
||||
// RM_RENDERENT = ObfTable.RENDERMANAGER_RENDERENTITY.getFullDescriptor();
|
||||
// RM_RENDERPOSYAW = ObfTable.RENDERMANAGER_RENDERPOSYAW.getFullDescriptor();
|
||||
|
||||
RM_RENDER = ObfTable.RENDERMANAGER_RENDER.getFullDescriptor();
|
||||
|
||||
RM_RENDER_PAYLOAD_TOP = new AbstractInsnNode[] {
|
||||
new FieldInsnNode(Opcodes.GETSTATIC, profilerClass, ProfilerSection.RENDER_ENTITY.name(), profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 1),
|
||||
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, profilerClass, "start", "(Ljava/lang/Object;)V", false)
|
||||
};
|
||||
new FieldInsnNode(Opcodes.GETSTATIC, profilerClass, ProfilerSection.RENDER_ENTITY.name(), profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 1),
|
||||
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, profilerClass, "start", "(Ljava/lang/Object;)V", false) };
|
||||
|
||||
RM_RENDER_PAYLOAD_BOTTOM = new AbstractInsnNode[] {
|
||||
new FieldInsnNode(Opcodes.GETSTATIC, profilerClass, ProfilerSection.RENDER_ENTITY.name(), profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 1),
|
||||
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, profilerClass, "stop", "(Ljava/lang/Object;)V", false)
|
||||
};
|
||||
new FieldInsnNode(Opcodes.GETSTATIC, profilerClass, ProfilerSection.RENDER_ENTITY.name(), profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 1),
|
||||
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, profilerClass, "stop", "(Ljava/lang/Object;)V", false) };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,10 +58,10 @@ public class TransformerRenderManager extends TransformerBase {
|
||||
this.applyPayloadLast(renderEntNode, RM_RENDER_PAYLOAD_BOTTOM);
|
||||
|
||||
/*
|
||||
MethodNode renderPosYawNode = this.getMethod(classNode, RM_RENDERPOSYAW);
|
||||
this.applyPayloadFirst(renderPosYawNode, RM_RENDER_PAYLOAD_TOP);
|
||||
this.applyPayloadLast (renderPosYawNode, RM_RENDER_PAYLOAD_BOTTOM);
|
||||
*/
|
||||
* MethodNode renderPosYawNode = this.getMethod(classNode, RM_RENDERPOSYAW);
|
||||
* this.applyPayloadFirst(renderPosYawNode, RM_RENDER_PAYLOAD_TOP); this.applyPayloadLast (renderPosYawNode,
|
||||
* RM_RENDER_PAYLOAD_BOTTOM);
|
||||
*/
|
||||
|
||||
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
classNode.accept(writer);
|
||||
|
||||
+15
-8
@@ -3,6 +3,7 @@ package mcp.mobius.mobiuscore.asm.transformers.common;
|
||||
import mcp.mobius.mobiuscore.asm.ObfTable;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
@@ -28,16 +29,22 @@ public class TransformerTERenderer extends TransformerBase {
|
||||
TER_RENDER = ObfTable.TERENDER_RENDERAT.getFullDescriptor();
|
||||
|
||||
TER_RENDER_PAYLOAD_TOP = new AbstractInsnNode[] {
|
||||
new FieldInsnNode(Opcodes.GETSTATIC, profilerClass, ProfilerSection.RENDER_TILEENTITY.name(), profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 1),
|
||||
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, profilerClass, "start", "(Ljava/lang/Object;)V", false)
|
||||
};
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETSTATIC,
|
||||
profilerClass,
|
||||
ProfilerSection.RENDER_TILEENTITY.name(),
|
||||
profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 1),
|
||||
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, profilerClass, "start", "(Ljava/lang/Object;)V", false) };
|
||||
|
||||
TER_RENDER_PAYLOAD_BOTTOM = new AbstractInsnNode[] {
|
||||
new FieldInsnNode(Opcodes.GETSTATIC, profilerClass, ProfilerSection.RENDER_TILEENTITY.name(), profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 1),
|
||||
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, profilerClass, "stop", "(Ljava/lang/Object;)V", false)
|
||||
};
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETSTATIC,
|
||||
profilerClass,
|
||||
ProfilerSection.RENDER_TILEENTITY.name(),
|
||||
profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 1),
|
||||
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, profilerClass, "stop", "(Ljava/lang/Object;)V", false) };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+55
-41
@@ -3,6 +3,7 @@ package mcp.mobius.mobiuscore.asm.transformers.common;
|
||||
import mcp.mobius.mobiuscore.asm.ObfTable;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
@@ -27,51 +28,64 @@ public class TransformerWorldServer extends TransformerBase {
|
||||
WORLDSERVER_TICK = ObfTable.WORLDSERVER_TICK.getFullDescriptor();
|
||||
|
||||
/*
|
||||
WORLDSERVER_PAYLOAD_TICKSTART = new AbstractInsnNode[]
|
||||
{
|
||||
new FieldInsnNode (Opcodes.GETSTATIC, "mcp/mobius/mobiuscore/profiler/ProfilerRegistrar", "profilerWorldTick", "Lmcp/mobius/mobiuscore/profiler/IProfilerWorldTick;"),
|
||||
new VarInsnNode (Opcodes.ALOAD, 0),
|
||||
new FieldInsnNode (Opcodes.GETFIELD, "net/minecraft/world/WorldServer", "provider", "Lnet/minecraft/world/WorldProvider;"),
|
||||
new FieldInsnNode (Opcodes.GETFIELD, "net/minecraft/world/WorldProvider", "dimensionId", "I"),
|
||||
new MethodInsnNode(Opcodes.INVOKEINTERFACE, "mcp/mobius/mobiuscore/profiler/IProfilerWorldTick", "WorldTickStart", "(I)V"),
|
||||
};
|
||||
*/
|
||||
* WORLDSERVER_PAYLOAD_TICKSTART = new AbstractInsnNode[] { new FieldInsnNode (Opcodes.GETSTATIC,
|
||||
* "mcp/mobius/mobiuscore/profiler/ProfilerRegistrar", "profilerWorldTick",
|
||||
* "Lmcp/mobius/mobiuscore/profiler/IProfilerWorldTick;"), new VarInsnNode (Opcodes.ALOAD, 0), new FieldInsnNode
|
||||
* (Opcodes.GETFIELD, "net/minecraft/world/WorldServer", "provider", "Lnet/minecraft/world/WorldProvider;"), new
|
||||
* FieldInsnNode (Opcodes.GETFIELD, "net/minecraft/world/WorldProvider", "dimensionId", "I"), new
|
||||
* MethodInsnNode(Opcodes.INVOKEINTERFACE, "mcp/mobius/mobiuscore/profiler/IProfilerWorldTick",
|
||||
* "WorldTickStart", "(I)V"), };
|
||||
*/
|
||||
|
||||
WORLDSERVER_PAYLOAD_TICKSTART = new AbstractInsnNode[] {
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETSTATIC, profilerClass, ProfilerSection.DIMENSION_BLOCKTICK.name(), profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 0),
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETFIELD,
|
||||
ObfTable.WORLD_PROVIDER.getClazz(),
|
||||
ObfTable.WORLD_PROVIDER.getName(),
|
||||
ObfTable.WORLD_PROVIDER.getDescriptor()),
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETFIELD,
|
||||
ObfTable.WORLDPROVIDER_DIMID.getClazz(),
|
||||
ObfTable.WORLDPROVIDER_DIMID.getName(),
|
||||
ObfTable.WORLDPROVIDER_DIMID.getDescriptor()),
|
||||
new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false),
|
||||
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, profilerClass, "start", "(Ljava/lang/Object;)V", false),
|
||||
};
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETSTATIC,
|
||||
profilerClass,
|
||||
ProfilerSection.DIMENSION_BLOCKTICK.name(),
|
||||
profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 0),
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETFIELD,
|
||||
ObfTable.WORLD_PROVIDER.getClazz(),
|
||||
ObfTable.WORLD_PROVIDER.getName(),
|
||||
ObfTable.WORLD_PROVIDER.getDescriptor()),
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETFIELD,
|
||||
ObfTable.WORLDPROVIDER_DIMID.getClazz(),
|
||||
ObfTable.WORLDPROVIDER_DIMID.getName(),
|
||||
ObfTable.WORLDPROVIDER_DIMID.getDescriptor()),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"java/lang/Integer",
|
||||
"valueOf",
|
||||
"(I)Ljava/lang/Integer;",
|
||||
false),
|
||||
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, profilerClass, "start", "(Ljava/lang/Object;)V", false), };
|
||||
|
||||
WORLDSERVER_PAYLOAD_TICKEND = new AbstractInsnNode[] {
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETSTATIC, profilerClass, ProfilerSection.DIMENSION_BLOCKTICK.name(), profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 0),
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETFIELD,
|
||||
ObfTable.WORLD_PROVIDER.getClazz(),
|
||||
ObfTable.WORLD_PROVIDER.getName(),
|
||||
ObfTable.WORLD_PROVIDER.getDescriptor()),
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETFIELD,
|
||||
ObfTable.WORLDPROVIDER_DIMID.getClazz(),
|
||||
ObfTable.WORLDPROVIDER_DIMID.getName(),
|
||||
ObfTable.WORLDPROVIDER_DIMID.getDescriptor()),
|
||||
new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false),
|
||||
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, profilerClass, "stop", "(Ljava/lang/Object;)V", false),
|
||||
};
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETSTATIC,
|
||||
profilerClass,
|
||||
ProfilerSection.DIMENSION_BLOCKTICK.name(),
|
||||
profilerType),
|
||||
new VarInsnNode(Opcodes.ALOAD, 0),
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETFIELD,
|
||||
ObfTable.WORLD_PROVIDER.getClazz(),
|
||||
ObfTable.WORLD_PROVIDER.getName(),
|
||||
ObfTable.WORLD_PROVIDER.getDescriptor()),
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETFIELD,
|
||||
ObfTable.WORLDPROVIDER_DIMID.getClazz(),
|
||||
ObfTable.WORLDPROVIDER_DIMID.getName(),
|
||||
ObfTable.WORLDPROVIDER_DIMID.getDescriptor()),
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"java/lang/Integer",
|
||||
"valueOf",
|
||||
"(I)Ljava/lang/Integer;",
|
||||
false),
|
||||
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, profilerClass, "stop", "(Ljava/lang/Object;)V", false), };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+52
-74
@@ -5,6 +5,7 @@ import mcp.mobius.mobiuscore.asm.ObfTable;
|
||||
import mcp.mobius.mobiuscore.asm.Opcode;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.*;
|
||||
@@ -51,92 +52,67 @@ public class TransformerWorldCrucible extends TransformerBase {
|
||||
WORLD_UPDATEENTITIES = ObfTable.WORLD_UPDATEENTITIES.getFullDescriptor(); // updateEntities.getFullDescriptor();
|
||||
WORLD_INIT = ObfTable.WORLD_INIT.getFullDescriptor();
|
||||
|
||||
WORLD_UPDATE_PATTERN_TEUPDATE = new AbstractInsnNode[] {
|
||||
new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getClazz(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getName(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getDescriptor())
|
||||
};
|
||||
WORLD_UPDATE_PATTERN_TEUPDATE = new AbstractInsnNode[] { new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getClazz(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getName(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getDescriptor()) };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_START_TEUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(9),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(9), Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_STOP_TEUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(9),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(9), Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE = new AbstractInsnNode[] {
|
||||
new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.WORLD_UPDATEENTITY.getClazz(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getName(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getDescriptor())
|
||||
};
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE = new AbstractInsnNode[] { new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1), Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.WORLD_UPDATEENTITY.getClazz(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getName(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getDescriptor()) };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_START_ENTUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2), Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_STOP_ENTUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2), Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_PATTERN_LOADEDENTS = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("io/github/crucible/util/HashedArrayList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("io/github/crucible/util/HashedArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor())
|
||||
};
|
||||
WORLD_PATTERN_LOADEDENTS = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("io/github/crucible/util/HashedArrayList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("io/github/crucible/util/HashedArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor()) };
|
||||
|
||||
WORLD_PATTERN_LOADEDTILES = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("io/github/crucible/util/HashedArrayList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("io/github/crucible/util/HashedArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor())
|
||||
};
|
||||
WORLD_PATTERN_LOADEDTILES = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("io/github/crucible/util/HashedArrayList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("io/github/crucible/util/HashedArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor()) };
|
||||
|
||||
WORLD_PAYLOAD_LOADEDENTS = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredEntityList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredEntityList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor())
|
||||
};
|
||||
WORLD_PAYLOAD_LOADEDENTS = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredEntityList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredEntityList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor()) };
|
||||
|
||||
WORLD_PAYLOAD_LOADEDTILES = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredTileList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredTileList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor())
|
||||
};
|
||||
WORLD_PAYLOAD_LOADEDTILES = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredTileList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredTileList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor()) };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,7 +131,9 @@ public class TransformerWorldCrucible extends TransformerBase {
|
||||
this.applyPayloadAfter(updateEntitiesNode, WORLD_UPDATE_PATTERN_TEUPDATE, WORLD_UPDATE_PAYLOAD_STOP_TEUPDATE);
|
||||
|
||||
this.applyPayloadBefore(
|
||||
updateEntitiesNode, WORLD_UPDATE_PATTERN_ENTUPDATE, WORLD_UPDATE_PAYLOAD_START_ENTUPDATE);
|
||||
updateEntitiesNode,
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE,
|
||||
WORLD_UPDATE_PAYLOAD_START_ENTUPDATE);
|
||||
this.applyPayloadAfter(updateEntitiesNode, WORLD_UPDATE_PATTERN_ENTUPDATE, WORLD_UPDATE_PAYLOAD_STOP_ENTUPDATE);
|
||||
|
||||
MethodNode initNode = this.getMethod(classNode, WORLD_INIT);
|
||||
|
||||
@@ -5,6 +5,7 @@ import mcp.mobius.mobiuscore.asm.ObfTable;
|
||||
import mcp.mobius.mobiuscore.asm.Opcode;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
@@ -55,92 +56,65 @@ public class TransformerWorld extends TransformerBase {
|
||||
WORLD_UPDATEENTITIES = ObfTable.WORLD_UPDATEENTITIES.getFullDescriptor(); // updateEntities.getFullDescriptor();
|
||||
WORLD_INIT = ObfTable.WORLD_INIT.getFullDescriptor();
|
||||
|
||||
WORLD_UPDATE_PATTERN_TEUPDATE = new AbstractInsnNode[] {
|
||||
new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getClazz(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getName(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getDescriptor())
|
||||
};
|
||||
WORLD_UPDATE_PATTERN_TEUPDATE = new AbstractInsnNode[] { new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getClazz(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getName(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getDescriptor()) };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_START_TEUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(8),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(8), Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_STOP_TEUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(8),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(8), Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE = new AbstractInsnNode[] {
|
||||
new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.WORLD_UPDATEENTITY.getClazz(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getName(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getDescriptor())
|
||||
};
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE = new AbstractInsnNode[] { new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1), Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.WORLD_UPDATEENTITY.getClazz(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getName(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getDescriptor()) };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_START_ENTUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2), Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_STOP_ENTUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2), Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_PATTERN_LOADEDENTS = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("java/util/ArrayList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("java/util/ArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor())
|
||||
};
|
||||
WORLD_PATTERN_LOADEDENTS = new AbstractInsnNode[] { Opcode.ALOAD(0), Opcode.NEW("java/util/ArrayList"),
|
||||
Opcode.DUP(), Opcode.INVOKESPECIAL("java/util/ArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor()) };
|
||||
|
||||
WORLD_PATTERN_LOADEDTILES = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("java/util/ArrayList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("java/util/ArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor())
|
||||
};
|
||||
WORLD_PATTERN_LOADEDTILES = new AbstractInsnNode[] { Opcode.ALOAD(0), Opcode.NEW("java/util/ArrayList"),
|
||||
Opcode.DUP(), Opcode.INVOKESPECIAL("java/util/ArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor()) };
|
||||
|
||||
WORLD_PAYLOAD_LOADEDENTS = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredEntityList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredEntityList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor())
|
||||
};
|
||||
WORLD_PAYLOAD_LOADEDENTS = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredEntityList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredEntityList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor()) };
|
||||
|
||||
WORLD_PAYLOAD_LOADEDTILES = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredTileList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredTileList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor())
|
||||
};
|
||||
WORLD_PAYLOAD_LOADEDTILES = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredTileList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredTileList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor()) };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -159,7 +133,9 @@ public class TransformerWorld extends TransformerBase {
|
||||
this.applyPayloadAfter(updateEntitiesNode, WORLD_UPDATE_PATTERN_TEUPDATE, WORLD_UPDATE_PAYLOAD_STOP_TEUPDATE);
|
||||
|
||||
this.applyPayloadBefore(
|
||||
updateEntitiesNode, WORLD_UPDATE_PATTERN_ENTUPDATE, WORLD_UPDATE_PAYLOAD_START_ENTUPDATE);
|
||||
updateEntitiesNode,
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE,
|
||||
WORLD_UPDATE_PAYLOAD_START_ENTUPDATE);
|
||||
this.applyPayloadAfter(updateEntitiesNode, WORLD_UPDATE_PATTERN_ENTUPDATE, WORLD_UPDATE_PAYLOAD_STOP_ENTUPDATE);
|
||||
|
||||
MethodNode initNode = this.getMethod(classNode, WORLD_INIT);
|
||||
|
||||
+50
-74
@@ -5,6 +5,7 @@ import mcp.mobius.mobiuscore.asm.ObfTable;
|
||||
import mcp.mobius.mobiuscore.asm.Opcode;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.*;
|
||||
@@ -51,92 +52,65 @@ public class TransformerWorldKCauldron extends TransformerBase {
|
||||
WORLD_UPDATEENTITIES = ObfTable.WORLD_UPDATEENTITIES.getFullDescriptor(); // updateEntities.getFullDescriptor();
|
||||
WORLD_INIT = ObfTable.WORLD_INIT.getFullDescriptor();
|
||||
|
||||
WORLD_UPDATE_PATTERN_TEUPDATE = new AbstractInsnNode[] {
|
||||
new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getClazz(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getName(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getDescriptor())
|
||||
};
|
||||
WORLD_UPDATE_PATTERN_TEUPDATE = new AbstractInsnNode[] { new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getClazz(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getName(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getDescriptor()) };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_START_TEUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(9),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(9), Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_STOP_TEUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(9),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(9), Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE = new AbstractInsnNode[] {
|
||||
new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.WORLD_UPDATEENTITY.getClazz(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getName(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getDescriptor())
|
||||
};
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE = new AbstractInsnNode[] { new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1), Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.WORLD_UPDATEENTITY.getClazz(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getName(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getDescriptor()) };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_START_ENTUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2), Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_STOP_ENTUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2), Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_PATTERN_LOADEDENTS = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("java/util/ArrayList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("java/util/ArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor())
|
||||
};
|
||||
WORLD_PATTERN_LOADEDENTS = new AbstractInsnNode[] { Opcode.ALOAD(0), Opcode.NEW("java/util/ArrayList"),
|
||||
Opcode.DUP(), Opcode.INVOKESPECIAL("java/util/ArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor()) };
|
||||
|
||||
WORLD_PATTERN_LOADEDTILES = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("java/util/ArrayList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("java/util/ArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor())
|
||||
};
|
||||
WORLD_PATTERN_LOADEDTILES = new AbstractInsnNode[] { Opcode.ALOAD(0), Opcode.NEW("java/util/ArrayList"),
|
||||
Opcode.DUP(), Opcode.INVOKESPECIAL("java/util/ArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor()) };
|
||||
|
||||
WORLD_PAYLOAD_LOADEDENTS = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredEntityList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredEntityList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor())
|
||||
};
|
||||
WORLD_PAYLOAD_LOADEDENTS = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredEntityList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredEntityList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor()) };
|
||||
|
||||
WORLD_PAYLOAD_LOADEDTILES = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredTileList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredTileList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor())
|
||||
};
|
||||
WORLD_PAYLOAD_LOADEDTILES = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredTileList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredTileList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor()) };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,7 +129,9 @@ public class TransformerWorldKCauldron extends TransformerBase {
|
||||
this.applyPayloadAfter(updateEntitiesNode, WORLD_UPDATE_PATTERN_TEUPDATE, WORLD_UPDATE_PAYLOAD_STOP_TEUPDATE);
|
||||
|
||||
this.applyPayloadBefore(
|
||||
updateEntitiesNode, WORLD_UPDATE_PATTERN_ENTUPDATE, WORLD_UPDATE_PAYLOAD_START_ENTUPDATE);
|
||||
updateEntitiesNode,
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE,
|
||||
WORLD_UPDATE_PAYLOAD_START_ENTUPDATE);
|
||||
this.applyPayloadAfter(updateEntitiesNode, WORLD_UPDATE_PATTERN_ENTUPDATE, WORLD_UPDATE_PAYLOAD_STOP_ENTUPDATE);
|
||||
|
||||
MethodNode initNode = this.getMethod(classNode, WORLD_INIT);
|
||||
|
||||
+50
-74
@@ -5,6 +5,7 @@ import mcp.mobius.mobiuscore.asm.ObfTable;
|
||||
import mcp.mobius.mobiuscore.asm.Opcode;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
@@ -55,92 +56,65 @@ public class TransformerWorldCauldron extends TransformerBase {
|
||||
WORLD_UPDATEENTITIES = ObfTable.WORLD_UPDATEENTITIES.getFullDescriptor(); // updateEntities.getFullDescriptor();
|
||||
WORLD_INIT = ObfTable.WORLD_INIT.getFullDescriptor();
|
||||
|
||||
WORLD_UPDATE_PATTERN_TEUPDATE = new AbstractInsnNode[] {
|
||||
new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getClazz(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getName(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getDescriptor())
|
||||
};
|
||||
WORLD_UPDATE_PATTERN_TEUPDATE = new AbstractInsnNode[] { new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getClazz(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getName(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getDescriptor()) };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_START_TEUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(8),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(8), Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_STOP_TEUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(8),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(8), Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE = new AbstractInsnNode[] {
|
||||
new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.WORLD_UPDATEENTITY.getClazz(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getName(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getDescriptor())
|
||||
};
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE = new AbstractInsnNode[] { new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1), Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.WORLD_UPDATEENTITY.getClazz(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getName(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getDescriptor()) };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_START_ENTUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2), Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_STOP_ENTUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2), Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_PATTERN_LOADEDENTS = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("java/util/ArrayList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("java/util/ArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor())
|
||||
};
|
||||
WORLD_PATTERN_LOADEDENTS = new AbstractInsnNode[] { Opcode.ALOAD(0), Opcode.NEW("java/util/ArrayList"),
|
||||
Opcode.DUP(), Opcode.INVOKESPECIAL("java/util/ArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor()) };
|
||||
|
||||
WORLD_PATTERN_LOADEDTILES = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("java/util/ArrayList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("java/util/ArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor())
|
||||
};
|
||||
WORLD_PATTERN_LOADEDTILES = new AbstractInsnNode[] { Opcode.ALOAD(0), Opcode.NEW("java/util/ArrayList"),
|
||||
Opcode.DUP(), Opcode.INVOKESPECIAL("java/util/ArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor()) };
|
||||
|
||||
WORLD_PAYLOAD_LOADEDENTS = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredEntityList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredEntityList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor())
|
||||
};
|
||||
WORLD_PAYLOAD_LOADEDENTS = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredEntityList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredEntityList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor()) };
|
||||
|
||||
WORLD_PAYLOAD_LOADEDTILES = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredTileList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredTileList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor())
|
||||
};
|
||||
WORLD_PAYLOAD_LOADEDTILES = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredTileList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredTileList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor()) };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -159,7 +133,9 @@ public class TransformerWorldCauldron extends TransformerBase {
|
||||
this.applyPayloadAfter(updateEntitiesNode, WORLD_UPDATE_PATTERN_TEUPDATE, WORLD_UPDATE_PAYLOAD_STOP_TEUPDATE);
|
||||
|
||||
this.applyPayloadBefore(
|
||||
updateEntitiesNode, WORLD_UPDATE_PATTERN_ENTUPDATE, WORLD_UPDATE_PAYLOAD_START_ENTUPDATE);
|
||||
updateEntitiesNode,
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE,
|
||||
WORLD_UPDATE_PAYLOAD_START_ENTUPDATE);
|
||||
this.applyPayloadAfter(updateEntitiesNode, WORLD_UPDATE_PATTERN_ENTUPDATE, WORLD_UPDATE_PAYLOAD_STOP_ENTUPDATE);
|
||||
|
||||
MethodNode initNode = this.getMethod(classNode, WORLD_INIT);
|
||||
|
||||
+52
-74
@@ -5,6 +5,7 @@ import mcp.mobius.mobiuscore.asm.ObfTable;
|
||||
import mcp.mobius.mobiuscore.asm.Opcode;
|
||||
import mcp.mobius.mobiuscore.asm.transformers.TransformerBase;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.*;
|
||||
@@ -51,92 +52,67 @@ public class TransformerWorldThermos extends TransformerBase {
|
||||
WORLD_UPDATEENTITIES = ObfTable.WORLD_UPDATEENTITIES.getFullDescriptor(); // updateEntities.getFullDescriptor();
|
||||
WORLD_INIT = ObfTable.WORLD_INIT.getFullDescriptor();
|
||||
|
||||
WORLD_UPDATE_PATTERN_TEUPDATE = new AbstractInsnNode[] {
|
||||
new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getClazz(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getName(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getDescriptor())
|
||||
};
|
||||
WORLD_UPDATE_PATTERN_TEUPDATE = new AbstractInsnNode[] { new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getClazz(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getName(),
|
||||
ObfTable.TILEENTITY_UPDATEENTITY.getDescriptor()) };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_START_TEUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(9),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(9), Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_STOP_TEUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(9),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.TILEENT_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(9), Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE = new AbstractInsnNode[] {
|
||||
new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.WORLD_UPDATEENTITY.getClazz(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getName(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getDescriptor())
|
||||
};
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE = new AbstractInsnNode[] { new LineNumberNode(-1, new LabelNode()),
|
||||
Opcode.ALOAD(-1), Opcode.ALOAD(-1),
|
||||
Opcode.INVOKEVIRTUAL(
|
||||
ObfTable.WORLD_UPDATEENTITY.getClazz(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getName(),
|
||||
ObfTable.WORLD_UPDATEENTITY.getDescriptor()) };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_START_ENTUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2), Opcode.INVOKEVIRTUAL(profilerClass, "start", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_UPDATE_PAYLOAD_STOP_ENTUPDATE = new AbstractInsnNode[] {
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2),
|
||||
Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V")
|
||||
};
|
||||
Opcode.GETSTATIC(profilerClass, ProfilerSection.ENTITY_UPDATETIME.name(), profilerType),
|
||||
Opcode.ALOAD(2), Opcode.INVOKEVIRTUAL(profilerClass, "stop", "(Ljava/lang/Object;)V") };
|
||||
|
||||
WORLD_PATTERN_LOADEDENTS = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("thermos/chaud/HashedArrayList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("thermos/chaud/HashedArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor())
|
||||
};
|
||||
WORLD_PATTERN_LOADEDENTS = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("thermos/chaud/HashedArrayList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("thermos/chaud/HashedArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor()) };
|
||||
|
||||
WORLD_PATTERN_LOADEDTILES = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("thermos/chaud/HashedArrayList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("thermos/chaud/HashedArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor())
|
||||
};
|
||||
WORLD_PATTERN_LOADEDTILES = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("thermos/chaud/HashedArrayList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("thermos/chaud/HashedArrayList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor()) };
|
||||
|
||||
WORLD_PAYLOAD_LOADEDENTS = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredEntityList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredEntityList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor())
|
||||
};
|
||||
WORLD_PAYLOAD_LOADEDENTS = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredEntityList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredEntityList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDENTS.getClazz(),
|
||||
ObfTable.WORLD_LOADEDENTS.getName(),
|
||||
ObfTable.WORLD_LOADEDENTS.getDescriptor()) };
|
||||
|
||||
WORLD_PAYLOAD_LOADEDTILES = new AbstractInsnNode[] {
|
||||
Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredTileList"),
|
||||
Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredTileList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor())
|
||||
};
|
||||
WORLD_PAYLOAD_LOADEDTILES = new AbstractInsnNode[] { Opcode.ALOAD(0),
|
||||
Opcode.NEW("mcp/mobius/mobiuscore/monitors/MonitoredTileList"), Opcode.DUP(),
|
||||
Opcode.INVOKESPECIAL("mcp/mobius/mobiuscore/monitors/MonitoredTileList", "<init>", "()V"),
|
||||
Opcode.PUTFIELD(
|
||||
ObfTable.WORLD_LOADEDTILES.getClazz(),
|
||||
ObfTable.WORLD_LOADEDTILES.getName(),
|
||||
ObfTable.WORLD_LOADEDTILES.getDescriptor()) };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,7 +131,9 @@ public class TransformerWorldThermos extends TransformerBase {
|
||||
this.applyPayloadAfter(updateEntitiesNode, WORLD_UPDATE_PATTERN_TEUPDATE, WORLD_UPDATE_PAYLOAD_STOP_TEUPDATE);
|
||||
|
||||
this.applyPayloadBefore(
|
||||
updateEntitiesNode, WORLD_UPDATE_PATTERN_ENTUPDATE, WORLD_UPDATE_PAYLOAD_START_ENTUPDATE);
|
||||
updateEntitiesNode,
|
||||
WORLD_UPDATE_PATTERN_ENTUPDATE,
|
||||
WORLD_UPDATE_PAYLOAD_START_ENTUPDATE);
|
||||
this.applyPayloadAfter(updateEntitiesNode, WORLD_UPDATE_PATTERN_ENTUPDATE, WORLD_UPDATE_PAYLOAD_STOP_ENTUPDATE);
|
||||
|
||||
MethodNode initNode = this.getMethod(classNode, WORLD_INIT);
|
||||
|
||||
@@ -2,7 +2,9 @@ package mcp.mobius.mobiuscore.monitors;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mcp.mobius.mobiuscore.asm.CoreDescription;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class MonitoredEntityList<E> extends MonitoredList<E> {
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package mcp.mobius.mobiuscore.monitors;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import mcp.mobius.mobiuscore.asm.CoreDescription;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import com.google.common.collect.HashBasedTable;
|
||||
import com.google.common.collect.Table;
|
||||
import com.google.common.collect.Table.Cell;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import mcp.mobius.mobiuscore.asm.CoreDescription;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class MonitoredTileList<E> extends MonitoredList<E> {
|
||||
|
||||
@@ -16,6 +19,7 @@ public class MonitoredTileList<E> extends MonitoredList<E> {
|
||||
private Map<Object, BlockData> blockdata = new WeakHashMap<>();
|
||||
|
||||
private static class BlockData {
|
||||
|
||||
public final Block block;
|
||||
public final int meta;
|
||||
|
||||
@@ -57,12 +61,10 @@ public class MonitoredTileList<E> extends MonitoredList<E> {
|
||||
// WITHOUT ACCESSING THE WORLD !!!!
|
||||
|
||||
/*
|
||||
TileEntity te = ((TileEntity)o);
|
||||
if (te == null || te.getWorldObj() == null) return;
|
||||
|
||||
Block block = te.getWorldObj().getBlock(te.xCoord, te.yCoord, te.zCoord);
|
||||
int meta = te.getWorldObj().getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
|
||||
*/
|
||||
* TileEntity te = ((TileEntity)o); if (te == null || te.getWorldObj() == null) return; Block block =
|
||||
* te.getWorldObj().getBlock(te.xCoord, te.yCoord, te.zCoord); int meta =
|
||||
* te.getWorldObj().getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
|
||||
*/
|
||||
|
||||
if (blockdata.containsKey(o)) {
|
||||
BlockData d = blockdata.get(o);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mcp.mobius.mobiuscore.profiler;
|
||||
|
||||
public class DummyProfiler implements IProfilerBase {
|
||||
|
||||
@Override
|
||||
public void reset() {}
|
||||
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
package mcp.mobius.mobiuscore.profiler;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public enum ProfilerSection implements IProfilerBase {
|
||||
|
||||
DIMENSION_TICK(RunType.REALTIME, Side.SERVER), // Global section around the ticks for each dim (Blocks & ents).
|
||||
DIMENSION_BLOCKTICK(RunType.ONREQUEST, Side.SERVER), // Subsection for dimension block tick.
|
||||
ENTITY_UPDATETIME(RunType.ONREQUEST, Side.SERVER), // Profiling of the entity tick time, per entity.
|
||||
TICK(RunType.REALTIME, Side.SERVER), // Tick timing profiling
|
||||
TILEENT_UPDATETIME(RunType.ONREQUEST, Side.SERVER), // Profiling of the TileEntity tick time, per TE.
|
||||
// HANDLER_TICKSTART (RunType.ONREQUEST, EnumSet.of(Side.CLIENT, Side.SERVER)), //Server handler for ServerTick
|
||||
// HANDLER_TICKSTART (RunType.ONREQUEST, EnumSet.of(Side.CLIENT, Side.SERVER)), //Server handler for ServerTick
|
||||
// start.
|
||||
// HANDLER_TICKSTOP (RunType.ONREQUEST, EnumSet.of(Side.CLIENT, Side.SERVER)), //Server handler for ServerTick
|
||||
// HANDLER_TICKSTOP (RunType.ONREQUEST, EnumSet.of(Side.CLIENT, Side.SERVER)), //Server handler for ServerTick
|
||||
// stop.
|
||||
PACKET_INBOUND(RunType.REALTIME, Side.SERVER), // Outbound packet analysis
|
||||
PACKET_OUTBOUND(RunType.REALTIME, Side.SERVER), // Inbound packet analysis
|
||||
// PACKETFML_INBOUND (RunType.REALTIME, Side.SERVER), //Outbound packet analysis
|
||||
// PACKETFML_OUTBOUND (RunType.REALTIME, Side.SERVER), //Inbound packet analysis
|
||||
// PACKETFML_INBOUND (RunType.REALTIME, Side.SERVER), //Outbound packet analysis
|
||||
// PACKETFML_OUTBOUND (RunType.REALTIME, Side.SERVER), //Inbound packet analysis
|
||||
|
||||
NETWORK_TICK(
|
||||
RunType.ONREQUEST, Side.SERVER), // The time it takes for the server to handle the packets during a tick.
|
||||
NETWORK_TICK(RunType.ONREQUEST, Side.SERVER), // The time it takes for the server to handle the packets during a
|
||||
// tick.
|
||||
EVENT_INVOKE(RunType.ONREQUEST, EnumSet.of(Side.CLIENT, Side.SERVER)), // Timing of the event invokation
|
||||
|
||||
RENDER_TILEENTITY(RunType.ONREQUEST, Side.CLIENT), // Profiler for TileEnt rendering
|
||||
@@ -33,10 +35,8 @@ public enum ProfilerSection implements IProfilerBase {
|
||||
|
||||
private EnumSet<Side> sides;
|
||||
private RunType runType;
|
||||
private IProfilerBase profiler = new DummyProfiler();
|
||||
;
|
||||
private IProfilerBase profilerSuspended = new DummyProfiler();
|
||||
;
|
||||
private IProfilerBase profiler = new DummyProfiler();;
|
||||
private IProfilerBase profilerSuspended = new DummyProfiler();;
|
||||
|
||||
public static long timeStampLastRun;
|
||||
|
||||
|
||||
@@ -4,5 +4,6 @@ import mcp.mobius.opis.network.PacketBase;
|
||||
import mcp.mobius.opis.network.enums.Message;
|
||||
|
||||
public interface IMessageHandler {
|
||||
|
||||
public boolean handleMessage(Message msg, PacketBase rawdata);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package mcp.mobius.opis.api;
|
||||
import mcp.mobius.opis.swing.SelectedTab;
|
||||
|
||||
public interface ITabPanel {
|
||||
|
||||
SelectedTab getSelectedTab();
|
||||
|
||||
boolean refreshOnString(); // Should we refresh on a cache update ?
|
||||
|
||||
@@ -2,11 +2,13 @@ package mcp.mobius.opis.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import mcp.mobius.opis.modOpis;
|
||||
import mcp.mobius.opis.network.PacketBase;
|
||||
import mcp.mobius.opis.network.enums.Message;
|
||||
|
||||
public enum MessageHandlerRegistrar {
|
||||
|
||||
INSTANCE;
|
||||
|
||||
private HashMap<Message, HashSet<IMessageHandler>> msgHandlers = new HashMap<Message, HashSet<IMessageHandler>>();
|
||||
|
||||
@@ -2,10 +2,12 @@ package mcp.mobius.opis.api;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialInt;
|
||||
import mcp.mobius.opis.network.PacketManager;
|
||||
import mcp.mobius.opis.network.enums.Message;
|
||||
@@ -14,10 +16,11 @@ import mcp.mobius.opis.swing.SelectedTab;
|
||||
import mcp.mobius.opis.swing.SwingUI;
|
||||
|
||||
public enum TabPanelRegistrar implements ChangeListener {
|
||||
|
||||
INSTANCE;
|
||||
|
||||
// private ArrayList<ITabPanel> panels = new ArrayList<ITabPanel>();
|
||||
// private HashMap<String, ITabPanel> lookup = new HashMap<String, ITabPanel>();
|
||||
// private ArrayList<ITabPanel> panels = new ArrayList<ITabPanel>();
|
||||
// private HashMap<String, ITabPanel> lookup = new HashMap<String, ITabPanel>();
|
||||
private HashMap<String, JTabbedPane> sections = new HashMap<String, JTabbedPane>();
|
||||
private HashMap<SelectedTab, ITabPanel> lookup = new HashMap<SelectedTab, ITabPanel>();
|
||||
|
||||
@@ -63,15 +66,12 @@ public enum TabPanelRegistrar implements ChangeListener {
|
||||
|
||||
if (source instanceof ITabPanel) {
|
||||
ITabPanel panel = (ITabPanel) source;
|
||||
PacketManager.sendToServer(new PacketReqData(
|
||||
Message.SWING_TAB_CHANGED,
|
||||
new SerialInt(panel.getSelectedTab().ordinal())));
|
||||
PacketManager.sendToServer(
|
||||
new PacketReqData(Message.SWING_TAB_CHANGED, new SerialInt(panel.getSelectedTab().ordinal())));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public ArrayList<ITabPanel> getTabs(){
|
||||
return this.panels;
|
||||
}
|
||||
*/
|
||||
* public ArrayList<ITabPanel> getTabs(){ return this.panels; }
|
||||
*/
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package mcp.mobius.opis.commands;
|
||||
|
||||
public interface IOpisCommand {
|
||||
|
||||
String getDescription();
|
||||
|
||||
String getCommandNameOpis();
|
||||
|
||||
@@ -3,6 +3,7 @@ package mcp.mobius.opis.commands.client;
|
||||
import mcp.mobius.opis.network.PacketManager;
|
||||
import mcp.mobius.opis.network.enums.Message;
|
||||
import mcp.mobius.opis.network.packets.server.NetDataCommand;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -21,9 +22,8 @@ public class CommandClientShowRenderTick extends CommandBase {
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender icommandsender, String[] astring) {
|
||||
if (icommandsender instanceof EntityPlayerMP)
|
||||
PacketManager.validateAndSend(
|
||||
new NetDataCommand(Message.CLIENT_SHOW_RENDER_TICK), (EntityPlayerMP) icommandsender);
|
||||
if (icommandsender instanceof EntityPlayerMP) PacketManager
|
||||
.validateAndSend(new NetDataCommand(Message.CLIENT_SHOW_RENDER_TICK), (EntityPlayerMP) icommandsender);
|
||||
// ((EntityPlayerMP)icommandsender).playerNetServerHandler.sendPacketToPlayer(NetDataCommand.create(Message.CLIENT_SHOW_RENDER_TICK));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package mcp.mobius.opis.commands.client;
|
||||
import mcp.mobius.opis.network.PacketManager;
|
||||
import mcp.mobius.opis.network.enums.Message;
|
||||
import mcp.mobius.opis.network.packets.server.NetDataCommand;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -21,9 +22,8 @@ public class CommandClientStart extends CommandBase {
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender icommandsender, String[] astring) {
|
||||
if (icommandsender instanceof EntityPlayerMP)
|
||||
PacketManager.validateAndSend(
|
||||
new NetDataCommand(Message.CLIENT_START_PROFILING), (EntityPlayerMP) icommandsender);
|
||||
if (icommandsender instanceof EntityPlayerMP) PacketManager
|
||||
.validateAndSend(new NetDataCommand(Message.CLIENT_START_PROFILING), (EntityPlayerMP) icommandsender);
|
||||
// ((EntityPlayerMP)icommandsender).playerNetServerHandler.sendPacketToPlayer(NetDataCommand.create(Message.CLIENT_START_PROFILING));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import mcp.mobius.opis.events.PlayerTracker;
|
||||
import mcp.mobius.opis.network.PacketManager;
|
||||
import mcp.mobius.opis.network.enums.Message;
|
||||
import mcp.mobius.opis.network.packets.server.NetDataCommand;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -36,9 +37,8 @@ public class CommandOpis extends CommandBase {
|
||||
|
||||
PlayerTracker.INSTANCE.playersSwing.add((EntityPlayerMP) icommandsender);
|
||||
// ((EntityPlayerMP)icommandsender).playerNetServerHandler.sendPacketToPlayer(NetDataCommand.create(Message.CLIENT_SHOW_SWING));
|
||||
if (icommandsender instanceof EntityPlayerMP)
|
||||
PacketManager.validateAndSend(
|
||||
new NetDataCommand(Message.CLIENT_SHOW_SWING), (EntityPlayerMP) icommandsender);
|
||||
if (icommandsender instanceof EntityPlayerMP) PacketManager
|
||||
.validateAndSend(new NetDataCommand(Message.CLIENT_SHOW_SWING), (EntityPlayerMP) icommandsender);
|
||||
PacketManager.sendFullUpdate((EntityPlayerMP) icommandsender);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package mcp.mobius.opis.commands.server;
|
||||
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.events.PlayerTracker;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -23,8 +24,8 @@ public class CommandAddPrivileged extends CommandBase implements IOpisCommand {
|
||||
@Override
|
||||
public void processCommand(ICommandSender icommandsender, String[] astring) {
|
||||
PlayerTracker.INSTANCE.addPrivilegedPlayer(astring[0]);
|
||||
icommandsender.addChatMessage(
|
||||
new ChatComponentText(String.format("Player %s added to Opis user list", astring[0])));
|
||||
icommandsender
|
||||
.addChatMessage(new ChatComponentText(String.format("Player %s added to Opis user list", astring[0])));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package mcp.mobius.opis.commands.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.data.holders.basetypes.AmountHolder;
|
||||
import mcp.mobius.opis.data.managers.EntityManager;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
@@ -2,12 +2,15 @@ package mcp.mobius.opis.commands.server;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.modOpis;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class CommandChunkDump extends CommandBase implements IOpisCommand {
|
||||
@@ -36,8 +39,7 @@ public class CommandChunkDump extends CommandBase implements IOpisCommand {
|
||||
|
||||
Integer[] worldIDs = DimensionManager.getIDs();
|
||||
for (Integer worldID : worldIDs) {
|
||||
Set<ChunkCoordIntPair> persistantChunks =
|
||||
DimensionManager.getWorld(worldID).getPersistentChunks().keySet();
|
||||
Set<ChunkCoordIntPair> persistantChunks = DimensionManager.getWorld(worldID).getPersistentChunks().keySet();
|
||||
Set<ChunkCoordIntPair> chunks = (Set<ChunkCoordIntPair>) DimensionManager.getWorld(worldID).activeChunkSet;
|
||||
|
||||
for (ChunkCoordIntPair chunk : chunks) {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package mcp.mobius.opis.commands.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.data.holders.stats.StatsChunk;
|
||||
import mcp.mobius.opis.data.managers.ChunkManager;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -36,12 +38,11 @@ public class CommandChunkList extends CommandBase implements IOpisCommand {
|
||||
ArrayList<StatsChunk> chunks = new ArrayList<StatsChunk>();
|
||||
|
||||
if (astring.length == 0) chunks = ChunkManager.INSTANCE.getTopChunks(20);
|
||||
else
|
||||
try {
|
||||
chunks = ChunkManager.INSTANCE.getTopChunks(Integer.valueOf(astring.length));
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
else try {
|
||||
chunks = ChunkManager.INSTANCE.getTopChunks(Integer.valueOf(astring.length));
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
|
||||
icommandsender.addChatMessage(new ChatComponentText("[DIM X Z] Time NTEs"));
|
||||
for (StatsChunk stat : chunks) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package mcp.mobius.opis.commands.server;
|
||||
|
||||
import mcp.mobius.opis.events.OpisServerEventHandler;
|
||||
import mcp.mobius.opis.events.PlayerTracker;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
@@ -3,6 +3,7 @@ package mcp.mobius.opis.commands.server;
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.events.PlayerTracker;
|
||||
import mcp.mobius.opis.modOpis;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -34,8 +35,7 @@ public class CommandFrequency extends CommandBase implements IOpisCommand {
|
||||
icommandsender.addChatMessage(
|
||||
new ChatComponentText(String.format("\u00A7oOpis delay set to %s ticks.", astring[0])));
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mcp.mobius.opis.commands.server;
|
||||
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
@@ -24,25 +25,13 @@ public class CommandHelp extends CommandBase implements IOpisCommand {
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender icommandsender, String[] astring) {
|
||||
IOpisCommand[] commands = {
|
||||
new CommandStart(),
|
||||
new CommandStop(),
|
||||
new CommandReset(),
|
||||
new CommandFrequency(),
|
||||
new CommandTicks(),
|
||||
new CommandChunkList(),
|
||||
new CommandTimingTileEntities(),
|
||||
new CommandTimingEntities(),
|
||||
new CommandAmountEntities(),
|
||||
new CommandKill(),
|
||||
new CommandKillAll(),
|
||||
new CommandAddPrivileged(),
|
||||
new CommandRmPrivileged()
|
||||
};
|
||||
IOpisCommand[] commands = { new CommandStart(), new CommandStop(), new CommandReset(), new CommandFrequency(),
|
||||
new CommandTicks(), new CommandChunkList(), new CommandTimingTileEntities(),
|
||||
new CommandTimingEntities(), new CommandAmountEntities(), new CommandKill(), new CommandKillAll(),
|
||||
new CommandAddPrivileged(), new CommandRmPrivileged() };
|
||||
|
||||
for (IOpisCommand cmd : commands)
|
||||
icommandsender.addChatMessage(
|
||||
new ChatComponentText(String.format("/%s : %s", cmd.getCommandNameOpis(), cmd.getDescription())));
|
||||
for (IOpisCommand cmd : commands) icommandsender.addChatMessage(
|
||||
new ChatComponentText(String.format("/%s : %s", cmd.getCommandNameOpis(), cmd.getDescription())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package mcp.mobius.opis.commands.server;
|
||||
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.events.PlayerTracker;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -36,8 +37,8 @@ public class CommandKill extends CommandBase implements IOpisCommand {
|
||||
|
||||
World world = DimensionManager.getWorld(dim);
|
||||
if (world == null) {
|
||||
icommandsender.addChatMessage(
|
||||
new ChatComponentText(String.format("\u00A7oCannot find dim %d in world", dim)));
|
||||
icommandsender
|
||||
.addChatMessage(new ChatComponentText(String.format("\u00A7oCannot find dim %d in world", dim)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -49,8 +50,8 @@ public class CommandKill extends CommandBase implements IOpisCommand {
|
||||
}
|
||||
|
||||
entity.setDead();
|
||||
icommandsender.addChatMessage(
|
||||
new ChatComponentText(String.format("\u00A7oKilled entity %d in dim %d", eid, dim)));
|
||||
icommandsender
|
||||
.addChatMessage(new ChatComponentText(String.format("\u00A7oKilled entity %d in dim %d", eid, dim)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@ package mcp.mobius.opis.commands.server;
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.data.managers.EntityManager;
|
||||
import mcp.mobius.opis.events.PlayerTracker;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.dedicated.DedicatedServer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class CommandKillAll extends CommandBase implements IOpisCommand {
|
||||
@@ -36,8 +38,10 @@ public class CommandKillAll extends CommandBase implements IOpisCommand {
|
||||
int nkilled = EntityManager.INSTANCE.killAll(searchname);
|
||||
|
||||
if (nkilled == -1) {
|
||||
icommandsender.addChatMessage(new ChatComponentText(String.format(
|
||||
"\u00A7oSeriously ? I can't, seriously, I can't. I should remove you from the OP list !")));
|
||||
icommandsender.addChatMessage(
|
||||
new ChatComponentText(
|
||||
String.format(
|
||||
"\u00A7oSeriously ? I can't, seriously, I can't. I should remove you from the OP list !")));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,28 +49,15 @@ public class CommandKillAll extends CommandBase implements IOpisCommand {
|
||||
new ChatComponentText(String.format("\u00A7oKilled %d entities of type %s", nkilled, searchname)));
|
||||
|
||||
/*
|
||||
World world = DimensionManager.getWorld(dim);
|
||||
if (world == null){
|
||||
PacketDispatcher.sendPacketToPlayer(
|
||||
new Packet3Chat(ChatMessageComponent.createFromText(String.format("\u00A7oCannot find dim %d in world %d", dim))),
|
||||
(Player)icommandsender);
|
||||
return;
|
||||
}
|
||||
|
||||
Entity entity = world.getEntityByID(eid);
|
||||
if (entity == null) {
|
||||
PacketDispatcher.sendPacketToPlayer(
|
||||
new Packet3Chat(ChatMessageComponent.createFromText(String.format("\u00A7oCannot find entity %d in dim %d", eid, dim))),
|
||||
(Player)icommandsender);
|
||||
return;
|
||||
}
|
||||
|
||||
entity.setDead();
|
||||
PacketDispatcher.sendPacketToPlayer(
|
||||
new Packet3Chat(ChatMessageComponent.createFromText(String.format("\u00A7oKilled entity %d in dim %d", eid, dim))),
|
||||
(Player)icommandsender);
|
||||
return;
|
||||
*/
|
||||
* World world = DimensionManager.getWorld(dim); if (world == null){ PacketDispatcher.sendPacketToPlayer( new
|
||||
* Packet3Chat(ChatMessageComponent.createFromText(String.format("\u00A7oCannot find dim %d in world %d",
|
||||
* dim))), (Player)icommandsender); return; } Entity entity = world.getEntityByID(eid); if (entity == null) {
|
||||
* PacketDispatcher.sendPacketToPlayer( new
|
||||
* Packet3Chat(ChatMessageComponent.createFromText(String.format("\u00A7oCannot find entity %d in dim %d", eid,
|
||||
* dim))), (Player)icommandsender); return; } entity.setDead(); PacketDispatcher.sendPacketToPlayer( new
|
||||
* Packet3Chat(ChatMessageComponent.createFromText(String.format("\u00A7oKilled entity %d in dim %d", eid,
|
||||
* dim))), (Player)icommandsender); return;
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,7 @@ import mcp.mobius.opis.events.PlayerTracker;
|
||||
import mcp.mobius.opis.network.PacketManager;
|
||||
import mcp.mobius.opis.network.enums.Message;
|
||||
import mcp.mobius.opis.network.packets.server.NetDataCommand;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -36,9 +37,8 @@ public class CommandReset extends CommandBase implements IOpisCommand {
|
||||
icommandsender.addChatMessage(new ChatComponentText(String.format("\u00A7oInternal data reseted.")));
|
||||
|
||||
// PacketDispatcher.sendPacketToAllPlayers(NetDataCommand.create(Message.CLIENT_CLEAR_SELECTION));
|
||||
if (icommandsender instanceof EntityPlayerMP)
|
||||
PacketManager.validateAndSend(
|
||||
new NetDataCommand(Message.CLIENT_CLEAR_SELECTION), (EntityPlayerMP) icommandsender);
|
||||
if (icommandsender instanceof EntityPlayerMP) PacketManager
|
||||
.validateAndSend(new NetDataCommand(Message.CLIENT_CLEAR_SELECTION), (EntityPlayerMP) icommandsender);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package mcp.mobius.opis.commands.server;
|
||||
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.events.PlayerTracker;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -27,8 +28,8 @@ public class CommandRmPrivileged extends CommandBase implements IOpisCommand {
|
||||
icommandsender.addChatMessage(
|
||||
new ChatComponentText(String.format("Player %s removed from Opis user list.", astring[0])));
|
||||
} else {
|
||||
icommandsender.addChatMessage(
|
||||
new ChatComponentText(String.format("Player %s not found in list.", astring[0])));
|
||||
icommandsender
|
||||
.addChatMessage(new ChatComponentText(String.format("Player %s not found in list.", astring[0])));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package mcp.mobius.opis.commands.server;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialInt;
|
||||
@@ -9,11 +8,14 @@ import mcp.mobius.opis.modOpis;
|
||||
import mcp.mobius.opis.network.PacketManager;
|
||||
import mcp.mobius.opis.network.enums.Message;
|
||||
import mcp.mobius.opis.network.packets.server.NetDataValue;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class CommandStart extends CommandBase implements IOpisCommand {
|
||||
|
||||
@Override
|
||||
@@ -42,10 +44,11 @@ public class CommandStart extends CommandBase implements IOpisCommand {
|
||||
modOpis.profilerRun = true;
|
||||
ProfilerSection.activateAll(Side.SERVER);
|
||||
|
||||
PacketManager.sendPacketToAllSwing(
|
||||
new NetDataValue(Message.STATUS_START, new SerialInt(modOpis.profilerMaxTicks)));
|
||||
icommandsender.addChatMessage(new ChatComponentText(
|
||||
String.format("\u00A7oOpis started with a tick delay %s.", modOpis.profilerDelay)));
|
||||
PacketManager
|
||||
.sendPacketToAllSwing(new NetDataValue(Message.STATUS_START, new SerialInt(modOpis.profilerMaxTicks)));
|
||||
icommandsender.addChatMessage(
|
||||
new ChatComponentText(
|
||||
String.format("\u00A7oOpis started with a tick delay %s.", modOpis.profilerDelay)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package mcp.mobius.opis.commands.server;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.events.PlayerTracker;
|
||||
import mcp.mobius.opis.modOpis;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.dedicated.DedicatedServer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class CommandStop extends CommandBase implements IOpisCommand {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,6 +3,7 @@ package mcp.mobius.opis.commands.server;
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.events.PlayerTracker;
|
||||
import mcp.mobius.opis.modOpis;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -34,8 +35,7 @@ public class CommandTicks extends CommandBase implements IOpisCommand {
|
||||
icommandsender.addChatMessage(
|
||||
new ChatComponentText(String.format("\u00A7oOpis ticks set to %s ticks.", astring[0])));
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package mcp.mobius.opis.commands.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataEntity;
|
||||
import mcp.mobius.opis.data.managers.EntityManager;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package mcp.mobius.opis.commands.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mcp.mobius.opis.commands.IOpisCommand;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataBlockTileEntity;
|
||||
import mcp.mobius.opis.data.managers.TileEntityManager;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
@@ -13,8 +13,7 @@ public class DataCache implements IMessageHandler {
|
||||
|
||||
public static DataCache instance() {
|
||||
return _instance;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
private volatile long clockScrew = 0;
|
||||
private volatile AccessLevel clientAccess = AccessLevel.NONE;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package mcp.mobius.opis.data.holders;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import mcp.mobius.opis.data.holders.basetypes.AmountHolder;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesBlock;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesChunk;
|
||||
@@ -44,7 +43,10 @@ import mcp.mobius.opis.data.holders.stats.StatAbstract;
|
||||
import mcp.mobius.opis.data.holders.stats.StatsChunk;
|
||||
import mcp.mobius.opis.modOpis;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
public enum DataType {
|
||||
|
||||
AMOUNTHOLDER(AmountHolder.class),
|
||||
COORDINATESBLOCK(CoordinatesBlock.class),
|
||||
COORDINATESCHUNK(CoordinatesChunk.class),
|
||||
|
||||
@@ -3,6 +3,7 @@ package mcp.mobius.opis.data.holders;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
public interface ISerializable {
|
||||
|
||||
void writeToStream(ByteArrayDataOutput stream);
|
||||
// Object readFromStream(DataInputStream stream) throws IOException;
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
package mcp.mobius.opis.data.holders.basetypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.newtypes.CachedString;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.newtypes.CachedString;
|
||||
|
||||
public class AmountHolder implements ISerializable {
|
||||
|
||||
@@ -32,6 +33,8 @@ public class AmountHolder implements ISerializable {
|
||||
|
||||
public static AmountHolder readFromStream(ByteArrayDataInput istream) {
|
||||
return new AmountHolder(
|
||||
CachedString.readFromStream(istream), istream.readInt(), CachedString.readFromStream(istream));
|
||||
CachedString.readFromStream(istream),
|
||||
istream.readInt(),
|
||||
CachedString.readFromStream(istream));
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,25 @@
|
||||
package mcp.mobius.opis.data.holders.basetypes;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
public final class CoordinatesBlock implements ISerializable {
|
||||
|
||||
public final int dim, x, y, z;
|
||||
public final int chunkX, chunkZ;
|
||||
// public boolean isChunk;
|
||||
|
||||
public static final CoordinatesBlock INVALID =
|
||||
new CoordinatesBlock(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
public static final CoordinatesBlock INVALID = new CoordinatesBlock(
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE);
|
||||
|
||||
public CoordinatesBlock(Entity entity) {
|
||||
this.dim = entity.worldObj.provider.dimensionId;
|
||||
@@ -56,16 +62,9 @@ public final class CoordinatesBlock implements ISerializable {
|
||||
}
|
||||
|
||||
/*
|
||||
public CoordinatesBlock(int dim, int chunkX, int chunkZ){
|
||||
this.dim = dim;
|
||||
this.chunkX = chunkX;
|
||||
this.chunkZ = chunkZ;
|
||||
this.x = chunkX << 4;
|
||||
this.y = 0;
|
||||
this.z = chunkZ << 4;
|
||||
this.isChunk = true;
|
||||
}
|
||||
*/
|
||||
* public CoordinatesBlock(int dim, int chunkX, int chunkZ){ this.dim = dim; this.chunkX = chunkX; this.chunkZ =
|
||||
* chunkZ; this.x = chunkX << 4; this.y = 0; this.z = chunkZ << 4; this.isChunk = true; }
|
||||
*/
|
||||
|
||||
public CoordinatesBlock(TileEntity te) {
|
||||
this.dim = te.getWorldObj().provider.dimensionId;
|
||||
@@ -83,7 +82,7 @@ public final class CoordinatesBlock implements ISerializable {
|
||||
|
||||
public String toString() {
|
||||
// if (this.isChunk)
|
||||
// return String.format("[%6d %6d %6d]", this.dim, this.chunkX, this.chunkZ);
|
||||
// return String.format("[%6d %6d %6d]", this.dim, this.chunkX, this.chunkZ);
|
||||
// else
|
||||
return String.format("[%6d %6d %6d %6d]", this.dim, this.x, this.y, this.z);
|
||||
}
|
||||
@@ -91,11 +90,10 @@ public final class CoordinatesBlock implements ISerializable {
|
||||
public boolean equals(Object o) {
|
||||
CoordinatesBlock c = (CoordinatesBlock) o;
|
||||
// if (this.isChunk)
|
||||
// return (this.dim == c.dim) && (this.chunkX == c.chunkX) && (this.chunkZ == c.chunkZ);
|
||||
// return (this.dim == c.dim) && (this.chunkX == c.chunkX) && (this.chunkZ == c.chunkZ);
|
||||
// else
|
||||
return (this.dim == c.dim) && (this.x == c.x) && (this.y == c.y) && (this.z == c.z);
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
public boolean isInvalid() {
|
||||
return this.equals(CoordinatesBlock.INVALID);
|
||||
@@ -103,9 +101,9 @@ public final class CoordinatesBlock implements ISerializable {
|
||||
|
||||
public int hashCode() {
|
||||
// if (this.isChunk)
|
||||
// return String.format("%s %s %s", this.dim, this.chunkX, this.chunkZ).hashCode();
|
||||
// return String.format("%s %s %s", this.dim, this.chunkX, this.chunkZ).hashCode();
|
||||
// else
|
||||
// return String.format("%s %s %s %s", this.dim, this.x, this.y, this.z).hashCode();
|
||||
// return String.format("%s %s %s %s", this.dim, this.x, this.y, this.z).hashCode();
|
||||
return this.dim + 31 * this.x + 877 * this.y + 3187 * this.z;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
package mcp.mobius.opis.data.holders.basetypes;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
public final class CoordinatesChunk implements ISerializable {
|
||||
|
||||
public final int dim, x, y, z;
|
||||
public final int chunkX, chunkZ;
|
||||
public final byte metadata;
|
||||
// public boolean isChunk;
|
||||
|
||||
public static final CoordinatesChunk INVALID =
|
||||
new CoordinatesChunk(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
public static final CoordinatesChunk INVALID = new CoordinatesChunk(
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE);
|
||||
|
||||
public CoordinatesChunk(CoordinatesBlock coord) {
|
||||
this.dim = coord.dim;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package mcp.mobius.opis.data.holders.basetypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class SerialDouble implements ISerializable {
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package mcp.mobius.opis.data.holders.basetypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class SerialFloat implements ISerializable {
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package mcp.mobius.opis.data.holders.basetypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class SerialInt implements ISerializable {
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package mcp.mobius.opis.data.holders.basetypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class SerialLong implements ISerializable {
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class SerialNumeral<U> {
|
||||
|
||||
private enum Type {
|
||||
INTEGER,
|
||||
LONG,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package mcp.mobius.opis.data.holders.basetypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class SerialString implements ISerializable {
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package mcp.mobius.opis.data.holders.basetypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class TargetEntity implements ISerializable {
|
||||
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package mcp.mobius.opis.data.holders.basetypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
|
||||
public final class TicketData implements ISerializable {
|
||||
|
||||
public final CoordinatesChunk coord;
|
||||
public final int nchunks;
|
||||
public final String modID;
|
||||
@@ -26,7 +29,9 @@ public final class TicketData implements ISerializable {
|
||||
}
|
||||
|
||||
this.coord = new CoordinatesChunk(
|
||||
ticket.world.provider.dimensionId, (minChunkX + maxChunkX) / 2, (minChunkZ + maxChunkZ) / 2);
|
||||
ticket.world.provider.dimensionId,
|
||||
(minChunkX + maxChunkX) / 2,
|
||||
(minChunkZ + maxChunkZ) / 2);
|
||||
this.nchunks = requestedChunks.size();
|
||||
this.modID = ticket.getModId();
|
||||
this.ticket = ticket;
|
||||
@@ -55,12 +60,10 @@ public final class TicketData implements ISerializable {
|
||||
|
||||
if (this.ticket != null && c.ticket != null) return this.ticket.equals(c.ticket);
|
||||
|
||||
return (this.coord.dim == c.coord.dim)
|
||||
&& (this.coord.chunkX == c.coord.chunkX)
|
||||
return (this.coord.dim == c.coord.dim) && (this.coord.chunkX == c.coord.chunkX)
|
||||
&& (this.coord.chunkZ == c.coord.chunkZ)
|
||||
&& (this.nchunks == c.nchunks);
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
public int hashCode() {
|
||||
if (this.ticket != null) return this.ticket.hashCode();
|
||||
@@ -71,6 +74,10 @@ public final class TicketData implements ISerializable {
|
||||
public String toString() {
|
||||
return String.format(
|
||||
"Ticket %s [%d %d %d] %d",
|
||||
this.modID, this.coord.dim, this.coord.chunkX, this.coord.chunkZ, this.nchunks);
|
||||
this.modID,
|
||||
this.coord.dim,
|
||||
this.coord.chunkX,
|
||||
this.coord.chunkZ,
|
||||
this.nchunks);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,17 @@
|
||||
package mcp.mobius.opis.data.holders.clienttypes;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesBlock;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataBlockTileEntity;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataTiming;
|
||||
import mcp.mobius.opis.data.profilers.ProfilerRenderBlock;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
public class DataBlockRender extends DataBlockTileEntity {
|
||||
@@ -20,8 +23,8 @@ public class DataBlockRender extends DataBlockTileEntity {
|
||||
this.id = (short) Block.getIdFromBlock(world.getBlock(this.pos.x, this.pos.y, this.pos.z));
|
||||
this.meta = (short) world.getBlockMetadata(this.pos.x, this.pos.y, this.pos.z);
|
||||
|
||||
HashMap<CoordinatesBlock, DescriptiveStatistics> data =
|
||||
((ProfilerRenderBlock) (ProfilerSection.RENDER_BLOCK.getProfiler())).data;
|
||||
HashMap<CoordinatesBlock, DescriptiveStatistics> data = ((ProfilerRenderBlock) (ProfilerSection.RENDER_BLOCK
|
||||
.getProfiler())).data;
|
||||
this.update = new DataTiming(data.containsKey(coord) ? data.get(coord).getGeometricMean() : 0.0D);
|
||||
|
||||
return this;
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package mcp.mobius.opis.data.holders.clienttypes;
|
||||
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesBlock;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataTiming;
|
||||
import mcp.mobius.opis.data.managers.EntityManager;
|
||||
import mcp.mobius.opis.data.profilers.ProfilerRenderEntity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
public class DataEntityRender implements Comparable<DataEntityRender> {
|
||||
@@ -23,8 +26,8 @@ public class DataEntityRender implements Comparable<DataEntityRender> {
|
||||
this.name = EntityManager.INSTANCE.getEntityName(entity, false);
|
||||
this.pos = new CoordinatesBlock(entity);
|
||||
|
||||
WeakHashMap<Entity, DescriptiveStatistics> data =
|
||||
((ProfilerRenderEntity) (ProfilerSection.RENDER_ENTITY.getProfiler())).data;
|
||||
WeakHashMap<Entity, DescriptiveStatistics> data = ((ProfilerRenderEntity) (ProfilerSection.RENDER_ENTITY
|
||||
.getProfiler())).data;
|
||||
this.update = new DataTiming(data.containsKey(entity) ? data.get(entity).getGeometricMean() : 0.0D);
|
||||
this.npoints = data.containsKey(entity) ? data.get(entity).getN() : 0;
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package mcp.mobius.opis.data.holders.clienttypes;
|
||||
|
||||
import com.google.common.collect.Table.Cell;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataTiming;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
import com.google.common.collect.Table.Cell;
|
||||
|
||||
public class DataRenderEvent implements Comparable {
|
||||
|
||||
public String event;
|
||||
public String handler;
|
||||
public String package_;
|
||||
@@ -14,20 +17,16 @@ public class DataRenderEvent implements Comparable {
|
||||
|
||||
public DataRenderEvent fill(Cell<Class, String, DescriptiveStatistics> cellData, String modName) {
|
||||
/*
|
||||
String handlerName = cell.getColumnKey().getSimpleName();
|
||||
try {
|
||||
String[] splitHandler = handlerName.split("_");
|
||||
handlerName = splitHandler[2] + "." + splitHandler[3];
|
||||
} catch (Exception e){}
|
||||
*/
|
||||
* String handlerName = cell.getColumnKey().getSimpleName(); try { String[] splitHandler =
|
||||
* handlerName.split("_"); handlerName = splitHandler[2] + "." + splitHandler[3]; } catch (Exception e){}
|
||||
*/
|
||||
String[] nameRaw = cellData.getColumnKey().split("\\|");
|
||||
|
||||
String handlerName = nameRaw[1];
|
||||
try {
|
||||
String[] splitHandler = handlerName.split("_");
|
||||
handlerName = splitHandler[2] + "." + splitHandler[3];
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
|
||||
this.package_ = nameRaw[0];
|
||||
this.handler = handlerName;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.managers.StringCache;
|
||||
import mcp.mobius.opis.helpers.Helpers;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.managers.StringCache;
|
||||
import mcp.mobius.opis.helpers.Helpers;
|
||||
|
||||
public class CachedString implements Comparable, ISerializable {
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialString;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialString;
|
||||
|
||||
public class ChatMsg implements ISerializable {
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialString;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import java.util.Properties;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialString;
|
||||
|
||||
public class ConnectionProperties implements ISerializable {
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class DataAmountRate implements Comparable, ISerializable {
|
||||
|
||||
public Long size; // Size is stored in byte
|
||||
public int interval;
|
||||
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.profilers.ProfilerDimBlockTick;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
public class DataBlockTick implements ISerializable {
|
||||
|
||||
public HashMap<Integer, DataTiming> perdim = new HashMap<Integer, DataTiming>();
|
||||
public DataTiming total;
|
||||
|
||||
public DataBlockTick fill() {
|
||||
this.total = new DataTiming();
|
||||
HashMap<Integer, DescriptiveStatistics> data =
|
||||
((ProfilerDimBlockTick) ProfilerSection.DIMENSION_BLOCKTICK.getProfiler()).data;
|
||||
HashMap<Integer, DescriptiveStatistics> data = ((ProfilerDimBlockTick) ProfilerSection.DIMENSION_BLOCKTICK
|
||||
.getProfiler()).data;
|
||||
|
||||
for (Integer dim : data.keySet()) {
|
||||
this.perdim.put(dim, new DataTiming(data.get(dim).getGeometricMean()));
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesBlock;
|
||||
import mcp.mobius.opis.data.profilers.ProfilerTileEntityUpdate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
public class DataBlockTileEntity implements ISerializable, Comparable<DataBlockTileEntity> {
|
||||
|
||||
public short id;
|
||||
@@ -26,10 +30,9 @@ public class DataBlockTileEntity implements ISerializable, Comparable<DataBlockT
|
||||
this.id = (short) Block.getIdFromBlock(world.getBlock(this.pos.x, this.pos.y, this.pos.z));
|
||||
this.meta = (short) world.getBlockMetadata(this.pos.x, this.pos.y, this.pos.z);
|
||||
|
||||
HashMap<CoordinatesBlock, DescriptiveStatistics> data =
|
||||
((ProfilerTileEntityUpdate) (ProfilerSection.TILEENT_UPDATETIME.getProfiler())).data;
|
||||
this.update =
|
||||
new DataTiming(data.containsKey(this.pos) ? data.get(this.pos).getGeometricMean() : 0.0D);
|
||||
HashMap<CoordinatesBlock, DescriptiveStatistics> data = ((ProfilerTileEntityUpdate) (ProfilerSection.TILEENT_UPDATETIME
|
||||
.getProfiler())).data;
|
||||
this.update = new DataTiming(data.containsKey(this.pos) ? data.get(this.pos).getGeometricMean() : 0.0D);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,9 +1,10 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.helpers.ModIdentification;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.helpers.ModIdentification;
|
||||
|
||||
public class DataBlockTileEntityPerClass implements ISerializable, Comparable {
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class DataByteRate implements Comparable, ISerializable {
|
||||
|
||||
public Long size; // Size is stored in byte
|
||||
public int interval;
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class DataByteSize implements Comparable, ISerializable {
|
||||
|
||||
public Long size; // Size is stored in byte
|
||||
|
||||
public DataByteSize() {
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesChunk;
|
||||
import mcp.mobius.opis.data.managers.EntityManager;
|
||||
import mcp.mobius.opis.data.managers.TileEntityManager;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
public class DataChunk implements ISerializable, Comparable {
|
||||
|
||||
int nentities;
|
||||
int ntileents;
|
||||
DataTiming update;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesChunk;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesChunk;
|
||||
|
||||
public class DataChunkEntities implements ISerializable {
|
||||
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.profilers.ProfilerDimTick;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
/* Data holder for infos about dimensions */
|
||||
|
||||
public class DataDimension implements ISerializable {
|
||||
@@ -39,8 +43,8 @@ public class DataDimension implements ISerializable {
|
||||
this.forced = world.getPersistentChunks().size();
|
||||
this.loaded = world.getChunkProvider().getLoadedChunkCount();
|
||||
|
||||
HashMap<Integer, DescriptiveStatistics> data =
|
||||
((ProfilerDimTick) (ProfilerSection.DIMENSION_TICK.getProfiler())).data;
|
||||
HashMap<Integer, DescriptiveStatistics> data = ((ProfilerDimTick) (ProfilerSection.DIMENSION_TICK
|
||||
.getProfiler())).data;
|
||||
this.update = new DataTiming(data.containsKey(dim) ? data.get(dim).getGeometricMean() : 0.0D);
|
||||
|
||||
this.mobs = 0;
|
||||
@@ -81,7 +85,7 @@ public class DataDimension implements ISerializable {
|
||||
retVal.mobs = stream.readInt();
|
||||
retVal.neutral = stream.readInt();
|
||||
retVal.itemstacks = stream.readInt();
|
||||
// retVal.update = stream.readDouble();
|
||||
// retVal.update = stream.readDouble();
|
||||
retVal.update = DataTiming.readFromStream(stream);
|
||||
retVal.name = CachedString.readFromStream(stream);
|
||||
return retVal;
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesBlock;
|
||||
import mcp.mobius.opis.data.managers.EntityManager;
|
||||
import mcp.mobius.opis.data.profilers.ProfilerEntityUpdate;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
public class DataEntity implements ISerializable, Comparable<DataEntity> {
|
||||
|
||||
public int eid;
|
||||
@@ -25,8 +29,8 @@ public class DataEntity implements ISerializable, Comparable<DataEntity> {
|
||||
this.name = new CachedString(EntityManager.INSTANCE.getEntityName(entity, false));
|
||||
this.pos = new CoordinatesBlock(entity);
|
||||
|
||||
WeakHashMap<Entity, DescriptiveStatistics> data =
|
||||
((ProfilerEntityUpdate) (ProfilerSection.ENTITY_UPDATETIME.getProfiler())).data;
|
||||
WeakHashMap<Entity, DescriptiveStatistics> data = ((ProfilerEntityUpdate) (ProfilerSection.ENTITY_UPDATETIME
|
||||
.getProfiler())).data;
|
||||
this.update = new DataTiming(data.containsKey(entity) ? data.get(entity).getGeometricMean() : 0.0D);
|
||||
this.npoints = data.containsKey(entity) ? data.get(entity).getN() : 0;
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class DataEntityPerClass implements Comparable, ISerializable {
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class DataError implements ISerializable {
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
import com.google.common.collect.Table.Cell;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
public class DataEvent implements ISerializable, Comparable {
|
||||
|
||||
public CachedString event;
|
||||
public CachedString handler;
|
||||
public CachedString package_;
|
||||
@@ -16,20 +19,16 @@ public class DataEvent implements ISerializable, Comparable {
|
||||
|
||||
public DataEvent fill(Cell<Class, String, DescriptiveStatistics> cellData, String modName) {
|
||||
/*
|
||||
String handlerName = cell.getColumnKey().getSimpleName();
|
||||
try {
|
||||
String[] splitHandler = handlerName.split("_");
|
||||
handlerName = splitHandler[2] + "." + splitHandler[3];
|
||||
} catch (Exception e){}
|
||||
*/
|
||||
* String handlerName = cell.getColumnKey().getSimpleName(); try { String[] splitHandler =
|
||||
* handlerName.split("_"); handlerName = splitHandler[2] + "." + splitHandler[3]; } catch (Exception e){}
|
||||
*/
|
||||
String[] nameRaw = cellData.getColumnKey().split("\\|");
|
||||
|
||||
String handlerName = nameRaw[1];
|
||||
try {
|
||||
String[] splitHandler = handlerName.split("_");
|
||||
handlerName = splitHandler[2] + "." + splitHandler[3];
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
|
||||
this.package_ = new CachedString(nameRaw[0]);
|
||||
this.handler = new CachedString(handlerName);
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.profilers.ProfilerNetworkTick;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
public class DataNetworkTick implements ISerializable, Comparable {
|
||||
|
||||
public DataTiming update;
|
||||
|
||||
public DataNetworkTick fill() {
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import net.minecraft.network.Packet;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import net.minecraft.network.Packet;
|
||||
|
||||
public class DataPacket implements ISerializable {
|
||||
|
||||
public int id;
|
||||
public DataByteSize size;
|
||||
public DataByteRate rate;
|
||||
@@ -23,15 +26,9 @@ public class DataPacket implements ISerializable {
|
||||
|
||||
public DataPacket fill(Packet packet, int pktsize) {
|
||||
/*
|
||||
PacketBuffer buff = new PacketBuffer(Unpooled.buffer());
|
||||
int pktsize = 0;
|
||||
try{
|
||||
packet.writePacketData(buff);
|
||||
pktsize = buff.readableBytes();
|
||||
} catch (Exception e){
|
||||
|
||||
}
|
||||
*/
|
||||
* PacketBuffer buff = new PacketBuffer(Unpooled.buffer()); int pktsize = 0; try{ packet.writePacketData(buff);
|
||||
* pktsize = buff.readableBytes(); } catch (Exception e){ }
|
||||
*/
|
||||
this.size.size += pktsize;
|
||||
this.rate.size += pktsize;
|
||||
this.amount.size += 1;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class DataPacket250 implements ISerializable {
|
||||
|
||||
public CachedString channel;
|
||||
public DataByteSize size;
|
||||
public DataByteRate rate;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class DataStringUpdate implements ISerializable {
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class DataThread implements ISerializable {
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesBlock;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesBlock;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class DataTileEntity implements ISerializable {
|
||||
|
||||
@@ -16,7 +18,10 @@ public class DataTileEntity implements ISerializable {
|
||||
|
||||
public DataTileEntity fill(TileEntity tileEntity, String cause) {
|
||||
this.pos = new CoordinatesBlock(
|
||||
tileEntity.getWorldObj().provider.dimensionId, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
tileEntity.getWorldObj().provider.dimensionId,
|
||||
tileEntity.xCoord,
|
||||
tileEntity.yCoord,
|
||||
tileEntity.zCoord);
|
||||
this.clazz = new CachedString(tileEntity.getClass().getCanonicalName());
|
||||
this.hashCode = System.identityHashCode(tileEntity);
|
||||
this.isValid = !tileEntity.isInvalid();
|
||||
@@ -25,14 +30,9 @@ public class DataTileEntity implements ISerializable {
|
||||
}
|
||||
|
||||
/*
|
||||
public DataTileEntity fill(CoordinatesBlock coord, String clazz, int hashCode, boolean isInvalid){
|
||||
this.pos = coord;
|
||||
this.clazz = new CachedString(clazz);
|
||||
this.hashCode = hashCode;
|
||||
this.isValid = !isInvalid;
|
||||
return this;
|
||||
}
|
||||
*/
|
||||
* public DataTileEntity fill(CoordinatesBlock coord, String clazz, int hashCode, boolean isInvalid){ this.pos =
|
||||
* coord; this.clazz = new CachedString(clazz); this.hashCode = hashCode; this.isValid = !isInvalid; return this; }
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void writeToStream(ByteArrayDataOutput stream) {
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesBlock;
|
||||
import mcp.mobius.opis.data.profilers.ProfilerRenderTileEntity;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
public class DataTileEntityRender extends DataBlockTileEntity {
|
||||
@@ -19,8 +22,8 @@ public class DataTileEntityRender extends DataBlockTileEntity {
|
||||
this.id = (short) Block.getIdFromBlock(world.getBlock(this.pos.x, this.pos.y, this.pos.z));
|
||||
this.meta = (short) world.getBlockMetadata(this.pos.x, this.pos.y, this.pos.z);
|
||||
|
||||
WeakHashMap<TileEntity, DescriptiveStatistics> data =
|
||||
((ProfilerRenderTileEntity) (ProfilerSection.RENDER_TILEENTITY.getProfiler())).data;
|
||||
WeakHashMap<TileEntity, DescriptiveStatistics> data = ((ProfilerRenderTileEntity) (ProfilerSection.RENDER_TILEENTITY
|
||||
.getProfiler())).data;
|
||||
this.update = new DataTiming(data.containsKey(ent) ? data.get(ent).getGeometricMean() : 0.0D);
|
||||
|
||||
return this;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
|
||||
public class DataTiming implements Comparable, ISerializable {
|
||||
|
||||
public Double timing;
|
||||
|
||||
public DataTiming() {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialString;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialString;
|
||||
|
||||
public class NexusAuth implements ISerializable {
|
||||
|
||||
@@ -36,6 +37,8 @@ public class NexusAuth implements ISerializable {
|
||||
|
||||
public static NexusAuth readFromStream(ByteArrayDataInput stream) {
|
||||
return new NexusAuth(
|
||||
SerialString.readFromStream(stream), SerialString.readFromStream(stream), stream.readBoolean());
|
||||
SerialString.readFromStream(stream),
|
||||
SerialString.readFromStream(stream),
|
||||
stream.readBoolean());
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialInt;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialLong;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
public class NexusData implements ISerializable {
|
||||
|
||||
public SerialLong packetOutbound;
|
||||
@@ -18,14 +19,8 @@ public class NexusData implements ISerializable {
|
||||
public SerialInt amountPlayers;
|
||||
long timestamp;
|
||||
|
||||
public NexusData(
|
||||
SerialLong Packet_Outbound,
|
||||
SerialLong Packet_Inbound,
|
||||
SerialInt Chunk_Forced,
|
||||
SerialInt Chunk_Loaded,
|
||||
DataTiming Timing_Tick,
|
||||
SerialInt Amount_TileEnts,
|
||||
SerialInt Amount_Entities,
|
||||
public NexusData(SerialLong Packet_Outbound, SerialLong Packet_Inbound, SerialInt Chunk_Forced,
|
||||
SerialInt Chunk_Loaded, DataTiming Timing_Tick, SerialInt Amount_TileEnts, SerialInt Amount_Entities,
|
||||
SerialInt Amount_Players) {
|
||||
this.packetOutbound = Packet_Outbound;
|
||||
this.packetInbound = Packet_Inbound;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.network.enums.PlayerEv;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.network.enums.PlayerEv;
|
||||
|
||||
public class PlayerStatus implements ISerializable {
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package mcp.mobius.opis.data.holders.stats;
|
||||
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesBlock;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesChunk;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
public abstract class StatAbstract implements Comparable<StatAbstract>, ISerializable {
|
||||
|
||||
protected DescriptiveStatistics dstat = new DescriptiveStatistics();
|
||||
public Long dataPoints = 0L;
|
||||
protected Double geomMean = null;
|
||||
@@ -16,14 +19,9 @@ public abstract class StatAbstract implements Comparable<StatAbstract>, ISeriali
|
||||
protected String name;
|
||||
|
||||
/*
|
||||
public StatAbstract(){
|
||||
dstat = new DescriptiveStatistics();
|
||||
}
|
||||
|
||||
public StatAbstract(int points){
|
||||
dstat = new DescriptiveStatistics(points);
|
||||
}
|
||||
*/
|
||||
* public StatAbstract(){ dstat = new DescriptiveStatistics(); } public StatAbstract(int points){ dstat = new
|
||||
* DescriptiveStatistics(points); }
|
||||
*/
|
||||
|
||||
public void addMeasure(long timing) {
|
||||
// this.dstat.addValue((double)timing/1000.0);
|
||||
@@ -72,8 +70,7 @@ public abstract class StatAbstract implements Comparable<StatAbstract>, ISeriali
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
public CoordinatesBlock getCoordinates() {
|
||||
return this.coord;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package mcp.mobius.opis.data.holders.stats;
|
||||
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesChunk;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import mcp.mobius.opis.data.holders.basetypes.CoordinatesChunk;
|
||||
|
||||
public class StatsChunk extends StatAbstract {
|
||||
|
||||
public int tileEntities = 0;
|
||||
public int entities = 0;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.api.IMessageHandler;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
@@ -16,6 +17,7 @@ import mcp.mobius.opis.data.profilers.ProfilerEntityUpdate;
|
||||
import mcp.mobius.opis.data.profilers.ProfilerTileEntityUpdate;
|
||||
import mcp.mobius.opis.network.PacketBase;
|
||||
import mcp.mobius.opis.network.enums.Message;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.WorldServer;
|
||||
@@ -24,6 +26,7 @@ import net.minecraft.world.gen.ChunkProviderServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
public enum ChunkManager implements IMessageHandler {
|
||||
|
||||
INSTANCE;
|
||||
|
||||
private ArrayList<CoordinatesChunk> chunksLoad = new ArrayList<CoordinatesChunk>();
|
||||
@@ -62,8 +65,8 @@ public enum ChunkManager implements IMessageHandler {
|
||||
public synchronized ArrayList<StatsChunk> getChunksUpdateTime() {
|
||||
HashMap<CoordinatesChunk, StatsChunk> chunks = new HashMap<CoordinatesChunk, StatsChunk>();
|
||||
|
||||
for (CoordinatesBlock coords :
|
||||
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet()) {
|
||||
for (CoordinatesBlock coords : ((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME
|
||||
.getProfiler()).data.keySet()) {
|
||||
DataBlockTileEntity data = new DataBlockTileEntity().fill(coords);
|
||||
CoordinatesChunk chunk = data.pos.asCoordinatesChunk();
|
||||
|
||||
@@ -101,7 +104,7 @@ public enum ChunkManager implements IMessageHandler {
|
||||
for (WorldServer world : DimensionManager.getWorlds()) {
|
||||
int loadedChunksForDim = world.getChunkProvider().getLoadedChunkCount();
|
||||
loadedChunks += loadedChunksForDim;
|
||||
// System.out.printf("[ %2d ] %d chunks\n", world.provider.dimensionId, loadedChunksForDim);
|
||||
// System.out.printf("[ %2d ] %d chunks\n", world.provider.dimensionId, loadedChunksForDim);
|
||||
}
|
||||
// System.out.printf("Total : %d chunks\n", loadedChunks);
|
||||
return loadedChunks;
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mcp.mobius.mobiuscore.monitors.MonitoredEntityList;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.data.holders.basetypes.AmountHolder;
|
||||
@@ -19,6 +20,7 @@ import mcp.mobius.opis.helpers.Teleport;
|
||||
import mcp.mobius.opis.modOpis;
|
||||
import mcp.mobius.opis.network.PacketManager;
|
||||
import mcp.mobius.opis.network.enums.PlayerEv;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -29,6 +31,7 @@ import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
public enum EntityManager {
|
||||
|
||||
INSTANCE;
|
||||
|
||||
public ArrayList<DataEntity> getWorses(int amount) {
|
||||
@@ -85,8 +88,7 @@ public enum EntityManager {
|
||||
|
||||
/* Returns a hashmap of all entities per chunk (not timing) */
|
||||
public HashMap<CoordinatesChunk, ArrayList<DataEntity>> getAllEntitiesPerChunk() {
|
||||
HashMap<CoordinatesChunk, ArrayList<DataEntity>> entities =
|
||||
new HashMap<CoordinatesChunk, ArrayList<DataEntity>>();
|
||||
HashMap<CoordinatesChunk, ArrayList<DataEntity>> entities = new HashMap<CoordinatesChunk, ArrayList<DataEntity>>();
|
||||
for (int i : DimensionManager.getIDs()) {
|
||||
entities.putAll(this.getEntitiesPerChunkInDim(i));
|
||||
}
|
||||
@@ -95,8 +97,7 @@ public enum EntityManager {
|
||||
|
||||
/* Returns a hashmap of entities in the given dimension (not timing) */
|
||||
public HashMap<CoordinatesChunk, ArrayList<DataEntity>> getEntitiesPerChunkInDim(int dim) {
|
||||
HashMap<CoordinatesChunk, ArrayList<DataEntity>> entities =
|
||||
new HashMap<CoordinatesChunk, ArrayList<DataEntity>>();
|
||||
HashMap<CoordinatesChunk, ArrayList<DataEntity>> entities = new HashMap<CoordinatesChunk, ArrayList<DataEntity>>();
|
||||
World world = DimensionManager.getWorld(dim);
|
||||
if (world == null) return entities;
|
||||
|
||||
@@ -238,9 +239,7 @@ public enum EntityManager {
|
||||
public DataTiming getTotalUpdateTime() {
|
||||
double updateTime = 0D;
|
||||
for (Entity entity : ((ProfilerEntityUpdate) ProfilerSection.ENTITY_UPDATETIME.getProfiler()).data.keySet()) {
|
||||
updateTime += ((ProfilerEntityUpdate) ProfilerSection.ENTITY_UPDATETIME.getProfiler())
|
||||
.data
|
||||
.get(entity)
|
||||
updateTime += ((ProfilerEntityUpdate) ProfilerSection.ENTITY_UPDATETIME.getProfiler()).data.get(entity)
|
||||
.getGeometricMean();
|
||||
}
|
||||
return new DataTiming(updateTime);
|
||||
@@ -283,13 +282,14 @@ public enum EntityManager {
|
||||
for (Object o : players) {
|
||||
// outList.add(new DataEntity().fill((EntityPlayer) p));
|
||||
EntityPlayer p = (EntityPlayer) o;
|
||||
outList.add(new PlayerStatus(
|
||||
p.getGameProfile().getName(),
|
||||
PlayerEv.ONLINE,
|
||||
p.worldObj.provider.dimensionId,
|
||||
(int) p.posX,
|
||||
(int) p.posY,
|
||||
(int) p.posZ));
|
||||
outList.add(
|
||||
new PlayerStatus(
|
||||
p.getGameProfile().getName(),
|
||||
PlayerEv.ONLINE,
|
||||
p.worldObj.provider.dimensionId,
|
||||
(int) p.posX,
|
||||
(int) p.posY,
|
||||
(int) p.posZ));
|
||||
}
|
||||
|
||||
return outList;
|
||||
@@ -327,10 +327,8 @@ public enum EntityManager {
|
||||
String name = this.getEntityName(entity, true);
|
||||
if (!data.containsKey(name)) data.put(name, new DataEntityPerClass(name));
|
||||
|
||||
data.get(name)
|
||||
.add(((ProfilerEntityUpdate) ProfilerSection.ENTITY_UPDATETIME.getProfiler())
|
||||
.data
|
||||
.get(entity)
|
||||
data.get(name).add(
|
||||
((ProfilerEntityUpdate) ProfilerSection.ENTITY_UPDATETIME.getProfiler()).data.get(entity)
|
||||
.getGeometricMean());
|
||||
}
|
||||
return new ArrayList<DataEntityPerClass>(data.values());
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package mcp.mobius.opis.data.managers;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.events.OpisServerTickHandler;
|
||||
import mcp.mobius.opis.modOpis;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class MetaManager {
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package mcp.mobius.opis.data.managers;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import mcp.mobius.opis.api.IMessageHandler;
|
||||
import mcp.mobius.opis.api.TabPanelRegistrar;
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
@@ -14,18 +12,27 @@ import mcp.mobius.opis.network.PacketManager;
|
||||
import mcp.mobius.opis.network.enums.Message;
|
||||
import mcp.mobius.opis.network.packets.server.NetDataList;
|
||||
import mcp.mobius.opis.network.packets.server.NetDataValue;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
public enum StringCache implements IMessageHandler {
|
||||
|
||||
INSTANCE;
|
||||
|
||||
private int currentIndex = -1;
|
||||
// private HashBiMap<Integer, String> cache = HashBiMap.create();
|
||||
// private HashBiMap<Integer, String> cache = HashBiMap.create();
|
||||
// private ArrayList<DataStringUpdate> toSend = new ArrayList<DataStringUpdate>();
|
||||
private final BiMap<Integer, String> cache = Maps.synchronizedBiMap(HashBiMap.<Integer, String>create());
|
||||
private ConcurrentLinkedQueue<DataStringUpdate> fullsync = new ConcurrentLinkedQueue<DataStringUpdate>();
|
||||
private ConcurrentLinkedQueue<DataStringUpdate> unsynced =
|
||||
new ConcurrentLinkedQueue<DataStringUpdate>(); // This is the current list of unsynced
|
||||
private ConcurrentLinkedQueue<DataStringUpdate> unsynced = new ConcurrentLinkedQueue<DataStringUpdate>(); // This is
|
||||
// the
|
||||
// current
|
||||
// list of
|
||||
// unsynced
|
||||
|
||||
private StringCache() {
|
||||
this.getIndex("Server");
|
||||
@@ -67,7 +74,8 @@ public enum StringCache implements IMessageHandler {
|
||||
while (i < toSendCopy.size()) {
|
||||
PacketManager.sendToPlayer(
|
||||
new NetDataList(
|
||||
Message.STATUS_STRINGUPD_FULL, toSendCopy.subList(i, Math.min(i + 50, toSendCopy.size()))),
|
||||
Message.STATUS_STRINGUPD_FULL,
|
||||
toSendCopy.subList(i, Math.min(i + 50, toSendCopy.size()))),
|
||||
player);
|
||||
i += 50;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package mcp.mobius.opis.data.managers;
|
||||
|
||||
import com.google.common.collect.HashBasedTable;
|
||||
import com.google.common.collect.Table;
|
||||
import com.google.common.collect.Table.Cell;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.mobiuscore.monitors.MonitoredTileList;
|
||||
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
|
||||
import mcp.mobius.opis.data.holders.basetypes.AmountHolder;
|
||||
@@ -21,6 +19,7 @@ import mcp.mobius.opis.data.holders.stats.StatsChunk;
|
||||
import mcp.mobius.opis.data.profilers.ProfilerTileEntityUpdate;
|
||||
import mcp.mobius.opis.helpers.ModIdentification;
|
||||
import mcp.mobius.opis.modOpis;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -28,24 +27,27 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
import com.google.common.collect.HashBasedTable;
|
||||
import com.google.common.collect.Table;
|
||||
import com.google.common.collect.Table.Cell;
|
||||
|
||||
public enum TileEntityManager {
|
||||
|
||||
INSTANCE;
|
||||
|
||||
public HashMap<CoordinatesChunk, StatsChunk> getTimes(int dim) {
|
||||
HashMap<CoordinatesChunk, StatsChunk> chunks = new HashMap<CoordinatesChunk, StatsChunk>();
|
||||
|
||||
for (CoordinatesBlock coord :
|
||||
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet()) {
|
||||
for (CoordinatesBlock coord : ((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data
|
||||
.keySet()) {
|
||||
if (coord.dim == dim) {
|
||||
|
||||
CoordinatesChunk coordC = new CoordinatesChunk(coord);
|
||||
if (!(chunks.containsKey(coordC))) chunks.put(coordC, new StatsChunk());
|
||||
|
||||
chunks.get(coordC).addEntity();
|
||||
chunks.get(coordC)
|
||||
.addMeasure(((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler())
|
||||
.data
|
||||
.get(coord)
|
||||
chunks.get(coordC).addMeasure(
|
||||
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.get(coord)
|
||||
.getGeometricMean());
|
||||
}
|
||||
}
|
||||
@@ -55,23 +57,13 @@ public enum TileEntityManager {
|
||||
private void cleanUpStats() {
|
||||
|
||||
/*
|
||||
HashSet<CoordinatesBlock> dirty = new HashSet<CoordinatesBlock>();
|
||||
|
||||
for (CoordinatesBlock tecoord : TileEntityManager.stats.keySet()){
|
||||
World world = DimensionManager.getWorld(tecoord.dim);
|
||||
int blockID = world.getBlockId(tecoord.x, tecoord.y, tecoord.z);
|
||||
short blockMeta = (short)world.getBlockMetadata(tecoord.x, tecoord.y, tecoord.z);
|
||||
|
||||
if ((blockID != TileEntityManager.stats.get(tecoord).getID()) || (blockMeta != TileEntityManager.stats.get(tecoord).getMeta())){
|
||||
dirty.add(tecoord);
|
||||
}
|
||||
}
|
||||
|
||||
for (CoordinatesBlock tecoord : dirty){
|
||||
stats.remove(tecoord);
|
||||
references.remove(tecoord);
|
||||
}
|
||||
*/
|
||||
* HashSet<CoordinatesBlock> dirty = new HashSet<CoordinatesBlock>(); for (CoordinatesBlock tecoord :
|
||||
* TileEntityManager.stats.keySet()){ World world = DimensionManager.getWorld(tecoord.dim); int blockID =
|
||||
* world.getBlockId(tecoord.x, tecoord.y, tecoord.z); short blockMeta = (short)world.getBlockMetadata(tecoord.x,
|
||||
* tecoord.y, tecoord.z); if ((blockID != TileEntityManager.stats.get(tecoord).getID()) || (blockMeta !=
|
||||
* TileEntityManager.stats.get(tecoord).getMeta())){ dirty.add(tecoord); } } for (CoordinatesBlock tecoord :
|
||||
* dirty){ stats.remove(tecoord); references.remove(tecoord); }
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@@ -80,8 +72,8 @@ public enum TileEntityManager {
|
||||
|
||||
ArrayList<DataBlockTileEntity> returnList = new ArrayList<DataBlockTileEntity>();
|
||||
|
||||
for (CoordinatesBlock tecoord :
|
||||
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet()) {
|
||||
for (CoordinatesBlock tecoord : ((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME
|
||||
.getProfiler()).data.keySet()) {
|
||||
if (coord.equals(tecoord.asCoordinatesChunk())) {
|
||||
DataBlockTileEntity testats = new DataBlockTileEntity().fill(tecoord);
|
||||
|
||||
@@ -96,8 +88,8 @@ public enum TileEntityManager {
|
||||
ArrayList<DataBlockTileEntity> sorted = new ArrayList<DataBlockTileEntity>();
|
||||
ArrayList<DataBlockTileEntity> topEntities = new ArrayList<DataBlockTileEntity>();
|
||||
|
||||
for (CoordinatesBlock coord :
|
||||
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet())
|
||||
for (CoordinatesBlock coord : ((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data
|
||||
.keySet())
|
||||
sorted.add(new DataBlockTileEntity().fill(coord));
|
||||
|
||||
Collections.sort(sorted);
|
||||
@@ -109,11 +101,9 @@ public enum TileEntityManager {
|
||||
|
||||
public DataTiming getTotalUpdateTime() {
|
||||
double updateTime = 0D;
|
||||
for (CoordinatesBlock coords :
|
||||
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet()) {
|
||||
updateTime += ((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler())
|
||||
.data
|
||||
.get(coords)
|
||||
for (CoordinatesBlock coords : ((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME
|
||||
.getProfiler()).data.keySet()) {
|
||||
updateTime += ((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.get(coords)
|
||||
.getGeometricMean();
|
||||
}
|
||||
return new DataTiming(updateTime);
|
||||
@@ -137,18 +127,19 @@ public enum TileEntityManager {
|
||||
TileEntity tileEntity = (TileEntity) o;
|
||||
if (tileEntity == null) continue;
|
||||
CoordinatesBlock coord = new CoordinatesBlock(
|
||||
world.provider.dimensionId, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
world.provider.dimensionId,
|
||||
tileEntity.xCoord,
|
||||
tileEntity.yCoord,
|
||||
tileEntity.zCoord);
|
||||
int hash = System.identityHashCode(tileEntity);
|
||||
|
||||
if (registeredEntities.contains(hash)) continue; // This entitie has already been seen;
|
||||
|
||||
Block block = world.getBlock(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
if (block == Blocks.air
|
||||
|| block == null
|
||||
if (block == Blocks.air || block == null
|
||||
|| !block.hasTileEntity(0)
|
||||
|| world.getTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord) == null
|
||||
|| world.getTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord)
|
||||
.getClass()
|
||||
|| world.getTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord).getClass()
|
||||
!= tileEntity.getClass()) {
|
||||
|
||||
orphans.add(new DataTileEntity().fill(tileEntity, "Orphan"));
|
||||
@@ -182,26 +173,22 @@ public enum TileEntityManager {
|
||||
if (world == null) continue;
|
||||
|
||||
if (!(world.loadedTileEntityList instanceof MonitoredTileList)) {
|
||||
modOpis.log.info("Improper type detected for tile entity list in world " + dim
|
||||
+ ". Regenerating tracking list.");
|
||||
modOpis.log.info(
|
||||
"Improper type detected for tile entity list in world " + dim
|
||||
+ ". Regenerating tracking list.");
|
||||
|
||||
/*
|
||||
* MonitoredTileList will, whenever a tile entity is added to it, load the block at the tile
|
||||
* entity's position. This can cause Minecraft to load chunks, which will result in more tile
|
||||
* entities being added to world.loadedTileEntityList.
|
||||
*
|
||||
* If we iterate through world.loadedTileEntityList and add its entries to newList, this would
|
||||
* result in getting a ConcurrentModificationException. We get around this by using a regular
|
||||
* for-loop instead of a for-each loop.
|
||||
*
|
||||
* As a bonus, since the for-loop checks world.loadedTileEntityList.size() at the start of each
|
||||
* loop iteration, it'll pick up any new entries in world.loadedTileEntityList immediately, and will
|
||||
* add them to newList without requiring us to check separately. However, this does require a few
|
||||
* assumptions about what can happen in the for-loop body:
|
||||
* 1. New entries are always added at the end of world.loadedTileEntityList
|
||||
* 2. Entries are never removed from world.loadedTileEntityList
|
||||
* WARNING: if any of those assumptions are broken, we will likely get unexpected behavior that is
|
||||
* also extremely difficult to debug!
|
||||
* MonitoredTileList will, whenever a tile entity is added to it, load the block at the tile entity's
|
||||
* position. This can cause Minecraft to load chunks, which will result in more tile entities being
|
||||
* added to world.loadedTileEntityList. If we iterate through world.loadedTileEntityList and add its
|
||||
* entries to newList, this would result in getting a ConcurrentModificationException. We get around
|
||||
* this by using a regular for-loop instead of a for-each loop. As a bonus, since the for-loop checks
|
||||
* world.loadedTileEntityList.size() at the start of each loop iteration, it'll pick up any new entries
|
||||
* in world.loadedTileEntityList immediately, and will add them to newList without requiring us to check
|
||||
* separately. However, this does require a few assumptions about what can happen in the for-loop body:
|
||||
* 1. New entries are always added at the end of world.loadedTileEntityList 2. Entries are never removed
|
||||
* from world.loadedTileEntityList WARNING: if any of those assumptions are broken, we will likely get
|
||||
* unexpected behavior that is also extremely difficult to debug!
|
||||
*/
|
||||
|
||||
List<TileEntity> newList = new MonitoredTileList<TileEntity>();
|
||||
@@ -238,18 +225,16 @@ public enum TileEntityManager {
|
||||
public ArrayList<DataBlockTileEntityPerClass> getCumulativeTimingTileEntities() {
|
||||
HashBasedTable<Integer, Integer, DataBlockTileEntityPerClass> data = HashBasedTable.create();
|
||||
|
||||
for (CoordinatesBlock coord :
|
||||
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet()) {
|
||||
for (CoordinatesBlock coord : ((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data
|
||||
.keySet()) {
|
||||
World world = DimensionManager.getWorld(coord.dim);
|
||||
int id = Block.getIdFromBlock(world.getBlock(coord.x, coord.y, coord.z));
|
||||
int meta = world.getBlockMetadata(coord.x, coord.y, coord.z);
|
||||
|
||||
if (!data.contains(id, meta)) data.put(id, meta, new DataBlockTileEntityPerClass(id, meta));
|
||||
|
||||
data.get(id, meta)
|
||||
.add(((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler())
|
||||
.data
|
||||
.get(coord)
|
||||
data.get(id, meta).add(
|
||||
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.get(coord)
|
||||
.getGeometricMean());
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 216 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user