@Nonnull @Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float par8, float par9, float par10) { ItemStack stack = player.getHeldItem(hand); if(stack.getItemDamage() == 4 || stack.getItemDamage() == 14) return EntityDoppleganger.spawn(player, stack, world, pos, stack.getItemDamage() == 14) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; else if(stack.getItemDamage() == 20 && net.minecraft.item.ItemDye.applyBonemeal(stack, world, pos, player, hand)) { if(!world.isRemote) world.playEvent(2005, pos, 0); return EnumActionResult.SUCCESS; } return super.onItemUse(player, world, pos, hand, side, par8, par9, par10); }
@Override public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (ItemDye.applyBonemeal(stack, world, pos, player)) { if (!world.isRemote) { // Bone meal effect world.playEvent(2005, pos, 0); } return EnumActionResult.SUCCESS; } return EnumActionResult.PASS; }
protected boolean fertilize(BlockPos pos) { Optional<ItemStack> stack = InventoryTools.stream(miscInventory).filter(this::isBonemeal).findFirst(); if (stack.isPresent() && ItemDye.applyBonemeal(stack.get(), world, pos, AWFakePlayer.get(world), EnumHand.MAIN_HAND)) { world.playEvent(2005, pos, 0); return true; } return false; } }
@Override protected IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing, World world, BlockPos position) { if (world.rand.nextInt(20) > 1) { return storedData; } if (ExtraBeesFlowers.FRUIT.isAcceptedFlower(world, position)) { ItemDye.applyBonemeal(new ItemStack(Blocks.DIRT, 1), world, position); return storedData; } return storedData; } },
@Override protected IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing, World world, BlockPos position) { if (world.rand.nextInt(20) > 1) { return storedData; } if (ExtraBeesFlowers.SAPLING.isAcceptedFlower(world, position)) { ItemDye.applyBonemeal(new ItemStack(Blocks.DIRT, 1), world, position); return storedData; } return storedData; } },
@Override public void finalFloorPass(World world, BlockPos pos) { if(grassChance > 0 && world.rand.nextInt(grassChance) == 0) ItemDye.applyBonemeal(new ItemStack(Items.DYE, 1, 14), world, pos); if(shrubChance > 0 && world.rand.nextInt(shrubChance) == 0) shrubGen.generate(world, world.rand, pos.up()); }
@Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); if (ItemDye.applyBonemeal(stack, world, pos, player, hand)) { if (!world.isRemote) world.playEvent(2005, pos, 0); return EnumActionResult.SUCCESS; } return EnumActionResult.FAIL; } }
@Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float par8, float par9, float par10){ ItemStack stack = player.getHeldItem(hand); if(ItemDye.applyBonemeal(stack, world, pos, player, hand)){ if(!world.isRemote){ world.playEvent(2005, pos, 0); } return EnumActionResult.SUCCESS; } return super.onItemUse(player, world, pos, hand, side, par8, par9, par10); }
@Override protected IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing, World world, BlockPos position) { if (world.rand.nextInt(20) > 1) { return storedData; } IBlockState blockState = world.getBlockState(position); if (blockState.getBlock() == Blocks.BROWN_MUSHROOM || blockState.getBlock() == Blocks.RED_MUSHROOM) { ItemDye.applyBonemeal(new ItemStack(Blocks.DIRT, 1), world, position); return storedData; } return storedData; } },
public boolean bonemeal(EntityPlayer player, BlockPos pos) { boolean did = ItemDye.applyBonemeal(new ItemStack(Items.DYE, 1, 15), player.getEntityWorld(), pos); if(did) player.getEntityWorld().playEvent(2005, pos, 0); return did; }
@Override public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack heldItem = player.getHeldItem(hand); if (!player.canPlayerEdit(pos.offset(facing), facing, heldItem)) { return EnumActionResult.FAIL; } if (ItemDye.applyBonemeal(heldItem, worldIn, pos, player, hand)) { if (!worldIn.isRemote) { worldIn.playEvent(2005, pos, 0); } return EnumActionResult.SUCCESS; } return EnumActionResult.PASS; } }
@Override public void updateTick(World world, BlockPos blockPos, IBlockState blockState, Random random) { if(random.nextInt(CHANCE_DESPAWN) == 0) { if(random.nextInt(CHANCE_BONEMEAL) == 0) { for(int xr = - 2; xr <= 2; xr++) { for(int zr = - 2; zr <= 2; zr++) { if(random.nextInt(9) == 0) { IBlockState blockBelow = world.getBlockState(blockPos.add(xr, -1, zr)); if(blockBelow.getBlock() == Blocks.DIRT) { world.setBlockState(blockPos.add(xr, -1, zr), Blocks.GRASS.getDefaultState()); } else if(blockBelow == Blocks.GRASS) { ItemDye.applyBonemeal(new ItemStack(Items.DYE, 1), world, blockPos.add(xr, -1, zr)); } ItemDye.applyBonemeal(new ItemStack(Items.DYE, 1), world, blockPos.add(xr, -1, zr)); } } } } world.setBlockToAir(blockPos); } }
@Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos blockPos, EnumHand hand, EnumFacing side, float coordX, float coordY, float coordZ) { ItemStack itemStack = player.getHeldItem(hand); boolean done = false; int attempts = 0; while (attempts < 2) { done = ItemDye.applyBonemeal(itemStack.copy(), world, blockPos, player, hand) | done; attempts++; } if (done) { itemStack.shrink(1); if (!world.isRemote) { world.playBroadcastSound(2005, blockPos, 0); } return EnumActionResult.SUCCESS; } return super.onItemUse(player, world, blockPos, hand, side, coordX, coordY, coordZ); }
@Override public ItemStack dispenseStack(IBlockSource source, ItemStack stack){ EnumFacing facing = source.getBlockState().getValue(BlockDispenser.FACING); BlockPos pos = source.getBlockPos().offset(facing); if(ItemDye.applyBonemeal(stack, source.getWorld(), pos)){ source.getWorld().playEvent(2005, pos, 0); } return stack; }
if (ItemDye.applyBonemeal(clone, world, position, AWFakePlayer.get(world), EnumHand.MAIN_HAND)) { miscInventory.extractItem(slot, 1, false); world.playEvent(2005, position, 0);
@Override protected ItemStack dispenseStack(IBlockSource blockSource, ItemStack itemStack) { EnumFacing enumfacing = blockSource.getWorld().getBlockState(blockSource.getBlockPos()).getValue(BlockDispenser.FACING); World world = blockSource.getWorld(); int x = (int) blockSource.getX() + enumfacing.getFrontOffsetX(); int y = (int) blockSource.getY() + enumfacing.getFrontOffsetY(); int z = (int) blockSource.getZ() + enumfacing.getFrontOffsetZ(); BlockPos pos = new BlockPos(x, y, z); if (ItemDye.applyBonemeal(itemStack, world, pos)) { if (!world.isRemote) { world.playEvent(2005, pos, 0); } this.didFertilize = true; } else { this.didFertilize = false; } return itemStack; }
if (!spellRing.taxCaster(spell, true)) return false; if (caster == null || (caster instanceof EntityPlayer && BlockUtils.hasEditPermission(targetPos, (EntityPlayerMP) caster))) ItemDye.applyBonemeal(new ItemStack(Items.DYE), world, targetPos); } else if (world.getBlockState(targetPos).getBlock() instanceof IPlantable) { IBlockState state = world.getBlockState(targetPos);
@Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos blockPos, EnumHand hand, EnumFacing side, float coordX, float coordY, float coordZ) { ItemStack itemStack = player.getHeldItem(hand); Block block = world.getBlockState(blockPos).getBlock(); if(player.isSneaking()) { boolean done = false; int attempts = 0; while(attempts < ExcrementPileConfig.effectiveness) { done = ItemDye.applyBonemeal(itemStack.copy(), world, blockPos, player, hand) | done; attempts++; } if(done) { itemStack.shrink(1); if (!world.isRemote) { world.playBroadcastSound(2005, blockPos, 0); } return EnumActionResult.SUCCESS; } } else { if (block == ExcrementPile.getInstance() && !itemStack.isEmpty()) { if(ExcrementPile.getInstance().canHeightenPileAt(world, blockPos)) { ExcrementPile.getInstance().heightenPileAt(world, blockPos); itemStack.shrink(1); return EnumActionResult.SUCCESS; } return EnumActionResult.PASS; } } return super.onItemUse(player, world, blockPos, hand, side, coordX, coordY, coordZ); }
@Override protected void afterEaten() { EntityPlayer player = Utils.getPlayer(blackAnt.getEntityWorld()); BlockPos pos = new BlockPos(cropX, cropY, cropZ); if (!blackAnt.getEntityWorld().isRemote) if (!isFilterSlotEmpty() && !isAntInvSlotEmpty()) { Item filterItem = getFilterSlotStack().getItem(); Item invItem = getAntInvSlotStack().getItem(); int invItemMeta = getAntInvSlotStack().getItemDamage(); int filterItemMeta = getFilterSlotStack().getItemDamage(); if (filterItem == invItem && filterItemMeta == invItemMeta) { Utils.rightClickItemAt(blackAnt.getEntityWorld(), pos, EnumHand.MAIN_HAND, EnumFacing.UP, new ItemStack(invItem, invItemMeta)); ItemDye.applyBonemeal(getAntInvSlotStack(), blackAnt.getEntityWorld(), pos, player, EnumHand.MAIN_HAND); if (getAntInvSlotStack().getCount() < 1) blackAnt.setInventorySlotContents(INVENTORY_SLOT, ItemStack.EMPTY); } } }