001 package net.minecraft.src; 002 003 import java.io.DataInputStream; 004 import java.io.DataOutputStream; 005 import java.io.IOException; 006 007 public class Packet71Weather extends Packet 008 { 009 public int entityID; 010 public int posX; 011 public int posY; 012 public int posZ; 013 public int isLightningBolt; 014 015 public Packet71Weather() {} 016 017 public Packet71Weather(Entity par1Entity) 018 { 019 this.entityID = par1Entity.entityId; 020 this.posX = MathHelper.floor_double(par1Entity.posX * 32.0D); 021 this.posY = MathHelper.floor_double(par1Entity.posY * 32.0D); 022 this.posZ = MathHelper.floor_double(par1Entity.posZ * 32.0D); 023 024 if (par1Entity instanceof EntityLightningBolt) 025 { 026 this.isLightningBolt = 1; 027 } 028 } 029 030 /** 031 * Abstract. Reads the raw packet data from the data stream. 032 */ 033 public void readPacketData(DataInputStream par1DataInputStream) throws IOException 034 { 035 this.entityID = par1DataInputStream.readInt(); 036 this.isLightningBolt = par1DataInputStream.readByte(); 037 this.posX = par1DataInputStream.readInt(); 038 this.posY = par1DataInputStream.readInt(); 039 this.posZ = par1DataInputStream.readInt(); 040 } 041 042 /** 043 * Abstract. Writes the raw packet data to the data stream. 044 */ 045 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException 046 { 047 par1DataOutputStream.writeInt(this.entityID); 048 par1DataOutputStream.writeByte(this.isLightningBolt); 049 par1DataOutputStream.writeInt(this.posX); 050 par1DataOutputStream.writeInt(this.posY); 051 par1DataOutputStream.writeInt(this.posZ); 052 } 053 054 /** 055 * Passes this Packet on to the NetHandler for processing. 056 */ 057 public void processPacket(NetHandler par1NetHandler) 058 { 059 par1NetHandler.handleWeather(this); 060 } 061 062 /** 063 * Abstract. Return the size of the packet (not counting the header). 064 */ 065 public int getPacketSize() 066 { 067 return 17; 068 } 069 }