Exemplo n.º 1
0
 public Packet24MobSpawn(EntityLiving entityliving)
 {
     entityId  = entityliving.entityId;
     type      = (byte)EntityList.getEntityID(entityliving);
     xPosition = MathHelper.floor_double(entityliving.posX * 32D);
     yPosition = MathHelper.floor_double(entityliving.posY * 32D);
     zPosition = MathHelper.floor_double(entityliving.posZ * 32D);
     yaw       = (byte)(int)((entityliving.rotationYaw * 256F) / 360F);
     pitch     = (byte)(int)((entityliving.rotationPitch * 256F) / 360F);
     metaData  = entityliving.getDataWatcher();
 }
Exemplo n.º 2
0
 public override void readPacketData(DataInputStream datainputstream)
 {
     entityId         = datainputstream.readInt();
     type             = datainputstream.readByte();
     xPosition        = datainputstream.readInt();
     yPosition        = datainputstream.readInt();
     zPosition        = datainputstream.readInt();
     yaw              = datainputstream.readByte();
     pitch            = datainputstream.readByte();
     receivedMetadata = DataWatcher.readWatchableObjects(datainputstream);
 }
Exemplo n.º 3
0
 public Packet24MobSpawn(EntityLiving entityliving)
 {
     entityId = entityliving.entityId;
     type = (byte) EntityList.getEntityID(entityliving);
     xPosition = MathHelper.floor_double(entityliving.posX*32D);
     yPosition = MathHelper.floor_double(entityliving.posY*32D);
     zPosition = MathHelper.floor_double(entityliving.posZ*32D);
     yaw = (byte) (int) ((entityliving.rotationYaw*256F)/360F);
     pitch = (byte) (int) ((entityliving.rotationPitch*256F)/360F);
     metaData = entityliving.getDataWatcher();
 }
Exemplo n.º 4
0
 public Entity(World world)
 {
     entityId              = nextEntityID++;
     renderDistanceWeight  = 1.0D;
     preventEntitySpawning = false;
     onGround              = false;
     isCollided            = false;
     beenAttacked          = false;
     field_9077_F          = true;
     isDead  = false;
     yOffset = 0.0F;
     width   = 0.6F;
     height  = 1.8F;
     prevDistanceWalkedModified = 0.0F;
     distanceWalkedModified     = 0.0F;
     entityWalks              = true;
     fallDistance             = 0.0F;
     nextStepDistance         = 1;
     ySize                    = 0.0F;
     stepHeight               = 0.0F;
     noClip                   = false;
     entityCollisionReduction = 0.0F;
     field_9065_V             = false;
     rand           = new Random();
     ticksExisted   = 0;
     fireResistance = 1;
     fire           = 0;
     maxAir         = 300;
     inWater        = false;
     field_9083_ac  = 0;
     air            = 300;
     field_4131_c   = true;
     isImmuneToFire = false;
     dataWatcher    = new DataWatcher();
     addedToChunk   = false;
     worldObj       = world;
     setPosition(0.0D, 0.0D, 0.0D);
     dataWatcher.addObject(0, Byte.valueOf(0));
     entityInit();
 }
Exemplo n.º 5
0
 public Packet40(int i, DataWatcher datawatcher)
 {
     entityId = i;
     field_21018_b = datawatcher.getChangedObjects();
 }
Exemplo n.º 6
0
 public Entity(World world)
 {
     entityId = nextEntityID++;
     renderDistanceWeight = 1.0D;
     preventEntitySpawning = false;
     onGround = false;
     isCollided = false;
     beenAttacked = false;
     field_9077_F = true;
     isDead = false;
     yOffset = 0.0F;
     width = 0.6F;
     height = 1.8F;
     prevDistanceWalkedModified = 0.0F;
     distanceWalkedModified = 0.0F;
     entityWalks = true;
     fallDistance = 0.0F;
     nextStepDistance = 1;
     ySize = 0.0F;
     stepHeight = 0.0F;
     noClip = false;
     entityCollisionReduction = 0.0F;
     field_9065_V = false;
     rand = new Random();
     ticksExisted = 0;
     fireResistance = 1;
     fire = 0;
     maxAir = 300;
     inWater = false;
     field_9083_ac = 0;
     air = 300;
     field_4131_c = true;
     isImmuneToFire = false;
     dataWatcher = new DataWatcher();
     addedToChunk = false;
     worldObj = world;
     setPosition(0.0D, 0.0D, 0.0D);
     dataWatcher.addObject(0, Byte.valueOf(0));
     entityInit();
 }
Exemplo n.º 7
0
 public override void writePacketData(DataOutputStream dataoutputstream)
 {
     dataoutputstream.writeInt(entityId);
     DataWatcher.writeObjectsInListToStream(field_21018_b, dataoutputstream);
 }
Exemplo n.º 8
0
 public override void readPacketData(DataInputStream datainputstream)
 {
     entityId      = datainputstream.readInt();
     field_21018_b = DataWatcher.readWatchableObjects(datainputstream);
 }
Exemplo n.º 9
0
 public Packet40(int i, DataWatcher datawatcher)
 {
     entityId      = i;
     field_21018_b = datawatcher.getChangedObjects();
 }
Exemplo n.º 10
0
 public void updatePlayerList(List list)
 {
     playerEntitiesUpdated = false;
     if (!firstUpdateDone ||
         trackedEntity.getDistanceSq(lastTrackedEntityPosX, lastTrackedEntityPosY, lastTrackedEntityPosZ) > 16D)
     {
         lastTrackedEntityPosX = trackedEntity.posX;
         lastTrackedEntityPosY = trackedEntity.posY;
         lastTrackedEntityPosZ = trackedEntity.posZ;
         firstUpdateDone       = true;
         playerEntitiesUpdated = true;
         updatePlayerEntities(list);
     }
     if (++updateCounter % field_9234_e == 0)
     {
         int    i     = MathHelper.floor_double(trackedEntity.posX * 32D);
         int    j     = MathHelper.floor_double(trackedEntity.posY * 32D);
         int    k     = MathHelper.floor_double(trackedEntity.posZ * 32D);
         int    l     = MathHelper.floor_float((trackedEntity.rotationYaw * 256F) / 360F);
         int    i1    = MathHelper.floor_float((trackedEntity.rotationPitch * 256F) / 360F);
         int    j1    = i - encodedPosX;
         int    k1    = j - encodedPosY;
         int    l1    = k - encodedPosZ;
         object obj   = null;
         bool   flag  = Math.abs(i) >= 8 || Math.abs(j) >= 8 || Math.abs(k) >= 8;
         bool   flag1 = Math.abs(l - encodedRotationYaw) >= 8 || Math.abs(i1 - encodedRotationPitch) >= 8;
         if (j1 < -128 || j1 >= 128 || k1 < -128 || k1 >= 128 || l1 < -128 || l1 >= 128)
         {
             obj = new Packet34EntityTeleport(trackedEntity.entityId, i, j, k, (byte)l, (byte)i1);
         }
         else if (flag && flag1)
         {
             obj = new Packet33RelEntityMoveLook(trackedEntity.entityId, (byte)j1, (byte)k1, (byte)l1,
                                                 (byte)l, (byte)i1);
         }
         else if (flag)
         {
             obj = new Packet31RelEntityMove(trackedEntity.entityId, (byte)j1, (byte)k1, (byte)l1);
         }
         else if (flag1)
         {
             obj = new Packet32EntityLook(trackedEntity.entityId, (byte)l, (byte)i1);
         }
         if (shouldSendMotionUpdates)
         {
             double d  = trackedEntity.motionX - lastTrackedEntityMotionX;
             double d1 = trackedEntity.motionY - lastTrackedEntityMotionY;
             double d2 = trackedEntity.motionZ - lastTrackedEntityMotionZ;
             double d3 = 0.02D;
             double d4 = d * d + d1 * d1 + d2 * d2;
             if (d4 > d3 * d3 ||
                 d4 > 0.0D && trackedEntity.motionX == 0.0D && trackedEntity.motionY == 0.0D &&
                 trackedEntity.motionZ == 0.0D)
             {
                 lastTrackedEntityMotionX = trackedEntity.motionX;
                 lastTrackedEntityMotionY = trackedEntity.motionY;
                 lastTrackedEntityMotionZ = trackedEntity.motionZ;
                 sendPacketToTrackedPlayers(new Packet28(trackedEntity.entityId, lastTrackedEntityMotionX,
                                                         lastTrackedEntityMotionY, lastTrackedEntityMotionZ));
             }
         }
         if (obj != null)
         {
             sendPacketToTrackedPlayers(((Packet)(obj)));
         }
         DataWatcher datawatcher = trackedEntity.getDataWatcher();
         if (datawatcher.hasObjectChanged())
         {
             sendPacketToTrackedPlayersAndTrackedEntity(new Packet40(trackedEntity.entityId, datawatcher));
         }
         if (flag)
         {
             encodedPosX = i;
             encodedPosY = j;
             encodedPosZ = k;
         }
         if (flag1)
         {
             encodedRotationYaw   = l;
             encodedRotationPitch = i1;
         }
     }
     if (trackedEntity.beenAttacked)
     {
         sendPacketToTrackedPlayersAndTrackedEntity(new Packet28(trackedEntity));
         trackedEntity.beenAttacked = false;
     }
 }