public List unwatchAndReturnAllWatched() { ArrayList var1 = null; if (this.objectChanged) { this.field_75694_d.readLock().lock(); Iterator var2 = this.watchedObjects.values().iterator(); while (var2.hasNext()) { WatchableObject var3 = (WatchableObject) var2.next(); if (var3.isWatched()) { var3.setWatched(false); if (var1 == null) { var1 = new ArrayList(); } var1.add(var3); } } this.field_75694_d.readLock().unlock(); } this.objectChanged = false; return var1; }
public List unwatchAndReturnAllWatched() { ArrayList arraylist = null; if (this.objectChanged) { this.lock.readLock().lock(); Iterator iterator = this.watchedObjects.values().iterator(); while (iterator.hasNext()) { WatchableObject watchableobject = (WatchableObject) iterator.next(); if (watchableobject.isWatched()) { watchableobject.setWatched(false); if (arraylist == null) { arraylist = new ArrayList(); } arraylist.add(watchableobject); } } this.lock.readLock().unlock(); } this.objectChanged = false; return arraylist; }
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); } }
/** updates an already existing object */ public void updateObject(int par1, Object par2Obj) { WatchableObject var3 = (WatchableObject) this.watchedObjects.get(Integer.valueOf(par1)); if (!par2Obj.equals(var3.getObject())) { var3.setObject(par2Obj); var3.setWatching(true); this.objectChanged = true; } }
/** updates an already existing object */ public void updateObject(int par1, Object par2Obj) { WatchableObject var3 = this.getWatchedObject(par1); if (!par2Obj.equals(var3.getObject())) { var3.setObject(par2Obj); var3.setWatched(true); this.objectChanged = true; } }
public void b(int i, Object object) { WatchableObject watchableobject = (WatchableObject) this.b.get(Integer.valueOf(i)); if (!object.equals(watchableobject.b())) { watchableobject.a(object); watchableobject.a(true); this.c = true; } }
/** updates an already existing object */ public void updateObject(int par1, Object par2Obj) { WatchableObject watchableobject = this.getWatchedObject(par1); if (!par2Obj.equals(watchableobject.getObject())) { watchableobject.setObject(par2Obj); watchableobject.setWatched(true); this.objectChanged = true; } }
/** updates an already existing object */ public void updateObject(int par1, Object par2Obj) { WatchableObject watchableobject = (WatchableObject) watchedObjects.get(Integer.valueOf(par1)); if (!par2Obj.equals(watchableobject.getObject())) { watchableobject.setObject(par2Obj); watchableobject.setWatching(true); objectChanged = true; } }
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()); } } }
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); }
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; } }
@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; }
private static void a(DataOutputStream dataoutputstream, WatchableObject watchableobject) { int i = (watchableobject.c() << 5 | watchableobject.a() & 31) & 255; dataoutputstream.writeByte(i); switch (watchableobject.c()) { case 0: dataoutputstream.writeByte(((Byte) watchableobject.b()).byteValue()); break; case 1: dataoutputstream.writeShort(((Short) watchableobject.b()).shortValue()); break; case 2: dataoutputstream.writeInt(((Integer) watchableobject.b()).intValue()); break; case 3: dataoutputstream.writeFloat(((Float) watchableobject.b()).floatValue()); break; case 4: Packet.a((String) watchableobject.b(), dataoutputstream); break; case 5: ItemStack itemstack = (ItemStack) watchableobject.b(); dataoutputstream.writeShort(itemstack.getItem().id); dataoutputstream.writeByte(itemstack.count); dataoutputstream.writeShort(itemstack.getData()); break; case 6: ChunkCoordinates chunkcoordinates = (ChunkCoordinates) watchableobject.b(); dataoutputstream.writeInt(chunkcoordinates.x); dataoutputstream.writeInt(chunkcoordinates.y); dataoutputstream.writeInt(chunkcoordinates.z); } }
public ArrayList b() { ArrayList arraylist = null; if (this.c) { Iterator iterator = this.b.values().iterator(); while (iterator.hasNext()) { WatchableObject watchableobject = (WatchableObject) iterator.next(); if (watchableobject.d()) { watchableobject.a(false); if (arraylist == null) { arraylist = new ArrayList(); } arraylist.add(watchableobject); } } } this.c = false; return arraylist; }
public void setObjectWatched(int par1) { WatchableObject.setWatchableObjectWatched(this.getWatchedObject(par1), true); this.objectChanged = true; }