3

In Minecraft 1.14.2, how do I make a water bucket in adventure mode that lets me pick up water and place it on another specific block? I'm currently making an adventure map and can't figure it out. I know the commands for making a bucket that can pick up water, but it won't place down, and the command for summoning a filled bucket that I can place down, but it won't pick up water again.

How do I get a water bucket in adventure mode that lets me pick up water and place it?

  • I updated my answer, it now also contains the commands for the second idea. You need 37 extremely long commands, but the effect is that the player does not need to -kick- throw the bucket anymore. – Fabian Röling Dec 31 '19 at 14:50
6

The issue is that the bucket doesn't get changed to contain water, it gets completely replaced. That's just how Minecraft does it and usually it works pretty well, just not in your case.

Because player NBT cannot be directly set by commands, you can't take advantage of the full range of convenient NBT commands. Otherwise it would be a simple act of running

/data modify entity @s Inventory[{id:"minecraft:water_bucket"}].CanPlaceOn set value ["stone","dirt"]

… with a full list of all blocks in the CanPlaceOn tag. But because you cannot do that, you have two main options left:

  1. Instruct the player to throw the bucket onto the ground and pick it back up. That way you can edit the bucket's NBT.
  2. Replace the item in the inventory with a new bucket. This can either be pretty easy (just /clear and /give) or extremely complicated, if you don't want the bucket to move to the first slot, because then you need to do a lot of slot checking, NBT comparisons and so on.

The first option:

/data merge entity @e[type=item,nbt={Item:{id:"minecraft:water_bucket"}},limit=1] {Item:{id:"water_bucket",Count:1,tag:{CanPlaceOn:["stone"]}}}

The problem: This only makes the water placeable on stone, not all blocks. There is no way to make it placeable on all blocks without specifying all blocks. Luckily I did this long ago in this answer and have since then updated it to 1.14. So the complete command is now:

/data merge entity @e[type=item,nbt={Item:{id:"minecraft:water_bucket"}},limit=1] {Item:{id:"water_bucket",Count:1,tag:{CanPlaceOn:["acacia_button","acacia_door","acacia_fence_gate","acacia_fence","acacia_leaves","acacia_log","acacia_planks","acacia_pressure_plate","acacia_sapling","acacia_sign","acacia_slab","acacia_stairs","acacia_trapdoor","acacia_wall_sign","acacia_wood","activator_rail","allium","andesite","andesite_slab","andesite_stairs","andesite_wall","anvil","attached_melon_stem","attached_pumpkin_stem","azure_bluet","bamboo","bamboo_sapling","barrel","barrier","beacon","bedrock","beetroots","bell","birch_button","birch_door","birch_fence_gate","birch_fence","birch_leaves","birch_log","birch_planks","birch_pressure_plate","birch_sapling","birch_sign","birch_slab","birch_stairs","birch_trapdoor","birch_wall_sign","birch_wood","black_banner","black_bed","black_carpet","black_concrete_powder","black_concrete","black_glazed_terracotta","black_shulker_box","black_stained_glass","black_stained_glass_pane","black_terracotta","black_wall_banner","black_wool","blast_furnace","blue_banner","blue_bed","blue_carpet","blue_concrete_powder","blue_concrete","blue_glazed_terracotta","blue_ice","blue_orchid","blue_shulker_box","blue_stained_glass","blue_stained_glass_pane","blue_terracotta","blue_wall_banner","blue_wool","bone_block","bookshelf","brain_coral","brain_coral_block","brain_coral_fan","brain_coral_wall_fan","brewing_stand","brick_slab","brick_stairs","brick_wall","bricks","brown_banner","brown_bed","brown_carpet","brown_concrete_powder","brown_concrete","brown_glazed_terracotta","brown_mushroom_block","brown_mushroom","brown_shulker_box","brown_stained_glass","brown_stained_glass_pane","brown_terracotta","brown_wall_banner","brown_wool","bubble_column","bubble_coral","bubble_coral_block","bubble_coral_fan","bubble_coral_wall_fan","cactus","cake","campfire","carrots","cartography_table","carved_pumpkin","cauldron","chain_command_block","chest","chipped_anvil","chiseled_quartz_block","chiseled_red_sandstone","chiseled_sandstone","chiseled_stone_bricks","chorus_flower","chorus_plant","clay","coal_block","coal_ore","coarse_dirt","cobblestone","cobblestone_slab","cobblestone_stairs","cobblestone_wall","cobweb","cocoa","command_block","comparator","composter","conduit","cornflower","cracked_stone_bricks","crafting_table","creeper_head","creeper_wall_head","cut_red_sandstone","cut_red_sandstone_slab","cut_sandstone","cut_sandstone_slab","cyan_banner","cyan_bed","cyan_carpet","cyan_concrete_powder","cyan_concrete","cyan_glazed_terracotta","cyan_shulker_box","cyan_stained_glass","cyan_stained_glass_pane","cyan_terracotta","cyan_wall_banner","cyan_wool","damaged_anvil","dandelion","dark_oak_button","dark_oak_door","dark_oak_fence_gate","dark_oak_fence","dark_oak_leaves","dark_oak_log","dark_oak_planks","dark_oak_pressure_plate","dark_oak_sapling","dark_oak_sign","dark_oak_slab","dark_oak_stairs","dark_oak_trapdoor","dark_oak_wall_sign","dark_oak_wood","dark_prismarine","dark_prismarine_slab","dark_prismarine_stairs","daylight_detector","dead_brain_coral","dead_brain_coral_block","dead_brain_coral_fan","dead_brain_coral_wall_fan","dead_bubble_coral","dead_bubble_coral_block","dead_bubble_coral_fan","dead_bubble_coral_wall_fan","dead_bush","dead_fire_coral","dead_fire_coral_block","dead_fire_coral_fan","dead_fire_coral_wall_fan","dead_horn_coral","dead_horn_coral_block","dead_horn_coral_fan","dead_horn_coral_wall_fan","dead_tube_coral","dead_tube_coral_block","dead_tube_coral_fan","dead_tube_coral_wall_fan","detector_rail","diamond_block","diamond_ore","diorite","diorite_slab","diorite_stairs","diorite_wall","dirt","dispenser","dragon_egg","dragon_head","dragon_wall_head","dried_kelp_block","dropper","emerald_block","emerald_ore","enchanting_table","end_gateway","end_portal_frame","end_portal","end_rod","end_stone","end_stone_brick_slab","end_stone_brick_stairs","end_stone_brick_wall","end_stone_bricks","ender_chest","farmland","fern","fire","fire_coral","fire_coral_block","fire_coral_fan","fire_coral_wall_fan","fletching_table","flower_pot","frosted_ice","furnace","glass","glass_pane","glowstone","gold_block","gold_ore","granite","granite_slab","granite_stairs","granite_wall","grass_block","grass_path","grass","gravel","gray_banner","gray_bed","gray_carpet","gray_concrete_powder","gray_concrete","gray_glazed_terracotta","gray_shulker_box","gray_stained_glass","gray_stained_glass_pane","gray_terracotta","gray_wall_banner","gray_wool","green_banner","green_bed","green_carpet","green_concrete_powder","green_concrete","green_glazed_terracotta","green_shulker_box","green_stained_glass","green_stained_glass_pane","green_terracotta","green_wall_banner","green_wool","grindstone","hay_block","heavy_weighted_pressure_plate","hopper","horn_coral","horn_coral_block","horn_coral_fan","horn_coral_wall_fan","ice","infested_chiseled_stone_bricks","infested_cobblestone","infested_cracked_stone_bricks","infested_mossy_stone_bricks","infested_stone","infested_stone_bricks","iron_bars","iron_door","iron_block","iron_ore","iron_trapdoor","jack_o_lantern","jigsaw","jukebox","jungle_button","jungle_door","jungle_fence_gate","jungle_fence","jungle_leaves","jungle_log","jungle_planks","jungle_pressure_plate","jungle_sapling","jungle_sign","jungle_slab","jungle_stairs","jungle_trapdoor","jungle_wall_sign","jungle_wood","kelp","kelp_plant","ladder","lantern","lapis_block","lapis_ore","large_fern","lectern","lever","light_blue_banner","light_blue_bed","light_blue_carpet","light_blue_concrete_powder","light_blue_concrete","light_blue_glazed_terracotta","light_blue_shulker_box","light_blue_stained_glass","light_blue_stained_glass_pane","light_blue_terracotta","light_blue_wall_banner","light_blue_wool","light_gray_banner","light_gray_bed","light_gray_carpet","light_gray_concrete_powder","light_gray_concrete","light_gray_glazed_terracotta","light_gray_shulker_box","light_gray_stained_glass","light_gray_stained_glass_pane","light_gray_terracotta","light_gray_wall_banner","light_gray_wool","light_weighted_pressure_plate","lilac","lily_pad","lily_of_the_valley","lime_banner","lime_bed","lime_carpet","lime_concrete_powder","lime_concrete","lime_glazed_terracotta","lime_shulker_box","lime_stained_glass","lime_stained_glass_pane","lime_terracotta","lime_wall_banner","lime_wool","loom","magenta_banner","magenta_bed","magenta_carpet","magenta_concrete_powder","magenta_concrete","magenta_glazed_terracotta","magenta_shulker_box","magenta_stained_glass","magenta_stained_glass_pane","magenta_terracotta","magenta_wall_banner","magenta_wool","magma_block","melon","melon_stem","mossy_cobblestone","mossy_cobblestone_slab","mossy_cobblestone_stairs","mossy_cobblestone_wall","mossy_stone_brick_slab","mossy_stone_brick_stairs","mossy_stone_brick_wall","mossy_stone_bricks","moving_piston","mushroom_stem","mycelium","nether_brick_fence","nether_brick_slab","nether_brick_stairs","nether_brick_wall","nether_bricks","nether_portal","nether_quartz_ore","nether_wart_block","nether_wart","netherrack","note_block","oak_button","oak_door","oak_fence_gate","oak_fence","oak_leaves","oak_log","oak_planks","oak_pressure_plate","oak_sapling","oak_sign","oak_slab","oak_stairs","oak_trapdoor","oak_wall_sign","oak_wood","observer","obsidian","orange_banner","orange_bed","orange_carpet","orange_concrete_powder","orange_concrete","orange_glazed_terracotta","orange_shulker_box","orange_stained_glass","orange_stained_glass_pane","orange_terracotta","orange_tulip","orange_wall_banner","orange_wool","oxeye_daisy","packed_ice","peony","petrified_oak_slab","pink_banner","pink_bed","pink_carpet","pink_concrete_powder","pink_concrete","pink_glazed_terracotta","pink_shulker_box","pink_stained_glass","pink_stained_glass_pane","pink_terracotta","pink_tulip","pink_wall_banner","pink_wool","piston_head","piston","player_head","player_wall_head","podzol","polished_andesite","polished_andesite_slab","polished_andesite_stairs","polished_diorite","polished_diorite_slab","polished_diorite_stairs","polished_granite","polished_granite_slab","polished_granite_stairs","poppy","potatoes","potted_acacia_sapling","potted_allium","potted_azure_bluet","potted_bamboo","potted_birch_sapling","potted_blue_orchid","potted_brown_mushroom","potted_cactus","potted_cornflower","potted_dandelion","potted_dark_oak_sapling","potted_dead_bush","potted_fern","potted_jungle_sapling","potted_lily_of_the_valley","potted_oak_sapling","potted_orange_tulip","potted_oxeye_daisy","potted_pink_tulip","potted_poppy","potted_red_mushroom","potted_red_tulip","potted_spruce_sapling","potted_white_tulip","potted_wither_rose","powered_rail","prismarine","prismarine_brick_slab","prismarine_brick_stairs","prismarine_bricks","prismarine_slab","prismarine_stairs","prismarine_wall","pumpkin","pumpkin_stem","purple_banner","purple_bed","purple_carpet","purple_concrete_powder","purple_concrete","purple_glazed_terracotta","purple_shulker_box","purple_stained_glass","purple_stained_glass_pane","purple_terracotta","purple_wall_banner","purple_wool","purpur_block","purpur_pillar","purpur_slab","purpur_stairs","quartz_block","quartz_pillar","quartz_slab","quartz_stairs","rail","red_banner","red_bed","red_carpet","red_concrete_powder","red_concrete","red_glazed_terracotta","red_mushroom_block","red_mushroom","red_nether_brick_slab","red_nether_brick_stairs","red_nether_brick_wall","red_nether_bricks","red_sand","red_sandstone","red_sandstone_slab","red_sandstone_stairs","red_sandstone_wall","red_shulker_box","red_stained_glass","red_stained_glass_pane","red_terracotta","red_tulip","red_wall_banner","red_wool","redstone_block","redstone_lamp","redstone_ore","redstone_torch","redstone_wall_torch","redstone_wire","repeater","repeating_command_block","rose_bush","sand","sandstone","sandstone_slab","sandstone_stairs","sandstone_wall","scaffolding","sea_lantern","sea_pickle","seagrass","shulker_box","skeleton_skull","skeleton_wall_skull","slime_block","smithing_table","smoker","smooth_quartz","smooth_quartz_slab","smooth_quartz_stairs","smooth_red_sandstone","smooth_red_sandstone_slab","smooth_red_sandstone_stairs","smooth_sandstone","smooth_sandstone_slab","smooth_sandstone_stairs","smooth_stone","smooth_stone_slab","snow_block","snow","soul_sand","spawner","sponge","spruce_button","spruce_door","spruce_fence_gate","spruce_fence","spruce_leaves","spruce_log","spruce_planks","spruce_pressure_plate","spruce_sapling","spruce_sign","spruce_slab","spruce_stairs","spruce_trapdoor","spruce_wall_sign","spruce_wood","sticky_piston","stone","stone_brick_slab","stone_brick_stairs","stone_brick_wall","stone_bricks","stone_button","stone_pressure_plate","stone_slab","stone_stairs","stonecutter","stripped_acacia_log","stripped_acacia_wood","stripped_birch_log","stripped_birch_wood","stripped_dark_oak_log","stripped_dark_oak_wood","stripped_jungle_log","stripped_jungle_wood","stripped_oak_log","stripped_oak_wood","stripped_spruce_log","stripped_spruce_wood","structure_block","structure_void","sugar_cane","sunflower","sweet_berry_bush","tnt","tall_grass","tall_seagrass","terracotta","torch","trapped_chest","tripwire_hook","tripwire","tube_coral","tube_coral_block","tube_coral_fan","tube_coral_wall_fan","turtle_egg","vine","wall_torch","water","wet_sponge","wheat","white_banner","white_bed","white_carpet","white_concrete_powder","white_concrete","white_glazed_terracotta","white_shulker_box","white_stained_glass","white_stained_glass_pane","white_terracotta","white_tulip","white_wall_banner","white_wool","wither_rose","wither_skeleton_skull","wither_skeleton_wall_skull","yellow_banner","yellow_bed","yellow_carpet","yellow_concrete_powder","yellow_concrete","yellow_glazed_terracotta","yellow_shulker_box","yellow_stained_glass","yellow_stained_glass_pane","yellow_terracotta","yellow_wall_banner","yellow_wool","zombie_head","zombie_wall_head"]}}}

Those are 11907 characters, so there's still quite a bit of space left until the command block character limit of 32500.


The second option: For each slot, check if there is a water bucket, but not an item that can be placed, then replace if that matches:

/execute as @a[scores={buckets=1}] if data entity @s Inventory[{Slot:0b,id:"minecraft:water_bucket"}] unless data entity @s Inventory[{Slot:0b,CanPlaceOn:["stone"]}] run replaceitem entity @s hotbar.0 water_bucket{CanPlaceOn:["stone","dirt"]}

This is a shortened version of the command again, you need to list all blocks and you need one of those long commands per slot, so the full commands… don't fit into an answer. So I put them into Pastebin: https://pastebin.com/ai1RAfNp

| improve this answer | |
  • For the first option, why not just use an item tag? – Matthew Wells Dec 31 '19 at 23:53
  • You mean block tags? Those don't work in CanPlaceOn, at least not last time I checked. Edit: Checked again, still doesn't work. – Fabian Röling Dec 31 '19 at 23:56
  • 1
    That's kinda odd, it seems like a natural point to implement. I hope we get it in 1.16. – Matthew Wells Jan 1 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.