Ejemplo n.º 1
0
  private static void writeWatchableObject(
      DataOutput par0DataOutput, WatchableObject par1WatchableObject) throws IOException {
    int i =
        (par1WatchableObject.getObjectType() << 5 | par1WatchableObject.getDataValueId() & 31)
            & 255;
    par0DataOutput.writeByte(i);

    switch (par1WatchableObject.getObjectType()) {
      case 0:
        par0DataOutput.writeByte(((Byte) par1WatchableObject.getObject()).byteValue());
        break;
      case 1:
        par0DataOutput.writeShort(((Short) par1WatchableObject.getObject()).shortValue());
        break;
      case 2:
        par0DataOutput.writeInt(((Integer) par1WatchableObject.getObject()).intValue());
        break;
      case 3:
        par0DataOutput.writeFloat(((Float) par1WatchableObject.getObject()).floatValue());
        break;
      case 4:
        Packet.writeString((String) par1WatchableObject.getObject(), par0DataOutput);
        break;
      case 5:
        ItemStack itemstack = (ItemStack) par1WatchableObject.getObject();
        Packet.writeItemStack(itemstack, par0DataOutput);
        break;
      case 6:
        ChunkCoordinates chunkcoordinates = (ChunkCoordinates) par1WatchableObject.getObject();
        par0DataOutput.writeInt(chunkcoordinates.posX);
        par0DataOutput.writeInt(chunkcoordinates.posY);
        par0DataOutput.writeInt(chunkcoordinates.posZ);
    }
  }
Ejemplo n.º 2
0
  public void updateWatchedObjectsFromList(List par1List) {
    Iterator var2 = par1List.iterator();

    while (var2.hasNext()) {
      WatchableObject var3 = (WatchableObject) var2.next();
      WatchableObject var4 =
          (WatchableObject) this.watchedObjects.get(Integer.valueOf(var3.getDataValueId()));

      if (var4 != null) {
        var4.setObject(var3.getObject());
      }
    }
  }
Ejemplo n.º 3
0
  public void updateWatchedObjectsFromList(List par1List) {
    Iterator iterator = par1List.iterator();

    do {
      if (!iterator.hasNext()) {
        break;
      }

      WatchableObject watchableobject = (WatchableObject) iterator.next();
      WatchableObject watchableobject1 =
          (WatchableObject) watchedObjects.get(Integer.valueOf(watchableobject.getDataValueId()));

      if (watchableobject1 != null) {
        watchableobject1.setObject(watchableobject.getObject());
      }
    } while (true);
  }
Ejemplo n.º 4
0
  private static void writeWatchableObject(
      DataOutputStream par0DataOutputStream, WatchableObject par1WatchableObject)
      throws IOException {
    int i =
        (par1WatchableObject.getObjectType() << 5 | par1WatchableObject.getDataValueId() & 0x1f)
            & 0xff;
    par0DataOutputStream.writeByte(i);

    switch (par1WatchableObject.getObjectType()) {
      case 0:
        par0DataOutputStream.writeByte(((Byte) par1WatchableObject.getObject()).byteValue());
        break;

      case 1:
        par0DataOutputStream.writeShort(((Short) par1WatchableObject.getObject()).shortValue());
        break;

      case 2:
        par0DataOutputStream.writeInt(((Integer) par1WatchableObject.getObject()).intValue());
        break;

      case 3:
        par0DataOutputStream.writeFloat(((Float) par1WatchableObject.getObject()).floatValue());
        break;

      case 4:
        Packet.writeString((String) par1WatchableObject.getObject(), par0DataOutputStream);
        break;

      case 5:
        ItemStack itemstack = (ItemStack) par1WatchableObject.getObject();
        par0DataOutputStream.writeShort(itemstack.getItem().shiftedIndex);
        par0DataOutputStream.writeByte(itemstack.stackSize);
        par0DataOutputStream.writeShort(itemstack.getItemDamage());
        break;

      case 6:
        ChunkCoordinates chunkcoordinates = (ChunkCoordinates) par1WatchableObject.getObject();
        par0DataOutputStream.writeInt(chunkcoordinates.posX);
        par0DataOutputStream.writeInt(chunkcoordinates.posY);
        par0DataOutputStream.writeInt(chunkcoordinates.posZ);
        break;
    }
  }
Ejemplo n.º 5
0
  @SideOnly(Side.CLIENT)
  public void updateWatchedObjectsFromList(List par1List) {
    this.lock.writeLock().lock();
    Iterator iterator = par1List.iterator();

    while (iterator.hasNext()) {
      WatchableObject watchableobject = (WatchableObject) iterator.next();
      WatchableObject watchableobject1 =
          (WatchableObject)
              this.watchedObjects.get(Integer.valueOf(watchableobject.getDataValueId()));

      if (watchableobject1 != null) {
        watchableobject1.setObject(watchableobject.getObject());
      }
    }

    this.lock.writeLock().unlock();
    this.objectChanged = true;
  }