コード例 #1
0
  public void updateTick(World world, int i, int j, int k, Random random) {
    if ((!world.multiplayerWorld)
        && ((this.blockID == Block.plantYellow.blockID)
            || (this.blockID == Block.plantRed.blockID))) {
      // ATTEMPT REPRODUCTION
      ModOptions flowers = mod_AutoForest.flowers;
      boolean grow = ((ModBooleanOption) flowers.getOption("FlowersGrow")).getValue();
      if (grow) {
        attemptGrowth(world, i, j, k);
      }

      // ATTEMPT DEATH
      boolean death = mod_AutoForest.flowerDeath.getValue();
      if (death && hasDied(world, i, j, k)) {
        death(world, i, j, k);
      }
    }

    if (world.getBlockId(i, j, k) != 0) {
      checkFlowerChange(world, i, j, k);
    }
  }
コード例 #2
0
 public boolean canBlockStay(World world, int i, int j, int k) {
   return (world.getFullBlockLightValue(i, j, k) >= 8 || world.canBlockSeeTheSky(i, j, k))
       && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
 }
コード例 #3
0
 public boolean canPlaceBlockAt(World world, int i, int j, int k) {
   return super.canPlaceBlockAt(world, i, j, k)
       && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
 }
コード例 #4
0
 protected final void checkFlowerChange(World world, int i, int j, int k) {
   if (!canBlockStay(world, i, j, k)) {
     dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
     world.setBlockWithNotify(i, j, k, 0);
   }
 }