コード例 #1
0
 @Override
 public void onUpdate() {
   // Copied from Hookshot: avoiding entityThrowable's update while in ground
   if (isInGround()) {
     lastTickPosX = posX;
     lastTickPosY = posY;
     lastTickPosZ = posZ;
     super.onEntityUpdate();
   } else {
     super.onUpdate();
   }
   if (canUpdate()) {
     // can hold onto whip for five minutes
     if (isInGround() && ticksExisted < 6000) {
       ++ticksInGround;
       if (shouldSwing()) {
         swingThrower();
       }
     } else if (ticksExisted > getMaxDistance()) {
       WorldUtils.playSoundAtEntity(this, Sounds.WHIP_CRACK, 0.5F, 0.2F);
       setDead();
     }
   } else {
     setDead();
   }
 }
コード例 #2
0
ファイル: NodShell.java プロジェクト: McRaichu/Minecraft
  @Override
  public void onEntityUpdate() {

    super.onEntityUpdate();

    if (ticksExisted >= 100) {
      this.setDead();
    }
    if (!worldObj.isRemote) {
      if (isHoming && target != null) {
        double d0 = target.posX - this.posX;
        double d1 = target.posY + (double) target.getEyeHeight() - this.posY;
        double d2 = target.posZ - this.posZ;

        this.setThrowableHeading(d0, d1, d2, speed, 0.0F);
        speed = speed + 0.06F;
      } else if (isHoming && target == null) {
        this.setDead();
      }
    }
  }