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

Refer to this via any of the following:

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

Editing Values

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

    groovy
    mods.minecraft.player.setReplaceDefaultInventory(boolean)
  • Sets if items given when joining the world regardless of if the flag has already been set:

    groovy
    mods.minecraft.player.setTestStartingItems(boolean)
Example
groovy
mods.minecraft.player.setReplaceDefaultInventory(true)
mods.minecraft.player.setTestStartingItems(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

© 2024 CleanroomMC. All Rights Reserved.