private void initSequence(Animation parSequenceIndex) {
    // TODO
    // Should control here which animations are interruptible, in which priority
    // I.e. could reject certain changes depending on what current animation is playing

    // handle case where animation sequence isn't available
    if (mapOfSequences.get(parSequenceIndex) == null) {
      JurassiCraft.instance
          .getLogger()
          .error(
              "Requested an anim id "
                  + parSequenceIndex.toString()
                  + " that doesn't have animation sequence in map for entity "
                  + theEntity.getEntityId());
      currentSequence = Animations.IDLE.get();
      theEntity.setAnimation(Animations.IDLE.get());
    } else if (currentSequence != Animations.IDLE.get()
        && currentSequence == parSequenceIndex) // finished sequence but no new sequence set
    {
      //            JurassiCraft.instance.getLogger().debug("Intializing to idle sequence");
      currentSequence = Animations.IDLE.get();
      theEntity.setAnimation(Animations.IDLE.get());
    } else if (theEntity.isCarcass()) {
      currentSequence = Animations.DYING.get();
    } else {
      currentSequence = parSequenceIndex;
    }
  }
Example #2
0
  @Override
  public void updateTask() {
    if (dinosaur
        .getEntityBoundingBox()
        .intersectsWith(mate.getEntityBoundingBox().expand(0.5D, 0.5D, 0.5D))) {
      Animation.sendAnimationPacket(dinosaur, Animations.MATING.get());

      dinosaur.getMetabolism().decreaseFood(1000);
    }
  }
 @Override
 public void startExecuting() {
   super.startExecuting();
   Animation.sendAnimationPacket(
       animatingEntity,
       animatingEntity.getRNG().nextBoolean()
           ? Animations.LOOKING_LEFT.get()
           : Animations.LOOKING_RIGHT.get());
   animatingEntity.getNavigator().clearPathEntity();
 }