コード例 #1
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());
  }
コード例 #2
0
  public EntityChickenTFC(World world, IAnimal mother, ArrayList<Float> data) {
    this(world);
    float father_size = data.get(0);
    this.posX = ((EntityLivingBase) mother).posX;
    this.posY = ((EntityLivingBase) mother).posY;
    this.posZ = ((EntityLivingBase) mother).posZ;
    size_mod =
        (((rand.nextInt(degreeOfDiversion + 1) * 10 * (rand.nextBoolean() ? 1 : -1)) / 100f) + 1F)
            * (1.0F - 0.1F * sex)
            * (float) Math.sqrt((mother.getSize() + father_size) / 1.9F);
    size_mod = Math.min(Math.max(size_mod, 0.7F), 1.3f);

    //	We hijack the growingAge to hold the day of birth rather
    //	than number of ticks to next growth event.
    //
    this.setAge((int) TFC_Time.getTotalDays());
  }
コード例 #3
0
  public EntityChickenTFC(
      World world, double posX, double posY, double posZ, NBTTagCompound genes) {
    this(world);
    this.posX = posX;
    this.posY = posY;
    this.posZ = posZ;
    float m_size = genes.getFloat("m_size");
    float f_size = genes.getFloat("f_size");
    size_mod =
        (((rand.nextInt(degreeOfDiversion + 1) * (rand.nextBoolean() ? 1 : -1)) / 10f) + 1F)
            * (1.0F - 0.1F * sex)
            * (float) Math.sqrt((m_size + f_size) / 1.9F);
    // size_mod = Math.min(Math.max(size_mod, 0.7F),1.3f);

    //	We hijack the growingAge to hold the day of birth rather
    //	than number of ticks to next growth event.
    //
    this.setAge((int) TFC_Time.getTotalDays());
  }
コード例 #4
0
 @Override
 public boolean isAdult() {
   return getBirthDay() + getNumberOfDaysToAdult() <= TFC_Time.getTotalDays();
 }