Replace the item crafted with a tag [duplicate]
I made a map that will come out very soon but I have a problem: When the player crafted a crafting table, it cannot be placed!
And also when he/she crafted it, I would like to replace the crafted block with a crafting table with CanPlaceOn
.
I think this is used by other maps like The Useless Button.
Create a scoreboard once. It automaticly increments when a player crafts a crafting table:
/scoreboard objectives add craftedTable stat.craftItem.minecraft.crafting_table
Method 1:
Put the following command into repeating command block:
/give @a[score_craftedTable_min=1] minecraft:crafting_table 1 1 {CanPlaceOn:["minecraft:stone"]}
(Have a look at the 1 1!)
Put a chain command block after it:
/scoreboard players remove @a[score_craftedTable_min=1] craftedTable 1
Then another one with this command (to remove the old crafting tables):
/clear @a minecraft:crafting_table 0
The setup should be like that:
The problem is, that your item has no texture:
Everything else will work fine!
Method 2:
(Used in TheUselessButton)
The problems:
- No multiplayer support
- Only one item obtainable
- Bug: You can obtain the item 2 times: One with Can be played On tag and the original (Exists in TheUselessButton)
Put the following command into repeating command block:
/testfor @p[score_craftedTable_min=1]
Then two chain command blocks set on Conditional
1.
/clear @p minecraft:crafting_table
2.
/give @p minecraft:crafting_table
3.
/scoreboard players reset @a[score_craftedTable_min=1] craftedTable