Exemplo n.º 1
0
 private static void handleTileEntityPacket(Packet230ModLoader packet230modloader) {
   if (packet230modloader.dataInt == null || packet230modloader.dataInt.length < 5) {
     log("Bad TileEntityPacket received.");
   } else {
     int i = packet230modloader.dataInt[0];
     int j = packet230modloader.dataInt[1];
     int k = packet230modloader.dataInt[2];
     int l = packet230modloader.dataInt[3];
     int i1 = packet230modloader.dataInt[4];
     int ai[] = new int[packet230modloader.dataInt.length - 5];
     System.arraycopy(packet230modloader.dataInt, 5, ai, 0, packet230modloader.dataInt.length - 5);
     float af[] = packet230modloader.dataFloat;
     String as[] = packet230modloader.dataString;
     for (int j1 = 0; j1 < ModLoader.getLoadedMods().size(); j1++) {
       BaseMod basemod = (BaseMod) ModLoader.getLoadedMods().get(j1);
       if (!(basemod instanceof BaseModMp)) {
         continue;
       }
       BaseModMp basemodmp = (BaseModMp) basemod;
       if (basemodmp.getId() != i) {
         continue;
       }
       basemodmp.handleTileEntityPacket(j, k, l, i1, ai, af, as);
       break;
     }
   }
 }
Exemplo n.º 2
0
  public static void handleAllPackets(Packet230ModLoader packet230modloader) {
    if (!hasInit) {
      initializePrivate();
    }
    packet230Received = true;
    if (packet230modloader.modId == "ModLoaderMP".hashCode()) {
      switch (packet230modloader.packetType) {
        case 0: // '\0'
          handleModCheck(packet230modloader);
          break;

        case 1: // '\001'
          handleTileEntityPacket(packet230modloader);
          break;
      }
    } else if (packet230modloader.modId == "Spawn".hashCode()) {
      NetClientHandlerEntity netclienthandlerentity =
          handleNetClientHandlerEntities(packet230modloader.packetType);
      if (netclienthandlerentity != null
          && (net.minecraft.src.ISpawnable.class)
              .isAssignableFrom(netclienthandlerentity.entityClass)) {
        try {
          Entity entity =
              (Entity)
                  netclienthandlerentity
                      .entityClass
                      .getConstructor(new Class[] {net.minecraft.src.World.class})
                      .newInstance(new Object[] {ModLoader.getMinecraftInstance().field_71441_e});
          ((ISpawnable) entity).spawn(packet230modloader);
          ModLoader.getMinecraftInstance().field_71441_e.func_73027_a(entity.field_70157_k, entity);
        } catch (Exception exception) {
          ModLoader.getLogger().throwing("ModLoader", "handleCustomSpawn", exception);
          ModLoader.throwException(
              String.format(
                  "Error initializing entity of type %s.",
                  new Object[] {Integer.valueOf(packet230modloader.packetType)}),
              exception);
          return;
        }
      }
    } else {
      for (int i = 0; i < ModLoader.getLoadedMods().size(); i++) {
        BaseMod basemod = (BaseMod) ModLoader.getLoadedMods().get(i);
        if (!(basemod instanceof BaseModMp)) {
          continue;
        }
        BaseModMp basemodmp = (BaseModMp) basemod;
        if (basemodmp.getId() != packet230modloader.modId) {
          continue;
        }
        basemodmp.handlePacket(packet230modloader);
        break;
      }
    }
  }
Exemplo n.º 3
0
 public static void handleGUI(Packet100OpenWindow packet100openwindow) {
   if (!hasInit) {
     initializePrivate();
   }
   BaseModMp basemodmp =
       (BaseModMp) guiModMap.get(Integer.valueOf(packet100openwindow.field_73429_b));
   GuiScreen guiscreen = basemodmp.handleGUI(packet100openwindow.field_73429_b);
   if (guiscreen != null) {
     ModLoader.openGUI(ModLoader.getMinecraftInstance().field_71439_g, guiscreen);
     ModLoader.getMinecraftInstance().field_71439_g.field_71070_bA.field_75152_c =
         packet100openwindow.field_73431_a;
   }
 }
Exemplo n.º 4
0
 public static void sendPacket(BaseModMp basemodmp, Packet230ModLoader packet230modloader) {
   if (!hasInit) {
     initializePrivate();
   }
   if (basemodmp == null) {
     IllegalArgumentException illegalargumentexception =
         new IllegalArgumentException("baseModMp cannot be null.");
     ModLoader.getLogger().throwing("ModLoaderMp", "SendPacket", illegalargumentexception);
     ModLoader.throwException("baseModMp cannot be null.", illegalargumentexception);
   } else {
     packet230modloader.modId = basemodmp.getId();
     sendPacket(packet230modloader);
   }
 }
Exemplo n.º 5
0
 public static void sendKey(BaseModMp basemodmp, int i) {
   if (!hasInit) {
     initializePrivate();
   }
   if (basemodmp == null) {
     IllegalArgumentException illegalargumentexception =
         new IllegalArgumentException("baseModMp cannot be null.");
     ModLoader.getLogger().throwing("ModLoaderMp", "SendKey", illegalargumentexception);
     ModLoader.throwException("baseModMp cannot be null.", illegalargumentexception);
   } else {
     Packet230ModLoader packet230modloader = new Packet230ModLoader();
     packet230modloader.modId = "ModLoaderMP".hashCode();
     packet230modloader.packetType = 1;
     packet230modloader.dataInt = (new int[] {basemodmp.getId(), i});
     sendPacket(packet230modloader);
   }
 }