Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shulker Box Inventory Manipulation
- Features:
- This trick will let you manipulate player's inventory however you like.
- For example change nbt of the item inside player's inventory or move item from one slot to another.
- Concept:
- This trick use the fact that shulker box keep their content when mined, with some loot table trickery you can make shulker box drop their content onto the ground when mined with a specific tool and then we use /loot replace command which will replace entity's inventory with whatever loot just dropped.
- Combining shulker box that drop their content and /loot command that will replace entity's inventory with whatever loot just dropped and because shulker box's nbt can be modify easily. You can manipulate player's inventory at will!
- --------------------------------------------S P A C I N G-----------------------------------------------
- How to:
- 1) Change loot table at /data/minecraft/loot_tables/blocks/shulker_box.json to this -> https://gofile.io/?c=LcMb34
- 2) Use /setblock command to set a shulker box somewhere (I recommend at y=256 of where the player is)
- 3) Use some /data modify commands to copy nbt from player's inventory to the shulker box. Or you can make the content of shulker box entirely different from player's inventory.
- *note: because shulker box can only contain 27 slots meanwhile player's inventory can contain much more than that (hotbar + backpack + armor + offhand) you have to split the inventory manipulation into 4 parts: hotbar (slots: 0-8), backpack(slots: 9-35), armor (slots: 100-103) and offhand (slot: -106)
- 4) Run /loot replace entity @s hotbar.0 9 mine ~ 256 ~ iron_pickaxe{ucit: {id: "inventory_modifier"}} (@s is a player)
- Breakdown:
- - /loot replace entity @s hotbar.0 9 mean we're going to replace player's inventory from slot 0 to slot 8 (hotbar slots). If you want to replace "backpack" then you'd use inventory.0 27.
- - mine ~ 256 ~ this is the location of the shulker box, as I said before I recommend you to use the current location of player at y = 256 but it can be anywhere really.
- - iron_pickaxe{ucit: {id: "inventory_modifier"}} this is a special item that when you mine a shulker box with it, the shulker box will drop the content instead of shulker box item containing the content.
- 5) Do some cleaning with the shulker box you just created (/setblock ~ 256 ~ air, etc.).
- A preview: https://streamable.com/z7iyr
- Originally by Boomber on the Minecraft Datapacks Discord Server
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement