Skip to content

Starting Inventory (Minecraft)

Description

Sets the starting inventory of the player, including armor slots and offhand.

Warning

No more than a total of 41 items can be inserted into the inventory.

Identifier

Refer to this via any of the following:

groovy
player/* Used as page default */
Player

Editing Values

  • Sets if items given when joining the world regardless of if the flag has already been set:

    groovy
    player.testingStartingItems
  • Sets if the player inventory is cleared prior to giving the player these items:

    groovy
    player.replaceDefaultInventory
Example
groovy
player.testingStartingItems = true
player.replaceDefaultInventory = true

Adding Entries

  • Adds the given itemstack to the inventory list:

    groovy
    player.addStartingItem(ItemStack)
  • Adds the given itemstack to a specific slot in the inventory list in the format itemstack, slot:

    groovy
    player.addStartingItem(ItemStack, int)
  • Removes all previously added inputs and sets the starting inventory in the format isSlotSpecific, items:

    groovy
    player.setStartingItems(boolean, ItemStack...)
  • Removes all previously added inputs and sets the starting inventory in the format isSlotSpecific, items:

    groovy
    player.setStartingItems(boolean, List<ItemStack>)
Example
groovy
player.addStartingItem(item('minecraft:clay_ball'))
player.addStartingItem(item('minecraft:gold_ingot'))
player.addStartingItem(item('minecraft:diamond'))
player.addStartingItem(item('minecraft:nether_star'))
player.addStartingItem(item('minecraft:water_bucket'))
player.setStartingItems(true, item('minecraft:clay').withNbt([display:[Name:'Hotbar']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Top row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Middle row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Bottom row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:diamond_boots'), item('minecraft:diamond_leggings'), item('minecraft:diamond_chestplate'), item('minecraft:diamond_helmet'), item('minecraft:clay').withNbt([display:[Name:'Offhand']]))

Contributors

Changelog

© 2024 CleanroomMC. All Rights Reserved.