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.

Tip

When testing the Starting Inventory items, use setTestStartingItems(true) to allow testing every time a player logs in instead of just the first.

Identifier

The identifier minecraft.player will be used as the default on this page.

All Identifiers

Any of these can be used to refer to this compat:

groovy
mc.player
mc.Player
MC.player
MC.Player
vanilla.player
vanilla.Player
Vanilla.player
Vanilla.Player
minecraft.player/* Used as page default */
minecraft.Player
Minecraft.player
Minecraft.Player
mods.mc.player
mods.mc.Player
mods.MC.player
mods.MC.Player
mods.vanilla.player
mods.vanilla.Player
mods.Vanilla.player
mods.Vanilla.Player
mods.minecraft.player
mods.minecraft.Player
mods.Minecraft.player
mods.Minecraft.Player

Editing Values

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

    groovy
    minecraft.player.setTestStartingItems(boolean)
  • Sets if the player inventory is cleared prior to giving the player these items:

    groovy
    minecraft.player.setReplaceDefaultInventory(boolean)
Example
groovy
minecraft.player.setTestStartingItems(true)
minecraft.player.setReplaceDefaultInventory(true)

Adding Entries

  • Adds the given itemstack to the inventory list:

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

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

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

    groovy
    minecraft.player.setStartingItems(boolean, List<ItemStack>)
Example
groovy
minecraft.player.addStartingItem(item('minecraft:clay_ball'))
minecraft.player.addStartingItem(item('minecraft:gold_ingot'))
minecraft.player.addStartingItem(item('minecraft:diamond'))
minecraft.player.addStartingItem(item('minecraft:nether_star'))
minecraft.player.addStartingItem(item('minecraft:water_bucket'))
minecraft.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

© 2024 CleanroomMC. All Rights Reserved.