public void updateRider(Entity var1) {
   if (var1 != null) {
     if (var1 instanceof EntityLiving) {
       this.say(
           "Updating living rider #"
               + var1.entityId
               + " to "
               + (this.posY + this.getMountedYOffset() + var1.getYOffset()));
       var1.setPosition(
           this.posX,
           this.centerElevator.posY + this.getMountedYOffset() + var1.getYOffset(),
           this.posZ);
     } else if (!(var1 instanceof EntityElevator)) {
       this.say(
           "Updating rider #"
               + var1.entityId
               + " to "
               + (this.posY + this.getMountedYOffset() + var1.getYOffset()));
       var1.setPosition(
           var1.posX,
           this.centerElevator.posY + this.getMountedYOffset() + var1.getYOffset(),
           var1.posZ);
     }
   }
 }
Example #2
0
  /** Reads the entity from NBT (calls an abstract helper method to read specialized data) */
  public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
    NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Pos");
    NBTTagList nbttaglist1 = par1NBTTagCompound.getTagList("Motion");
    NBTTagList nbttaglist2 = par1NBTTagCompound.getTagList("Rotation");
    motionX = ((NBTTagDouble) nbttaglist1.tagAt(0)).data;
    motionY = ((NBTTagDouble) nbttaglist1.tagAt(1)).data;
    motionZ = ((NBTTagDouble) nbttaglist1.tagAt(2)).data;

    if (Math.abs(motionX) > 10D) {
      motionX = 0.0D;
    }

    if (Math.abs(motionY) > 10D) {
      motionY = 0.0D;
    }

    if (Math.abs(motionZ) > 10D) {
      motionZ = 0.0D;
    }

    prevPosX = lastTickPosX = posX = ((NBTTagDouble) nbttaglist.tagAt(0)).data;
    prevPosY = lastTickPosY = posY = ((NBTTagDouble) nbttaglist.tagAt(1)).data;
    prevPosZ = lastTickPosZ = posZ = ((NBTTagDouble) nbttaglist.tagAt(2)).data;
    prevRotationYaw = rotationYaw = ((NBTTagFloat) nbttaglist2.tagAt(0)).data;
    prevRotationPitch = rotationPitch = ((NBTTagFloat) nbttaglist2.tagAt(1)).data;
    fallDistance = par1NBTTagCompound.getFloat("FallDistance");
    fire = par1NBTTagCompound.getShort("Fire");
    setAir(par1NBTTagCompound.getShort("Air"));
    onGround = par1NBTTagCompound.getBoolean("OnGround");
    setPosition(posX, posY, posZ);
    setRotation(rotationYaw, rotationPitch);
    readEntityFromNBT(par1NBTTagCompound);
  }
Example #3
0
 /** Sets the location and Yaw/Pitch of an entity in the world */
 public void setLocationAndAngles(double par1, double par3, double par5, float par7, float par8) {
   lastTickPosX = prevPosX = posX = par1;
   lastTickPosY = prevPosY = posY = par3 + (double) yOffset;
   lastTickPosZ = prevPosZ = posZ = par5;
   rotationYaw = par7;
   rotationPitch = par8;
   setPosition(posX, posY, posZ);
 }
Example #4
0
  @Override
  public void setPosition(double d, double d1, double d2) {
    super.setPosition(d, d1, d2);
    boundingBox.minX = posX;
    boundingBox.minY = posY;
    boundingBox.minZ = posZ;

    boundingBox.maxX = posX + iSize;
    boundingBox.maxY = posY + jSize;
    boundingBox.maxZ = posZ + kSize;
  }
Example #5
0
  /**
   * Sets the position and rotation. Only difference from the other one is no bounding on the
   * rotation. Args: posX, posY, posZ, yaw, pitch
   */
  public void setPositionAndRotation2(
      double par1, double par3, double par5, float par7, float par8, int par9) {
    setPosition(par1, par3, par5);
    setRotation(par7, par8);
    List list =
        worldObj.getCollidingBoundingBoxes(this, boundingBox.contract(0.03125D, 0.0D, 0.03125D));

    if (list.size() > 0) {
      double d = 0.0D;

      for (int i = 0; i < list.size(); i++) {
        AxisAlignedBB axisalignedbb = (AxisAlignedBB) list.get(i);

        if (axisalignedbb.maxY > d) {
          d = axisalignedbb.maxY;
        }
      }

      par3 += d - boundingBox.minY;
      setPosition(par1, par3, par5);
    }
  }
Example #6
0
  /** Sets the entity's position and rotation. Args: posX, posY, posZ, yaw, pitch */
  public void setPositionAndRotation(
      double par1, double par3, double par5, float par7, float par8) {
    prevPosX = posX = par1;
    prevPosY = posY = par3;
    prevPosZ = posZ = par5;
    prevRotationYaw = rotationYaw = par7;
    prevRotationPitch = rotationPitch = par8;
    ySize = 0.0F;
    double d = prevRotationYaw - par7;

    if (d < -180D) {
      prevRotationYaw += 360F;
    }

    if (d >= 180D) {
      prevRotationYaw -= 360F;
    }

    setPosition(posX, posY, posZ);
    setRotation(par7, par8);
  }
Example #7
0
  /**
   * Keeps moving the entity up so it isn't colliding with blocks and other requirements for this
   * entity to be spawned (only actually used on players though its also on Entity)
   */
  protected void preparePlayerToSpawn() {
    if (worldObj == null) {
      return;
    }

    do {
      if (posY <= 0.0D) {
        break;
      }

      setPosition(posX, posY, posZ);

      if (worldObj.getCollidingBoundingBoxes(this, boundingBox).size() == 0) {
        break;
      }

      posY++;
    } while (true);

    motionX = motionY = motionZ = 0.0D;
    rotationPitch = 0.0F;
  }
Example #8
0
 public Entity(World par1World) {
   entityId = nextEntityID++;
   renderDistanceWeight = 1.0D;
   preventEntitySpawning = false;
   onGround = false;
   isCollided = false;
   velocityChanged = false;
   field_9293_aM = 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 Random();
   ticksExisted = 0;
   fireResistance = 1;
   fire = 0;
   inWater = false;
   heartsLife = 0;
   firstUpdate = true;
   isImmuneToFire = false;
   dataWatcher = new DataWatcher();
   addedToChunk = false;
   worldObj = par1World;
   setPosition(0.0D, 0.0D, 0.0D);
   dataWatcher.addObject(0, Byte.valueOf((byte) 0));
   dataWatcher.addObject(1, Short.valueOf((short) 300));
   entityInit();
 }
Example #9
0
 public void updateRiderPosition() {
   riddenByEntity.setPosition(
       posX, posY + getMountedYOffset() + riddenByEntity.getYOffset(), posZ);
 }
 public void setPosition(double var1, double var3, double var5, boolean var7) {
   if (var7) {
     super.setPosition(var1, var3, var5);
   }
 }
Example #11
0
 public boolean teleport(FixedLocation location) {
   handle.setPosition(location.getX(), location.getY(), location.getZ());
   handle.setAngles((float) location.getYaw(), (float) location.getPitch());
   return true;
 }