@Override
 protected void readData(ByteArrayDataInput in) throws IOException {
   x = in.readInt();
   y = in.readShort();
   z = in.readInt();
   charge = in.readInt();
 }
Esempio n. 2
0
  @Override
  public void read(ByteArrayDataInput dataStream, EntityPlayer player, World world)
      throws Exception {
    Random random = new Random();

    int x = dataStream.readInt();
    int y = dataStream.readInt();
    int z = dataStream.readInt();

    for (int i = 0; i < 50; i++) {
      world.spawnParticle(
          "portal",
          x + random.nextFloat(),
          y + random.nextFloat(),
          z + random.nextFloat(),
          0.0F,
          0.0F,
          0.0F);
      world.spawnParticle(
          "portal",
          x + random.nextFloat(),
          y + 1 + random.nextFloat(),
          z + random.nextFloat(),
          0.0F,
          0.0F,
          0.0F);
    }
  }
 @Override
 public void readSpawnData(ByteArrayDataInput data) {
   returnStack = new ItemStack(data.readShort(), 1, 0);
   rotationYaw = data.readFloat();
   NBTTagCompound compound = new NBTTagCompound();
   NBTTagCompound toolTag = new NBTTagCompound();
   toolTag.setInteger("RenderHandle", data.readInt());
   toolTag.setInteger("RenderHead", data.readInt());
   toolTag.setInteger("RenderAccessory", data.readInt());
   switch (data.readInt()) {
     case 6:
       toolTag.setInteger("Effect6", data.readInt());
     case 5:
       toolTag.setInteger("Effect5", data.readInt());
     case 4:
       toolTag.setInteger("Effect4", data.readInt());
     case 3:
       toolTag.setInteger("Effect3", data.readInt());
     case 2:
       toolTag.setInteger("Effect2", data.readInt());
     case 1:
       toolTag.setInteger("Effect1", data.readInt());
   }
   compound.setCompoundTag("InfiTool", toolTag);
   returnStack.setTagCompound(compound);
 }
Esempio n. 4
0
 @Override
 public void read(ByteArrayDataInput in) {
   playerName = in.readUTF();
   x = in.readInt();
   y = in.readInt();
   z = in.readInt();
   size = in.readInt();
   types = in.readInt();
   remove = in.readBoolean();
   upgrade = in.readChar();
   downgrade = in.readChar();
 }
  @Override
  public void handlePacketData(ByteArrayDataInput dataStream) {
    super.handlePacketData(dataStream);

    if (dataStream.readInt() == 1) {
      fluidTank.setFluid(new FluidStack(dataStream.readInt(), dataStream.readInt()));
    } else {
      fluidTank.setFluid(null);
    }

    MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
  }
 @Override
 public void handle(NetHandler handler, Packet131MapData mapData) {
   ByteArrayDataInput in = ByteStreams.newDataInput(mapData.itemData);
   EntityPlayer player = handler.getPlayer();
   World world = player.worldObj;
   int x;
   int y;
   int z;
   switch (mapData.uniqueID) { // this is your PACKET_ID from above
     case EXPORTER_GUI:
       x = in.readInt();
       y = in.readInt();
       z = in.readInt();
       if (QBEBlockType.NonSolids.EXPORTER.matches(world, x, y, z)) {
         TileEntityExporter eb = (TileEntityExporter) world.getBlockTileEntity(x, y, z);
         eb.xSize = in.readInt();
         eb.ySize = in.readInt();
         eb.zSize = in.readInt();
       }
       break;
     case INTERFACE_GUI_SAVE:
       x = in.readInt();
       y = in.readInt();
       z = in.readInt();
       int dimX = in.readInt();
       int dimY = in.readInt();
       int dimZ = in.readInt();
   }
 }
 @Override
 public void handlePacketData(
     INetworkManager network,
     int type,
     Packet250CustomPayload packet,
     EntityPlayer player,
     ByteArrayDataInput dataStream) {
   int id = dataStream.readInt();
   switch (id) {
     case -1:
       this.sendPacketToClients = dataStream.readBoolean();
       break;
     case 1:
       this.grindingTicks = dataStream.readInt();
   }
 }
 @Override
 public void handlePacketData(
     INetworkManager network,
     int packetType,
     Packet250CustomPayload packet,
     EntityPlayer player,
     ByteArrayDataInput dataStream) {
   try {
     if (this.worldObj.isRemote) {
       this.buggyType = dataStream.readInt();
       this.buggyFuelTank.setFluid(new FluidStack(GalacticraftCore.FUEL, dataStream.readInt()));
     }
   } catch (final Exception e) {
     e.printStackTrace();
   }
 }
 @Override
 public void readSpawnData(ByteArrayDataInput data) {
   this.BirthTick = data.readInt();
   this.DinoInside = EnumDinoType.values()[data.readInt()];
   /*String tmp=data.readLine();
   if (tmp==null ||tmp.isEmpty()){
   	this.ParentOwner="";
   	return;
   }
   StringBuilder dataResult=new StringBuilder();
   char readTmp;
   for (int i=0;i<tmp.length();i++){
   	readTmp=tmp.charAt(i);
   	if (readTmp!=0x20) dataResult.append(readTmp);
   }
   this.ParentOwner=dataResult.toString();*/
 }
  @Override
  public void readNetworkedData(ByteArrayDataInput dataStream) {
    super.readNetworkedData(dataStream);
    this.spaceshipFuelTank.setFluid(new FluidStack(GalacticraftCore.FUEL, dataStream.readInt()));

    if (this.cargoItems == null) {
      this.cargoItems = new ItemStack[this.getSizeInventory()];
    }
  }
Esempio n. 11
0
  @Override
  public FMLPacket consumePacket(byte[] data) {
    ByteArrayDataInput dat = ByteStreams.newDataInput(data);
    int versionListSize = dat.readInt();
    modVersions = Maps.newHashMapWithExpectedSize(versionListSize);
    for (int i = 0; i < versionListSize; i++) {
      String modName = dat.readUTF();
      String modVersion = dat.readUTF();
      modVersions.put(modName, modVersion);
    }

    int missingModSize = dat.readInt();
    missingMods = Lists.newArrayListWithExpectedSize(missingModSize);

    for (int i = 0; i < missingModSize; i++) {
      missingMods.add(dat.readUTF());
    }
    return this;
  }
Esempio n. 12
0
  private ClassPatch readPatch(JarEntry patchEntry, JarInputStream jis) throws IOException {
    log("\t%s", patchEntry.getName());
    ByteArrayDataInput input = ByteStreams.newDataInput(ByteStreams.toByteArray(jis));

    String name = input.readUTF();
    String sourceClassName = input.readUTF();
    String targetClassName = input.readUTF();
    boolean exists = input.readBoolean();
    int inputChecksum = 0;
    if (exists) {
      inputChecksum = input.readInt();
    }
    int patchLength = input.readInt();
    byte[] patchBytes = new byte[patchLength];
    input.readFully(patchBytes);

    return new ClassPatch(
        name, sourceClassName, targetClassName, exists, inputChecksum, patchBytes);
  }
  @Override
  public void readSpawnData(ByteArrayDataInput data) {
    int anglerId = data.readInt();

    angler = (AbstractEntity) worldObj.getEntityByID(anglerId);

    if (angler != null) {
      angler.fishingChore.fishEntity = this;
      angler.tasks.taskEntries.clear();
    }
  }
Esempio n. 14
0
  @Override
  public void read(ByteArrayDataInput dataStream, EntityPlayer player, World world)
      throws Exception {
    int index = dataStream.readInt();
    int digit = dataStream.readInt();

    ItemStack currentStack = player.getCurrentEquippedItem();

    if (currentStack != null && currentStack.getItem() instanceof ItemPortableTeleporter) {
      ItemPortableTeleporter item = (ItemPortableTeleporter) currentStack.getItem();
      item.setDigit(currentStack, index, digit);
    }
  }
Esempio n. 15
0
 @Override
 public FMLPacket consumePacket(byte[] data) {
   sentModList = Lists.newArrayList();
   ByteArrayDataInput in = ByteStreams.newDataInput(data);
   int listSize = in.readInt();
   for (int i = 0; i < listSize; i++) {
     sentModList.add(in.readUTF());
   }
   try {
     compatibilityLevel = in.readByte();
   } catch (IllegalStateException e) {
     FMLLog.fine("No compatibility byte found - the server is too old");
   }
   return this;
 }
  @Override
  public void onPluginMessageReceived(String channel, Player player, byte[] message) {
    Bukkit.getLogger().info("Message received on channel " + channel);
    if (!channel.equals("BungeeMessaging")) return;

    ByteArrayDataInput in = ByteStreams.newDataInput(message);
    String subChannel = in.readUTF();
    int nbMessage = in.readInt();
    List<String> messageList = new ArrayList<String>();
    for (int i = 0; i < nbMessage; i++) {
      messageList.add(in.readUTF());
    }
    if (messageList.contains("delayed")) messageList.remove("delayed");

    Bukkit.getServer()
        .getPluginManager()
        .callEvent(new MessageReceivedEvent(player, subChannel, messageList));
  }
  @Override
  public void recievePacket(ByteArrayDataInput data) {
    direction = data.readInt();
    int id = data.readInt();
    int meta = data.readInt();
    int id2 = data.readInt();
    int meta2 = data.readInt();
    int enc = data.readInt();

    progBar = data.readInt();

    if (worldObj != null && worldObj.isRemote) {
      inv[0] = new ItemStack(id, 1, meta);

      if (blockChange(id2, meta2)) {
        if (MineFantasyBase.isDebug()) System.out.println("Detected Benchtop tex change");

        worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
      }
      inv[1] = new ItemStack(id2, 1, meta2);
      displayGlint = enc == 1;
    }
  }
Esempio n. 18
0
 public void serialize(ByteArrayDataInput in) {
   this.id = in.readInt();
   this.type = ServerType.getType(in.readUTF());
 }
  /**
   * method to handle packets that were sent to the server. mostly the same as above but with
   * different handling.
   *
   * @param manager
   * @param packet
   * @param player
   * @param dat
   * @param ID
   */
  public void handleServerPacket(
      Packet packet, EntityPlayer player, ByteArrayDataInput dat, short ID) {
    EntityPlayerMP thePlayer = (EntityPlayerMP) player;
    World world = thePlayer.worldObj;

    if (ID == 1) {
      int coords[] = new int[3];

      for (int var1 = 0; var1 < 3; var1++) {
        coords[var1] = dat.readInt();
      }

      TileEntityPressurePlate tpp =
          (TileEntityPressurePlate) world.getTileEntity(coords[0], coords[1], coords[2]);
      short var3 = dat.readShort();
      StringBuilder var4 = new StringBuilder();

      for (int var5 = 0; var5 < var3; var5++) {
        var4.append(dat.readChar());
      }

      String var6 = var4.toString();
      tpp.switchMob(var6, world);
      return;
    }

    if (ID == 2) {
      int coords[] = new int[3];

      for (int var1 = 0; var1 < 3; var1++) {
        coords[var1] = dat.readInt();
      }

      TileEntityPressurePlate tpp =
          (TileEntityPressurePlate) world.getTileEntity(coords[0], coords[1], coords[2]);
      short var3 = dat.readShort();
      StringBuilder var4 = new StringBuilder();

      for (int var5 = 0; var5 < var3; var5++) {
        var4.append(dat.readChar());
      }

      String var6 = var4.toString();
      tpp.switchPlayer(var6, world);
      return;
    }

    if (ID == 3) {
      int coords[] = new int[3];

      for (int var1 = 0; var1 < 3; var1++) {
        coords[var1] = dat.readInt();
      }

      if (world.getTileEntity(coords[0], coords[1], coords[2]) instanceof TileEntityPressurePlate) {
        TileEntityPressurePlate tpp =
            (TileEntityPressurePlate) world.getTileEntity(coords[0], coords[1], coords[2]);
        int usernameLength = dat.readInt();
        String username = "";

        for (int var2 = 0; var2 < usernameLength; var2++) {
          char c = dat.readChar();
          username = new StringBuilder().append(username).append(c).toString();
        }

        int playerUsernameLength = dat.readInt();
        String playerUsername = "";

        for (int var2 = 0; var2 < playerUsernameLength; var2++) {
          char c = dat.readChar();
          playerUsername = new StringBuilder().append(playerUsername).append(c).toString();
        }

        boolean bool = tpp.addPlayer(username);
        PacketSendManager.sendAddBooleanToClient(
            bool, coords[0], coords[1], coords[2], playerUsername);
        PacketSendManager.sendPressurePlatePlayerDataToClient(tpp);
      }

      return;
    }

    if (ID == 4) {
      int coords[] = new int[3];

      for (int var1 = 0; var1 < 3; var1++) {
        coords[var1] = dat.readInt();
      }

      if (world.getTileEntity(coords[0], coords[1], coords[2]) instanceof TileEntityPressurePlate) {
        TileEntityPressurePlate tpp =
            (TileEntityPressurePlate) world.getTileEntity(coords[0], coords[1], coords[2]);
        int usernameLength = dat.readInt();
        String username = "";

        for (int var2 = 0; var2 < usernameLength; var2++) {
          char c = dat.readChar();
          username = new StringBuilder().append(username).append(c).toString();
        }

        String playerUsername = "";
        int playerUsernameLength = dat.readInt();

        for (int var3 = 0; var3 < playerUsernameLength; var3++) {
          char c = dat.readChar();
          playerUsername = new StringBuilder().append(playerUsername).append(c).toString();
        }

        boolean bool = tpp.removePlayer(username);
        PacketSendManager.sendRemoveBooleanToClient(
            bool, coords[0], coords[1], coords[2], playerUsername);
        PacketSendManager.sendPressurePlatePlayerDataToClient(tpp);
      }

      return;
    }

    if (ID == 5) {
      int coords[] = new int[3];

      for (int var1 = 0; var1 < 3; var1++) {
        coords[var1] = dat.readInt();
      }

      if (world.getTileEntity(coords[0], coords[1], coords[2]) instanceof TileEntityPressurePlate) {
        TileEntityPressurePlate tpp =
            (TileEntityPressurePlate) world.getTileEntity(coords[0], coords[1], coords[2]);
        PacketSendManager.sendPressurePlatePlayerDataToClient(tpp);
      }

      return;
    }

    if (ID == 6) {
      int[] coords = new int[3];

      for (int var2 = 0; var2 < 3; var2++) {
        coords[var2] = dat.readInt();
      }

      TileEntityPressurePlate tpp = null;

      if (world.getTileEntity(coords[0], coords[1], coords[2]) instanceof TileEntityPressurePlate) {
        tpp = (TileEntityPressurePlate) world.getTileEntity(coords[0], coords[1], coords[2]);
      }

      if (tpp != null) {
        PacketSendManager.sendPressurePlateMobDataToClient(tpp);
        PacketSendManager.sendPressurePlatePlayerDataToClient(tpp);
        PacketSendManager.sendSettingsDataToClient(tpp);
        PacketSendManager.sendChangedDataToClient(tpp);
      }

      return;
    }

    if (ID == 7) {
      PPRegistry.loggedIn = true;
    }

    if (ID == 8) {
      int coords[] = new int[3];

      for (int var1 = 0; var1 < 3; var1++) {
        coords[var1] = dat.readInt();
      }

      TileEntityPressurePlate tpp = null;

      if (world.getTileEntity(coords[0], coords[1], coords[2]) instanceof TileEntityPressurePlate) {
        tpp = (TileEntityPressurePlate) world.getTileEntity(coords[0], coords[1], coords[2]);
      }

      if (tpp != null) {
        int index = dat.readInt();
        tpp.switchSetting(index);
      }

      return;
    }

    if (ID == 9) {
      int coords[] = new int[3];

      for (int var1 = 0; var1 < 3; var1++) {
        coords[var1] = dat.readInt();
      }

      TileEntityPressurePlate tpp = null;

      if (world.getTileEntity(coords[0], coords[1], coords[2]) instanceof TileEntityPressurePlate) {
        tpp = (TileEntityPressurePlate) world.getTileEntity(coords[0], coords[1], coords[2]);
      }

      if (tpp != null) {
        int length = dat.readInt();
        StringBuilder sb = new StringBuilder();

        for (int var1 = 0; var1 < length; var1++) {
          sb.append(dat.readChar());
        }

        String s = sb.toString();
        tpp.password = s;
        PacketSendManager.sendPasswordSetToClient(tpp, player);
      }

      return;
    }

    if (ID == 10) {
      int coords[] = new int[3];

      for (int var1 = 0; var1 < 3; var1++) {
        coords[var1] = dat.readInt();
      }

      TileEntityPressurePlate tpp = null;

      if (world.getTileEntity(coords[0], coords[1], coords[2]) instanceof TileEntityPressurePlate) {
        tpp = (TileEntityPressurePlate) world.getTileEntity(coords[0], coords[1], coords[2]);
      }

      if (tpp != null) {
        int length = dat.readInt();
        StringBuilder sb = new StringBuilder();

        for (int var1 = 0; var1 < length; var1++) {
          sb.append(dat.readChar());
        }

        String s = sb.toString();
        boolean b = tpp.password.matches(s);
        PacketSendManager.sendPasswordResponseToClient(tpp, b, thePlayer);
      }

      return;
    }

    if (ID == 11) {
      int coords[] = new int[3];

      for (int var1 = 0; var1 < 3; var1++) {
        coords[var1] = dat.readInt();
      }

      TileEntityPressurePlate tpp = null;

      if (world.getTileEntity(coords[0], coords[1], coords[2]) instanceof TileEntityPressurePlate) {
        tpp = (TileEntityPressurePlate) world.getTileEntity(coords[0], coords[1], coords[2]);
      }

      if (tpp != null) {
        PacketSendManager.sendPasswordToClient(tpp, thePlayer);
      }

      return;
    }

    if (ID == 12) {
      int coords[] = new int[3];

      for (int var1 = 0; var1 < 3; var1++) {
        coords[var1] = dat.readInt();
      }

      int GuiID = dat.readInt();
      TileEntityPressurePlate tpp = null;

      if (world.getTileEntity(coords[0], coords[1], coords[2]) instanceof TileEntityPressurePlate) {
        tpp = (TileEntityPressurePlate) world.getTileEntity(coords[0], coords[1], coords[2]);
      }

      if (tpp != null) {
        thePlayer.openGui(IronPP.instance, GuiID, world, tpp.xCoord, tpp.yCoord, tpp.zCoord);
      }

      return;
    }

    if (ID == 13) {
      int coords[] = new int[3];

      for (int var1 = 0; var1 < 3; var1++) {
        coords[var1] = dat.readInt();
      }

      world.setBlockToAir(coords[0], coords[1], coords[2]);
    }
    if (ID == 14) {
      int coords[] = new int[3];

      for (int var1 = 0; var1 < 3; var1++) {
        coords[var1] = dat.readInt();
      }
      TileEntity te = world.getTileEntity(coords[0], coords[1], coords[2]);
      if (te instanceof TileEntityPressurePlate) {
        ((TileEntityPressurePlate) te).maxOutput = dat.readInt();
        ((TileEntityPressurePlate) te).itemsForMax = dat.readInt();
        PacketSendManager.sendChangedDataToClient((TileEntityPressurePlate) te);
      }
    }
  }
  /**
   * this is a method for handling packets that were sent to the client.
   *
   * @param manager
   * @param packet
   * @param player
   * @param dat the data that it can read from
   * @param ID the packet ID
   */
  public void handleClientPacket(
      Packet packet, EntityPlayer player, ByteArrayDataInput dat, short ID) {
    EntityPlayer thePlayer = (EntityPlayer) player;
    World world = thePlayer.worldObj;

    if (world != null) {
      if (FMLClientHandler.instance().getClient().currentScreen instanceof GuiAPressurePlate) {
        if (ID == 1) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          if (GuiAPressurePlate.tpp.xCoord == coords[0]
              && GuiAPressurePlate.tpp.yCoord == coords[1]
              && GuiAPressurePlate.tpp.zCoord == coords[2]) {
            ((EntityPlayerSP) thePlayer).closeScreen();
          }

          return;
        }

        if (ID == 2) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          int allowedmobs = dat.readInt();

          if (GuiAPressurePlate.tpp.xCoord == coords[0]
              && GuiAPressurePlate.tpp.yCoord == coords[1]
              && GuiAPressurePlate.tpp.zCoord == coords[2]) {
            for (int var1 = 0; var1 < allowedmobs; var1++) {
              boolean bool = dat.readBoolean();
              GuiAPressurePlate.enabled[var1] = bool;
            }
          }

          return;
        }

        if (ID == 3) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          if (GuiAPressurePlate.tpp.xCoord == coords[0]
              && GuiAPressurePlate.tpp.yCoord == coords[1]
              && GuiAPressurePlate.tpp.zCoord == coords[2]) {
            GuiAPressurePlate.tpp.allowedPlayers.clear();
            int allowedPlayers = dat.readInt();
            {
              for (int var1 = 0; var1 < allowedPlayers; var1++) {
                short nameLength = dat.readShort();
                String username = "";

                for (int var2 = 0; var2 < nameLength; var2++) {
                  username = new StringBuilder().append(username).append(dat.readChar()).toString();
                }

                boolean bool = dat.readBoolean();
                GuiAPressurePlate.tpp.addPlayer(username);
                GuiAPressurePlate.tpp.setEnabledForPlayer(username, bool);
              }

              GuiAPressurePlate.lineUp();
            }
          }

          return;
        }

        if (ID == 4) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          int index = dat.readInt();

          if (GuiAPressurePlate.tpp.xCoord == coords[0]
              && GuiAPressurePlate.tpp.yCoord == coords[1]
              && GuiAPressurePlate.tpp.zCoord == coords[2]) {
            GuiAPressurePlate.switchbutton(index);
          }

          return;
        }

        if (ID == 11) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          if (GuiAPressurePlate.tpp.xCoord == coords[0]
              && GuiAPressurePlate.tpp.yCoord == coords[1]
              && GuiAPressurePlate.tpp.zCoord == coords[2]) {
            if (GuiAPressurePlate.tpp.settings == null) {
              GuiAPressurePlate.tpp.registerSettings();
            }

            int var2 = dat.readInt();

            for (int var3 = 0; var3 < var2; var3++) {
              if (var3 <= GuiAPressurePlate.tpp.settings.size()) {
                GuiAPressurePlate.tpp.setSetting(var3, dat.readBoolean());
              }
            }

            GuiAPressurePlate.LineUpSettings();
          }

          return;
        }

        if (ID == 10) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          if (GuiAPressurePlate.tpp.xCoord == coords[0]
              && GuiAPressurePlate.tpp.yCoord == coords[1]
              && GuiAPressurePlate.tpp.zCoord == coords[2]) {
            int var2 = dat.readInt();

            if (GuiAPressurePlate.tpp.settings.size() >= var2) {
              GuiAPressurePlate.tpp.switchSetting(var2);
            }
          }

          return;
        }
      }

      if (FMLClientHandler.instance().getClient().currentScreen instanceof GuiModifyPressurePlate) {
        if (ID == 1) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          if (GuiAPressurePlate.tpp.xCoord == coords[0]
              && GuiAPressurePlate.tpp.yCoord == coords[1]
              && GuiAPressurePlate.tpp.zCoord == coords[2]) {
            ((EntityPlayerSP) thePlayer).closeScreen();
          }
        }

        if (ID == 3) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          if (GuiAPressurePlate.tpp.xCoord == coords[0]
              && GuiAPressurePlate.tpp.yCoord == coords[1]
              && GuiAPressurePlate.tpp.zCoord == coords[2]) {
            GuiAPressurePlate.tpp.allowedPlayers.clear();
            int allowedPlayers = dat.readInt();
            {
              for (int var1 = 0; var1 < allowedPlayers; var1++) {
                short nameLength = dat.readShort();
                String username = "";

                for (int var2 = 0; var2 < nameLength; var2++) {
                  username = new StringBuilder().append(username).append(dat.readChar()).toString();
                }

                boolean bool = dat.readBoolean();
                GuiAPressurePlate.tpp.setEnabledForPlayer(username, bool);
              }

              GuiAPressurePlate.lineUp();
            }
          }

          return;
        }

        if (ID == 4) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          int index = dat.readInt();

          if (GuiAPressurePlate.tpp.xCoord == coords[0]
              && GuiAPressurePlate.tpp.yCoord == coords[1]
              && GuiAPressurePlate.tpp.zCoord == coords[2]) {
            GuiAPressurePlate.switchbutton(index);
          }

          return;
        }

        if (ID == 5) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          if (GuiAPressurePlate.tpp.xCoord == coords[0]
              && GuiAPressurePlate.tpp.yCoord == coords[1]
              && GuiAPressurePlate.tpp.zCoord == coords[2]) {
            boolean bool = dat.readBoolean();
            int usernamelength = dat.readInt();
            String username = "";

            for (int var2 = 0; var2 < usernamelength; var2++) {
              char c = dat.readChar();
              username = new StringBuilder().append(username).append(c).toString();
            }

            if (thePlayer.getCommandSenderName().matches(username)) {
              if (bool) {
                GuiModifyPressurePlate.showText("Player added", 20);
              } else {
                GuiModifyPressurePlate.showText("Player is already in list", 20);
              }
            }
          }

          return;
        }

        if (ID == 6) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          if (GuiAPressurePlate.tpp.xCoord == coords[0]
              && GuiAPressurePlate.tpp.yCoord == coords[1]
              && GuiAPressurePlate.tpp.zCoord == coords[2]) {
            boolean bool = dat.readBoolean();
            int usernamelength = dat.readInt();
            String username = "";

            for (int var2 = 0; var2 < usernamelength; var2++) {
              char c = dat.readChar();
              username = new StringBuilder().append(username).append(c).toString();
            }

            if (thePlayer.getCommandSenderName().matches(username)) {
              if (bool) {
                GuiModifyPressurePlate.showText("Player removed", 20);
              } else {
                GuiModifyPressurePlate.showText("Player is not in list", 20);
              }
            }
          }

          return;
        }

        if (ID == 10) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          if (GuiAPressurePlate.tpp.xCoord == coords[0]
              && GuiAPressurePlate.tpp.yCoord == coords[1]
              && GuiAPressurePlate.tpp.zCoord == coords[2]) {
            int index = dat.readInt();

            if (GuiAPressurePlate.tpp.settings.size() >= index) {
              GuiAPressurePlate.tpp.switchSetting(index);
            }
          }

          return;
        }

        if (ID == 11) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          if (GuiAPressurePlate.tpp.xCoord == coords[0]
              && GuiAPressurePlate.tpp.yCoord == coords[1]
              && GuiAPressurePlate.tpp.zCoord == coords[2]) {
            if (GuiAPressurePlate.tpp.settings == null) {
              GuiAPressurePlate.tpp.registerSettings();
            }

            int var2 = dat.readInt();

            for (int var3 = 0; var3 < var2; var3++) {
              if (var3 <= GuiAPressurePlate.tpp.settings.size()) {
                GuiAPressurePlate.tpp.setSetting(var3, dat.readBoolean());
              }
            }

            GuiAPressurePlate.LineUpSettings();
          }

          return;
        }
      }

      if (FMLClientHandler.instance().getClient().currentScreen instanceof GuiPassword) {
        if (ID == 12) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          int length = dat.readInt();
          StringBuilder sb = new StringBuilder();

          for (int var1 = 0; var1 < length; var1++) {
            sb.append(dat.readChar());
          }

          String name = sb.toString();

          if (((GuiPassword) FMLClientHandler.instance().getClient().currentScreen).tpp != null
              && ((GuiPassword) FMLClientHandler.instance().getClient().currentScreen).tpp.xCoord
                  == coords[0]
              && ((GuiPassword) FMLClientHandler.instance().getClient().currentScreen).tpp.yCoord
                  == coords[1]
              && ((GuiPassword) FMLClientHandler.instance().getClient().currentScreen).tpp.zCoord
                  == coords[2]) {
            if (name.matches(thePlayer.getCommandSenderName())) {
              GuiPassword gui = (GuiPassword) FMLClientHandler.instance().getClient().currentScreen;
              gui.enterGui();
            }
          }

          return;
        }

        if (ID == 13) {
          int coords[] = new int[3];

          for (int var1 = 0; var1 < 3; var1++) {
            coords[var1] = dat.readInt();
          }

          boolean b = dat.readBoolean();

          if (((GuiPassword) FMLClientHandler.instance().getClient().currentScreen).tpp != null
              && ((GuiPassword) FMLClientHandler.instance().getClient().currentScreen).tpp.xCoord
                  == coords[0]
              && ((GuiPassword) FMLClientHandler.instance().getClient().currentScreen).tpp.yCoord
                  == coords[1]
              && ((GuiPassword) FMLClientHandler.instance().getClient().currentScreen).tpp.zCoord
                  == coords[2]) {
            GuiPassword gui = (GuiPassword) FMLClientHandler.instance().getClient().currentScreen;

            if (b) {
              gui.enterGui();
            } else {
              GuiPassword.showText("Wrong Password!!!", 20);
            }
          }

          return;
        }

        if (ID == 15) {
          return;
        }

        if (ID == 18) {
          int guiID = dat.readInt();

          if (FMLClientHandler.instance().getClient().currentScreen != null
              && FMLClientHandler.instance().getClient().currentScreen instanceof GuiPassword) {
            GuiPassword gui = (GuiPassword) FMLClientHandler.instance().getClient().currentScreen;
            gui.set = guiID;
          }

          return;
        }
      }

      if (ID == 7) {
        int coords[] = new int[3];

        for (int var1 = 0; var1 < 3; var1++) {
          coords[var1] = dat.readInt();
        }

        TileEntity te = world.getTileEntity(coords[0], coords[1], coords[2]);
        TileEntityPressurePlate tpp = null;

        if (te != null || te instanceof TileEntityPressurePlate) {
          tpp = (TileEntityPressurePlate) te;
        }

        int itemId = dat.readInt();
        int stackSize = dat.readInt();
        int itemDamage = dat.readInt();
        int dimension = dat.readInt();

        if (!PPRegistry.getContainsPressurePlate(coords[0], coords[1], coords[2], dimension)) {
          PPRegistry.addPressurePlate(coords[0], coords[1], coords[2], dimension, false, null);
        }

        if (itemId == 0 && stackSize == 0 & itemDamage == 0) {
          if (tpp != null) {
            tpp.item[0] = null;
          }

          PPRegistry.setItem(coords[0], coords[1], coords[2], dimension, null);
          world.markBlockForUpdate(coords[0], coords[1], coords[2]);
        } else {
          if (tpp != null) {
            tpp.item[0] = new ItemStack(Item.getItemById(itemId), stackSize, itemDamage);
          }

          PPRegistry.setItem(
              coords[0],
              coords[1],
              coords[2],
              dimension,
              new ItemStack(Item.getItemById(itemId), stackSize, itemDamage));
          world.markBlockForUpdate(coords[0], coords[1], coords[2]);
        }

        return;
      }

      if (ID == 8) {
        int coords[] = new int[3];

        for (int var1 = 0; var1 < 3; var1++) {
          coords[var1] = dat.readInt();
        }

        TileEntity te = world.getTileEntity(coords[0], coords[1], coords[2]);
        TileEntityPressurePlate tpp = null;

        if (te == null || !(te instanceof TileEntityPressurePlate)) {
          world.setTileEntity(coords[0], coords[1], coords[2], new TileEntityPressurePlate());
          tpp = (TileEntityPressurePlate) te;
        } else {
          tpp = (TileEntityPressurePlate) te;
        }

        if (tpp != null) {
          tpp.currentOutput = dat.readInt();
        }

        world.markBlockForUpdate(coords[0], coords[1], coords[2]);
        return;
      }

      if (ID == 9) {
        PPRegistry.sendToServer = true;
        return;
      }

      if (ID == 11) {
        int coords[] = new int[3];

        for (int var1 = 0; var1 < 3; var1++) {
          coords[var1] = dat.readInt();
        }

        TileEntity te = world.getTileEntity(coords[0], coords[1], coords[2]);
        TileEntityPressurePlate tpp = null;

        if (te != null || te instanceof TileEntityPressurePlate) {
          tpp = (TileEntityPressurePlate) te;
        }

        if (tpp != null) {
          if (tpp.xCoord == coords[0] && tpp.yCoord == coords[1] && tpp.zCoord == coords[2]) {
            if (tpp.settings == null) {
              tpp.registerSettings();
            }

            int var2 = dat.readInt();

            for (int var3 = 0; var3 < var2; var3++) {
              if (var3 <= tpp.settings.size()) {
                tpp.setSetting(var3, dat.readBoolean());
              }
            }
          }
        }

        return;
      }

      if (ID == 12) {
        int coords[] = new int[3];

        for (int var1 = 0; var1 < 3; var1++) {
          coords[var1] = dat.readInt();
        }

        int length = dat.readInt();
        StringBuilder sb = new StringBuilder();

        for (int var1 = 0; var1 < length; var1++) {
          sb.append(dat.readChar());
        }

        sb.toString();
        return;
      }

      if (ID == 14) {
        int coords[] = new int[3];

        for (int var1 = 0; var1 < 3; var1++) {
          coords[var1] = dat.readInt();
        }

        TileEntity te = world.getTileEntity(coords[0], coords[1], coords[2]);
        if (te != null || te instanceof TileEntityPressurePlate) {}

        int dimension = dat.readInt();

        if (!PPRegistry.getContainsPressurePlate(coords[0], coords[1], coords[2], dimension)) {
          PPRegistry.addPressurePlate(coords[0], coords[1], coords[2], dimension, false, null);
        }

        PPRegistry.setUsesPassword(coords[0], coords[1], coords[2], dimension, dat.readBoolean());
        return;
      }

      if (ID == 16) {
        int coords[] = new int[3];

        for (int var1 = 0; var1 < 3; var1++) {
          coords[var1] = dat.readInt();
        }

        TileEntity te = world.getTileEntity(coords[0], coords[1], coords[2]);
        TileEntityPressurePlate tpp = null;

        if (te != null || te instanceof TileEntityPressurePlate) {
          tpp = (TileEntityPressurePlate) te;
        }

        int dimension = dat.readInt();

        if (tpp != null) {
          PPRegistry.removePressurePlate(tpp, dimension);
        }

        return;
      }

      if (ID == 17) {
        int coords[] = new int[3];

        for (int var1 = 0; var1 < 3; var1++) {
          coords[var1] = dat.readInt();
        }

        TileEntity te = world.getTileEntity(coords[0], coords[1], coords[2]);
        TileEntityPressurePlate tpp = null;

        if (te != null || te instanceof TileEntityPressurePlate) {
          tpp = (TileEntityPressurePlate) te;
        }

        int dimension = dat.readInt();

        if (tpp != null) {
          PPRegistry.addPressurePlate(tpp, dimension);
        }

        return;
      }
      if (ID == 19) {
        int coords[] = new int[3];

        for (int var1 = 0; var1 < 3; var1++) {
          coords[var1] = dat.readInt();
        }

        TileEntity te = world.getTileEntity(coords[0], coords[1], coords[2]);
        if (te instanceof TileEntityPressurePlate) {
          if (!(FMLClientHandler.instance().getClient().currentScreen
              instanceof GuiAPressurePlate)) {
            ((TileEntityPressurePlate) te).maxOutput = dat.readInt();
            ((TileEntityPressurePlate) te).itemsForMax = dat.readInt();
          } else if (GuiAPressurePlate.tpp != te || GuiAPressurePlate.hasData == false) {
            ((TileEntityPressurePlate) te).maxOutput = dat.readInt();
            ((TileEntityPressurePlate) te).itemsForMax = dat.readInt();
            GuiAPressurePlate.hasData = true;
          }
        }
      }
    }
  }
Esempio n. 21
0
 @Override
 public void read(ByteArrayDataInput input) {
   cost = input.readInt();
 }
Esempio n. 22
0
 @Override
 public Object read(ByteArrayDataInput dat) {
   return dat.readInt();
 }
 @Override
 public void read(ByteArrayDataInput in) {
   windowId = in.readInt();
   marketId = in.readInt();
 }
Esempio n. 24
0
 public static AmountHolder readFromStream(ByteArrayDataInput istream) {
   return new AmountHolder(
       CachedString.readFromStream(istream),
       istream.readInt(),
       CachedString.readFromStream(istream));
 }
 @Override
 void readData(ByteArrayDataInput in) {
   entityId = in.readInt();
   newName = in.readUTF();
 }
  public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
    ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
    int x = dat.readInt();
    int y = dat.readInt();
    int z = dat.readInt();
    int typ = dat.readInt();
    World world = ModularForceFieldSystem.proxy.getClientWorld();

    switch (typ) {
      case 100:
        String DataPacket = dat.readUTF();

        for (String blockupdate : DataPacket.split(">")) {
          if (blockupdate.length() > 0) {
            String[] projector = blockupdate.split("<");
            String[] Corrdinaten = projector[1].split("/");
            String[] temp = projector[0].split("!");
            String[] Dim = temp[1].split("/");
            String[] ProjectorCorr = temp[0].split("/");

            if (Integer.parseInt(Dim[0].trim()) == world.provider.dimensionId) {
              if (world.getChunkFromBlockCoords(
                      Integer.parseInt(Corrdinaten[0].trim()),
                      Integer.parseInt(Corrdinaten[2].trim()))
                  .isChunkLoaded) {
                TileEntity te =
                    world.getBlockTileEntity(
                        Integer.parseInt(Corrdinaten[0].trim()),
                        Integer.parseInt(Corrdinaten[1].trim()),
                        Integer.parseInt(Corrdinaten[2].trim()));
                if ((te instanceof TileEntityForceField)) {
                  TileEntity proj =
                      world.getBlockTileEntity(
                          Integer.parseInt(ProjectorCorr[2].trim()),
                          Integer.parseInt(ProjectorCorr[1].trim()),
                          Integer.parseInt(ProjectorCorr[0].trim()));
                  if ((proj instanceof TileEntityProjector)) {
                    ((TileEntityForceField) te)
                        .setTexturfile(((TileEntityProjector) proj).getForceFieldTexturfile());
                    ((TileEntityForceField) te)
                        .setTexturid(((TileEntityProjector) proj).getForceFieldTexturID());
                    ((TileEntityForceField) te)
                        .setForcefieldCamoblockid(
                            ((TileEntityProjector) proj).getForcefieldCamoblockid());
                    ((TileEntityForceField) te)
                        .setForcefieldCamoblockmeta(
                            ((TileEntityProjector) proj).getForcefieldCamoblockmeta());
                  }
                }
              }
            }
          }
        }

        break;
      case 1:
        String fieldname = dat.readUTF();

        TileEntity tileEntity = world.getBlockTileEntity(x, y, z);

        if ((tileEntity instanceof TileEntityMFFS)) {
          try {
            Field f = ReflectionHelper.findField(TileEntityMFFS.class, new String[] {fieldname});
            reflectionsetvalue(f, tileEntity, dat, fieldname);
          } catch (Exception e) {
          }
        }

        if ((tileEntity instanceof TileEntityCapacitor)) {
          try {
            Field f =
                ReflectionHelper.findField(TileEntityCapacitor.class, new String[] {fieldname});
            reflectionsetvalue(f, tileEntity, dat, fieldname);
          } catch (Exception e) {
          }
        }

        if ((tileEntity instanceof TileEntityExtractor)) {
          try {
            Field f =
                ReflectionHelper.findField(TileEntityExtractor.class, new String[] {fieldname});
            reflectionsetvalue(f, tileEntity, dat, fieldname);
          } catch (Exception e) {
          }
        }

        if ((tileEntity instanceof TileEntityConverter)) {
          try {
            Field f =
                ReflectionHelper.findField(TileEntityConverter.class, new String[] {fieldname});
            reflectionsetvalue(f, tileEntity, dat, fieldname);
          } catch (Exception e) {
          }
        }

        if ((tileEntity instanceof TileEntityProjector)) {
          try {
            Field f =
                ReflectionHelper.findField(TileEntityProjector.class, new String[] {fieldname});
            reflectionsetvalue(f, tileEntity, dat, fieldname);
          } catch (Exception e) {
          }
        }

        if ((tileEntity instanceof TileEntityDefenseStation)) {
          try {
            Field f =
                ReflectionHelper.findField(
                    TileEntityDefenseStation.class, new String[] {fieldname});
            reflectionsetvalue(f, tileEntity, dat, fieldname);
          } catch (Exception e) {
          }
        }

        if ((tileEntity instanceof TileEntitySecurityStation)) {
          try {
            Field f =
                ReflectionHelper.findField(
                    TileEntitySecurityStation.class, new String[] {fieldname});
            reflectionsetvalue(f, tileEntity, dat, fieldname);
          } catch (Exception e) {
          }
        }

        if ((tileEntity instanceof TileEntitySecStorage)) {
          try {
            Field f =
                ReflectionHelper.findField(TileEntitySecStorage.class, new String[] {fieldname});
            reflectionsetvalue(f, tileEntity, dat, fieldname);
          } catch (Exception e) {
          }
        }

        if ((tileEntity instanceof TileEntityControlSystem))
          try {
            Field f =
                ReflectionHelper.findField(TileEntityControlSystem.class, new String[] {fieldname});
            reflectionsetvalue(f, tileEntity, dat, fieldname);
          } catch (Exception e) {
          }
        break;
    }
  }