Example #1
0
 public virtual void UpdateObject(int i, object obj)
 {
     net.minecraft.src.WatchableObject watchableobject = (net.minecraft.src.WatchableObject
                                                          )watchedObjects[i];
     if (!obj.Equals(watchableobject.GetObject()))
     {
         watchableobject.SetObject(obj);
         watchableobject.SetWatching(true);
         objectChanged = true;
     }
 }
Example #2
0
        /// <exception cref="System.IO.IOException"/>
        private static void WriteWatchableObject(java.io.DataOutputStream dataoutputstream, net.minecraft.src.WatchableObject watchableobject)
        {
            int i = (watchableobject.GetObjectType() << 5 | watchableobject.GetDataValueId()
                     & 0x1f) & 0xff;

            dataoutputstream.WriteByte(i);
            switch (watchableobject.GetObjectType())
            {
            case 0:
            {
                // '\0'
                dataoutputstream.WriteByte(((byte)watchableobject.GetObject()));
                break;
            }

            case 1:
            {
                // '\001'
                dataoutputstream.WriteShort(((short)watchableobject.GetObject()));
                break;
            }

            case 2:
            {
                // '\002'
                dataoutputstream.WriteInt(((int)watchableobject.GetObject()));
                break;
            }

            case 3:
            {
                // '\003'
                dataoutputstream.WriteFloat(((float)watchableobject.GetObject()));
                break;
            }

            case 4:
            {
                // '\004'
                net.minecraft.src.Packet.WriteString((string)watchableobject.GetObject(), dataoutputstream
                                                     );
                break;
            }

            case 5:
            {
                // '\005'
                net.minecraft.src.ItemStack itemstack = (net.minecraft.src.ItemStack)watchableobject
                                                        .GetObject();
                dataoutputstream.WriteShort(itemstack.GetItem().ID);
                dataoutputstream.WriteByte(itemstack.stackSize);
                dataoutputstream.WriteShort(itemstack.GetItemDamage());
                break;
            }

            case 6:
            {
                // '\006'
                net.minecraft.src.ChunkCoordinates chunkcoordinates = (net.minecraft.src.ChunkCoordinates
                                                                       )watchableobject.GetObject();
                dataoutputstream.WriteInt(chunkcoordinates.posX);
                dataoutputstream.WriteInt(chunkcoordinates.posY);
                dataoutputstream.WriteInt(chunkcoordinates.posZ);
                break;
            }
            }
        }