コード例 #1
0
 static void setup(Mod mod) {
   mod.addClassMod(new WorldMod(mod));
   mod.addClassMod(new WorldClientMod(mod));
   mod.addClassMod(new WorldProviderMod(mod));
   mod.addClassMod(new WorldProviderHellMod(mod));
   mod.addClassMod(new WorldProviderEndMod(mod));
   mod.addClassMod(new WorldChunkManagerMod(mod));
   mod.addClassMod(new RenderGlobalMod(mod));
   mod.addClassMod(new FontRendererMod(mod));
   mod.addClassMod(new TileEntitySignRendererMod(mod));
   mod.addClassMod(new EntityRendererMod(mod));
 }
コード例 #2
0
  public NBTTagCompoundMod(Mod mod) {
    super(mod);
    setParentClass("NBTBase");

    addClassSignature(
        new OrSignature(
            new ConstSignature(new ClassRef("java.util.HashMap")),
            new ConstSignature(new ClassRef("java.util.Map"))));
    if (Mod.getMinecraftVersion().compareTo("13w36a") >= 0) {
      addClassSignature(
          new ConstSignature(new InterfaceMethodRef("java/io/DataInput", "readByte", "()B")));
      addClassSignature(
          new ConstSignature(
              new InterfaceMethodRef("java/io/DataInput", "readUTF", "()Ljava/lang/String;")));
    } else {
      addClassSignature(new ConstSignature(":["));
      addClassSignature(new ConstSignature(":"));
      addClassSignature(new ConstSignature(","));
      addClassSignature(new ConstSignature("]"));
    }

    addClassSignature(
        new BytecodeSignature() {
          {
            setMethod(new MethodRef(getDeobfClass(), "hasKey", "(Ljava/lang/String;)Z"));
            addXref(1, tagMap);
          }

          @Override
          public String getMatchExpression() {
            return buildExpression(
                ALOAD_0,
                captureReference(GETFIELD),
                ALOAD_1,
                reference(INVOKEINTERFACE, containsKey),
                IRETURN);
          }
        });

    addClassSignature(
        new BytecodeSignature() {
          {
            setMethod(new MethodRef(getDeobfClass(), "removeTag", "(Ljava/lang/String;)V"));
            addXref(1, tagMap);
          }

          @Override
          public String getMatchExpression() {
            return buildExpression(
                ALOAD_0,
                captureReference(GETFIELD),
                ALOAD_1,
                reference(INVOKEINTERFACE, mapRemove));
          }
        });

    mapNBTMethod("Byte", "B");
    mapNBTMethod("ByteArray", "[B");
    mapNBTMethod("Double", "D");
    mapNBTMethod("Float", "F");
    mapNBTMethod("IntArray", "[I");
    mapNBTMethod("Integer", "I");
    mapNBTMethod("Long", "J");
    mapNBTMethod("Short", "S");
    mapNBTMethod("String", "Ljava/lang/String;");

    addMemberMapper(
        new MethodMapper(
            null, new MethodRef(getDeobfClass(), "getBoolean", "(Ljava/lang/String;)Z")));
    addMemberMapper(
        new MethodMapper(new MethodRef(getDeobfClass(), "setBoolean", "(Ljava/lang/String;Z)V")));
    addMemberMapper(
        new MethodMapper(
            new MethodRef(
                getDeobfClass(),
                "getCompoundTag",
                "(Ljava/lang/String;)L" + getDeobfClass() + ";")));
    addMemberMapper(
        new MethodMapper(
            new MethodRef(getDeobfClass(), "getTag", "(Ljava/lang/String;)LNBTBase;")));
  }