예제 #1
0
 public ItemStack getEggs() {
   if (TFC_Time.getTotalTicks() >= this.nextEgg) {
     this.nextEgg = TFC_Time.getTotalTicks() + EggTime;
     return new ItemStack(TFCItems.Egg, 1);
   }
   return null;
 }
예제 #2
0
  public EntityChickenTFC(World par1World) {
    super(par1World);
    this.setSize(0.3F, 0.7F);
    this.timeUntilNextEgg = 9999; // Here we set the vanilla egg timer to 9999
    this.nextEgg = TFC_Time.getTotalTicks() + EggTime;
    hunger = 168000;
    mateSizeMod = 1f;
    sex = rand.nextInt(2);

    this.tasks.taskEntries.clear();
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(1, new EntityAIPanic(this, 1.4D));
    this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D));
    this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
    this.tasks.addTask(7, new EntityAILookIdle(this));
    this.tasks.addTask(6, this.aiEatGrass);
    addAI();

    size_mod =
        (((rand.nextInt((degreeOfDiversion + 1) * 10) * (rand.nextBoolean() ? 1 : -1)) / 100f) + 1F)
            * (1.0F - 0.1F * sex);

    //	We hijack the growingAge to hold the day of birth rather
    //	than number of ticks to next growth event. We want spawned
    //	animals to be adults, so we set their birthdays far enough back
    //	in time such that they reach adulthood now.
    //
    this.setAge((int) TFC_Time.getTotalDays() - getNumberOfDaysToAdult());
    // For Testing Only(makes spawned animals into babies)
    // this.setGrowingAge((int) TFC_Time.getTotalDays());
  }
예제 #3
0
 public void roosterCrow() {
   if ((TFC_Time.getTotalTicks() - 15) % TFC_Time.dayLength == 0
       && getGender() == GenderEnum.MALE
       && isAdult()) {
     this.playSound(TFC_Sounds.ROOSTERCROW, 10, rand.nextFloat() + 0.5F);
   }
 }