Beispiel #1
0
 @Override
 /**
  * Called when a user uses the creative pick block button on this block
  *
  * @param target The full target the player is looking at
  * @return A ItemStack to add to the player's inventory, Null if nothing should be added.
  */
 public ItemStack getPickBlock(
     MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
   TileEntityBerries tile = (TileEntityBerries) world.getTileEntity(pos);
   if (tile == null) return BerryManager.getBerryItem(1);
   return BerryManager.getBerryItem(tile.getBerryId());
 }
Beispiel #2
0
  @Override
  /**
   * This returns a complete list of items dropped from this block.
   *
   * @param world The current world
   * @param pos Block position in world
   * @param state Current state
   * @param fortune Breakers fortune level
   * @return A ArrayList containing all items this block drops
   */
  public List<ItemStack> getDrops(
      IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
    List<ItemStack> ret = new java.util.ArrayList<ItemStack>();

    Random rand = world instanceof World ? ((World) world).rand : RANDOM;

    int count = quantityDropped(state, fortune, rand);
    for (int i = 0; i < count; i++) {
      TileEntityBerries tile = (TileEntityBerries) world.getTileEntity(pos);
      ItemStack stack = BerryManager.getBerryItem(BerryManager.berryNames.get(tile.getBerryId()));
      if (stack != null) {
        ret.add(stack);
      }
    }
    return ret;
  }