public Packet40EntityMetadata(int i, net.minecraft.src.DataWatcher datawatcher)
 {
     // Referenced classes of package net.minecraft.src:
     //            Packet, DataWatcher, NetHandler
     entityId      = i;
     field_21018_b = datawatcher.GetChangedObjects();
 }
Exemple #2
0
 public Entity(net.minecraft.src.World world)
 {
     // Referenced classes of package net.minecraft.src:
     //            AxisAlignedBB, DataWatcher, MathHelper, World,
     //            Block, StepSound, Material, BlockFluid,
     //            NBTTagCompound, NBTTagList, NBTTagDouble, NBTTagFloat,
     //            EntityList, ItemStack, EntityItem, EntityPlayer,
     //            Vec3D, EntityLightningBolt, EntityLiving
     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;
     fallDistance             = 0.0F;
     nextStepDistance         = 1;
     ySize                    = 0.0F;
     stepHeight               = 0.0F;
     noClip                   = false;
     entityCollisionReduction = 0.0F;
     rand           = new SharpBukkitLive.SharpBukkit.SharpRandom();
     ticksExisted   = 0;
     fireResistance = 1;
     fire           = 0;
     maxAir         = 300;
     inWater        = false;
     field_9083_ac  = 0;
     air            = 300;
     firstUpdate    = true;
     isImmuneToFire = false;
     dataWatcher    = new net.minecraft.src.DataWatcher();
     field_31001_bF = 0.0F;
     addedToChunk   = false;
     worldObj       = world;
     SetPosition(0.0D, 0.0D, 0.0D);
     dataWatcher.AddObject(0, unchecked ((byte)0));
     EntityInit();
 }
 public virtual void UpdatePlayerList(List <EntityPlayer> 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);
     }
     field_28165_t++;
     if (++updateCounter % field_9234_e == 0)
     {
         int i = net.minecraft.src.MathHelper.Floor_double(trackedEntity.posX * 32D);
         int j = net.minecraft.src.MathHelper.Floor_double(trackedEntity.posY * 32D);
         int k = net.minecraft.src.MathHelper.Floor_double(trackedEntity.posZ * 32D);
         int l = net.minecraft.src.MathHelper.Floor_float((trackedEntity.rotationYaw * 256F
                                                           ) / 360F);
         int i1 = net.minecraft.src.MathHelper.Floor_float((trackedEntity.rotationPitch *
                                                            256F) / 360F);
         int    j1   = i - encodedPosX;
         int    k1   = j - encodedPosY;
         int    l1   = k - encodedPosZ;
         object obj  = null;
         bool   flag = System.Math.Abs(i) >= 8 || System.Math.Abs(j) >= 8 || System.Math.Abs
                           (k) >= 8;
         bool flag1 = System.Math.Abs(l - encodedRotationYaw) >= 8 || System.Math.Abs(i1 -
                                                                                      encodedRotationPitch) >= 8;
         if (j1 < -128 || j1 >= 128 || k1 < -128 || k1 >= 128 || l1 < -128 || l1 >= 128 ||
             field_28165_t > 400)
         {
             field_28165_t      = 0;
             trackedEntity.posX = (double)i / 32D;
             trackedEntity.posY = (double)j / 32D;
             trackedEntity.posZ = (double)k / 32D;
             obj = new net.minecraft.src.Packet34EntityTeleport(trackedEntity.entityId, i, j,
                                                                k, unchecked ((byte)l), unchecked ((byte)i1));
         }
         else
         {
             if (flag && flag1)
             {
                 obj = new net.minecraft.src.Packet33RelEntityMoveLook(trackedEntity.entityId, unchecked (
                                                                           (byte)j1), unchecked ((byte)k1), unchecked ((byte)l1), unchecked ((byte)l), unchecked (
                                                                           (byte)i1));
             }
             else
             {
                 if (flag)
                 {
                     obj = new net.minecraft.src.Packet31RelEntityMove(trackedEntity.entityId, unchecked (
                                                                           (byte)j1), unchecked ((byte)k1), unchecked ((byte)l1));
                 }
                 else
                 {
                     if (flag1)
                     {
                         obj = new net.minecraft.src.Packet32EntityLook(trackedEntity.entityId, unchecked (
                                                                            (byte)l), unchecked ((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 net.minecraft.src.Packet28EntityVelocity(trackedEntity
                                                                                         .entityId, lastTrackedEntityMotionX, lastTrackedEntityMotionY, lastTrackedEntityMotionZ
                                                                                         ));
             }
         }
         if (obj != null)
         {
             SendPacketToTrackedPlayers(((net.minecraft.src.Packet)(obj)));
         }
         net.minecraft.src.DataWatcher datawatcher = trackedEntity.GetDataWatcher();
         if (datawatcher.HasObjectChanged())
         {
             SendPacketToTrackedPlayersAndTrackedEntity(new net.minecraft.src.Packet40EntityMetadata
                                                            (trackedEntity.entityId, datawatcher));
         }
         if (flag)
         {
             encodedPosX = i;
             encodedPosY = j;
             encodedPosZ = k;
         }
         if (flag1)
         {
             encodedRotationYaw   = l;
             encodedRotationPitch = i1;
         }
     }
     if (trackedEntity.beenAttacked)
     {
         SendPacketToTrackedPlayersAndTrackedEntity(new net.minecraft.src.Packet28EntityVelocity
                                                        (trackedEntity));
         trackedEntity.beenAttacked = false;
     }
 }