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; } } }
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; } } }
private static void handleModCheck(Packet230ModLoader packet230modloader) { Packet230ModLoader packet230modloader1 = new Packet230ModLoader(); packet230modloader1.modId = "ModLoaderMP".hashCode(); packet230modloader1.packetType = 0; packet230modloader1.dataString = new String[ModLoader.getLoadedMods().size()]; for (int i = 0; i < ModLoader.getLoadedMods().size(); i++) { packet230modloader1.dataString[i] = ((BaseMod) ModLoader.getLoadedMods().get(i)).toString(); } sendPacket(packet230modloader1); }
public static BaseModMp getModInstance(Class class1) { 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 (class1.isInstance(basemodmp)) { return (BaseModMp) ModLoader.getLoadedMods().get(i); } } return null; }