Пример #1
0
 @Override
 public ArrayList<ItemStack> doHarvest() {
   int meta = blockPos.getBlockMeta(world);
   ArrayList<ItemStack> harvest;
   if (block == Blocks.brown_mushroom_block) {
     harvest =
         Blocks.brown_mushroom_block.getDrops(world, blockPos.x, blockPos.y, blockPos.z, meta, 0);
   } else {
     harvest =
         Blocks.red_mushroom_block.getDrops(world, blockPos.x, blockPos.y, blockPos.z, meta, 0);
   }
   blockPos.setBlock(world, Blocks.air);
   Proxies.common.addBlockDestroyEffects(world, blockPos.x, blockPos.y, blockPos.z, block, 0);
   return harvest;
 }
Пример #2
0
 @Override
 public void growCrop(ItemStack crop, BlockPosition blockPos) {
   if (crop.isItemEqual(new ItemStack(Blocks.sapling))) {
     ((BlockSapling) Blocks.sapling)
         .func_149853_b(worldObj, worldObj.rand, blockPos.x, blockPos.y, blockPos.z);
   }
   if (ForestryProxy.moduleArboricultureEnabled) {
     if (crop.isItemEqual(new ItemStack(ForestryProxy.blockSapling))) {
       ForestryProxy.blockSapling.func_149853_b(
           worldObj, worldObj.rand, blockPos.x, blockPos.y, blockPos.z);
     }
   }
   if (crop.getItem() == Item.getItemFromBlock(Blocks.wheat)) {
     ((BlockCrops) Blocks.wheat)
         .func_149853_b(worldObj, worldObj.rand, blockPos.x, blockPos.y, blockPos.z);
   }
   if (crop.isItemEqual(new ItemStack(Blocks.nether_wart))) {
     blockPos.setBlock(worldObj, blockPos.getBlock(worldObj), 3);
   }
 }
Пример #3
0
  @Override
  public int[] getNextPosition() {
    int[] next = null;
    BlockPosition cleanBlockPos = blockPos.copy();
    cleanBlockPos.orientation = ForgeDirection.UP;
    cleanBlockPos.moveForwards(1);
    Block suspect = cleanBlockPos.getBlock(world);

    while (suspect == Blocks.brown_mushroom_block || suspect == Blocks.red_mushroom_block) {
      next = new int[] {cleanBlockPos.x, cleanBlockPos.y, cleanBlockPos.z};
      cleanBlockPos.moveForwards(1);
      suspect = cleanBlockPos.getBlock(world);
    }

    if (next != null) {
      return next;
    }

    cleanBlockPos = blockPos.copy();
    cleanBlockPos.orientation = ForgeDirection.DOWN;
    cleanBlockPos.moveForwards(1);
    suspect = cleanBlockPos.getBlock(world);

    while (suspect == Blocks.brown_mushroom_block || suspect == Blocks.red_mushroom_block) {
      next = new int[] {cleanBlockPos.x, cleanBlockPos.y, cleanBlockPos.z};
      cleanBlockPos.moveForwards(1);
      suspect = cleanBlockPos.getBlock(world);
    }
    return next;
  }
Пример #4
0
 public CropMushroom(World world, BlockPosition blockPosition) {
   this.world = world;
   this.blockPos = blockPosition.copy();
   block = blockPos.getBlock(world);
 }