Java Code Examples for net.minecraft.init.Items#bucket()
The following examples show how to use
net.minecraft.init.Items#bucket() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: GardenCollection File: BlockLargePot.java License: MIT License | 5 votes |
@Override protected boolean applyItemToGarden (World world, int x, int y, int z, EntityPlayer player, ItemStack itemStack, float hitX, float hitY, float hitZ, boolean hitValid) { ItemStack item = (itemStack == null) ? player.inventory.getCurrentItem() : itemStack; if (item == null) return false; TileEntityGarden garden = getTileEntity(world, x, y, z); if (garden.getSubstrate() != null) { if (item.getItem() == Items.bucket) { if (Block.getBlockFromItem(garden.getSubstrate().getItem()) == Blocks.water) { player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(Items.water_bucket)); garden.setSubstrate(null); garden.markDirty(); world.markBlockForUpdate(x, y, z); } return true; } if (item.getItem() == Items.water_bucket) { applyWaterToSubstrate(world, x, y, z, garden, player); return true; } else if (item.getItem() instanceof ItemHoe) { applyHoeToSubstrate(world, x, y, z, garden, player); return true; } } return super.applyItemToGarden(world, x, y, z, player, itemStack, hitX, hitY, hitZ, hitValid); }
Example 2
Source Project: PneumaticCraft File: EventHandlerPneumaticCraft.java License: GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void FillBucket(FillBucketEvent event){ MovingObjectPosition p = event.target; if(event.current == null || event.current.getItem() != Items.bucket || event.world.getBlockMetadata(p.blockX, p.blockY, p.blockZ) != 0) return; ItemStack result = attemptFill(event.world, event.target); if(result != null) { event.result = result; AchievementHandler.giveAchievement(event.entityPlayer, result); event.setResult(Result.ALLOW); } }
Example 3
Source Project: BigReactors File: BRLoader.java License: MIT License | 5 votes |
@SubscribeEvent public void onBucketFill(FillBucketEvent e) { if(e.current.getItem() != Items.bucket) { return; } ItemStack filledBucket = fillBucket(e.world, e.target); if(filledBucket != null) { e.world.setBlockToAir(e.target.blockX, e.target.blockY, e.target.blockZ); e.result = filledBucket; e.setResult(Result.ALLOW); } }