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:
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:
groovymods.minecraft.player.setReplaceDefaultInventory(boolean)
Sets if items given when joining the world regardless of if the flag has already been set:
groovymods.minecraft.player.setTestStartingItems(boolean)
Example
mods.minecraft.player.setReplaceDefaultInventory(true)
mods.minecraft.player.setTestStartingItems(true)
Adding Entries
Adds the given itemstack to the inventory list:
groovyplayer.addStartingItem(ItemStack)
Adds the given itemstack to a specific slot in the inventory list in the format
itemstack
,slot
:groovyplayer.addStartingItem(ItemStack, int)
Removes all previously added inputs and sets the starting inventory in the format
isSlotSpecific
,items
:groovyplayer.setStartingItems(boolean, ItemStack...)
Removes all previously added inputs and sets the starting inventory in the format
isSlotSpecific
,items
:groovyplayer.setStartingItems(boolean, List<ItemStack>)
Example
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']]))