    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import java.io.DataInputStream;
    006    import java.io.DataOutputStream;
    007    import java.io.IOException;
    008    import java.util.ArrayList;
    009    import java.util.Iterator;
    010    import java.util.List;
    011
    012    public class Packet60Explosion extends Packet
    013    {
    014        public double explosionX;
    015        public double explosionY;
    016        public double explosionZ;
    017        public float explosionSize;
    018        public List chunkPositionRecords;
    019        private float field_73610_f;
    020        private float field_73611_g;
    021        private float field_73617_h;
    022
    023        public Packet60Explosion() {}
    024
    025        public Packet60Explosion(double par1, double par3, double par5, float par7, List par8List, Vec3 par9Vec3)
    026        {
    027            this.explosionX = par1;
    028            this.explosionY = par3;
    029            this.explosionZ = par5;
    030            this.explosionSize = par7;
    031            this.chunkPositionRecords = new ArrayList(par8List);
    032
    033            if (par9Vec3 != null)
    034            {
    035                this.field_73610_f = (float)par9Vec3.xCoord;
    036                this.field_73611_g = (float)par9Vec3.yCoord;
    037                this.field_73617_h = (float)par9Vec3.zCoord;
    038            }
    039        }
    040
    041        /**
    042         * Abstract. Reads the raw packet data from the data stream.
    043         */
    044        public void readPacketData(DataInputStream par1DataInputStream) throws IOException
    045        {
    046            this.explosionX = par1DataInputStream.readDouble();
    047            this.explosionY = par1DataInputStream.readDouble();
    048            this.explosionZ = par1DataInputStream.readDouble();
    049            this.explosionSize = par1DataInputStream.readFloat();
    050            int var2 = par1DataInputStream.readInt();
    051            this.chunkPositionRecords = new ArrayList(var2);
    052            int var3 = (int)this.explosionX;
    053            int var4 = (int)this.explosionY;
    054            int var5 = (int)this.explosionZ;
    055
    056            for (int var6 = 0; var6 < var2; ++var6)
    057            {
    058                int var7 = par1DataInputStream.readByte() + var3;
    059                int var8 = par1DataInputStream.readByte() + var4;
    060                int var9 = par1DataInputStream.readByte() + var5;
    061                this.chunkPositionRecords.add(new ChunkPosition(var7, var8, var9));
    062            }
    063
    064            this.field_73610_f = par1DataInputStream.readFloat();
    065            this.field_73611_g = par1DataInputStream.readFloat();
    066            this.field_73617_h = par1DataInputStream.readFloat();
    067        }
    068
    069        /**
    070         * Abstract. Writes the raw packet data to the data stream.
    071         */
    072        public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    073        {
    074            par1DataOutputStream.writeDouble(this.explosionX);
    075            par1DataOutputStream.writeDouble(this.explosionY);
    076            par1DataOutputStream.writeDouble(this.explosionZ);
    077            par1DataOutputStream.writeFloat(this.explosionSize);
    078            par1DataOutputStream.writeInt(this.chunkPositionRecords.size());
    079            int var2 = (int)this.explosionX;
    080            int var3 = (int)this.explosionY;
    081            int var4 = (int)this.explosionZ;
    082            Iterator var5 = this.chunkPositionRecords.iterator();
    083
    084            while (var5.hasNext())
    085            {
    086                ChunkPosition var6 = (ChunkPosition)var5.next();
    087                int var7 = var6.x - var2;
    088                int var8 = var6.y - var3;
    089                int var9 = var6.z - var4;
    090                par1DataOutputStream.writeByte(var7);
    091                par1DataOutputStream.writeByte(var8);
    092                par1DataOutputStream.writeByte(var9);
    093            }
    094
    095            par1DataOutputStream.writeFloat(this.field_73610_f);
    096            par1DataOutputStream.writeFloat(this.field_73611_g);
    097            par1DataOutputStream.writeFloat(this.field_73617_h);
    098        }
    099
    100        /**
    101         * Passes this Packet on to the NetHandler for processing.
    102         */
    103        public void processPacket(NetHandler par1NetHandler)
    104        {
    105            par1NetHandler.handleExplosion(this);
    106        }
    107
    108        /**
    109         * Abstract. Return the size of the packet (not counting the header).
    110         */
    111        public int getPacketSize()
    112        {
    113            return 32 + this.chunkPositionRecords.size() * 3 + 3;
    114        }
    115
    116        @SideOnly(Side.CLIENT)
    117        public float func_73607_d()
    118        {
    119            return this.field_73610_f;
    120        }
    121
    122        @SideOnly(Side.CLIENT)
    123        public float func_73609_f()
    124        {
    125            return this.field_73611_g;
    126        }
    127
    128        @SideOnly(Side.CLIENT)
    129        public float func_73608_g()
    130        {
    131            return this.field_73617_h;
    132        }
    133    }