Class ExpandInventory
java.lang.Object
com.blamejared.crafttweaker.natives.entity.type.player.ExpandInventory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanadd(net.minecraft.world.entity.player.Inventory internal, int index, net.minecraft.world.item.ItemStack stack) Adds the given item to the inventory at the given index.static booleanadd(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Adds the given item to the inventory.static booleancontains(net.minecraft.world.entity.player.Inventory internal, KnownTag<net.minecraft.world.item.Item> tag) Checks if the inventory contains the given item tag.static booleancontains(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Checks if the inventory contains the given item.static voiddropAll(net.minecraft.world.entity.player.Inventory internal) Drops all items from the inventory.static intfindSlotMatchingItem(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Finds the first slot in the inventory that matches the given item.static intfindSlotMatchingUnusedItem(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Finds the first slot in the inventory that matches the given stack, without being damaged, enchanted, or having a custom name.static net.minecraft.world.item.ItemStackgetArmor(net.minecraft.world.entity.player.Inventory internal, int armorIndex) Gets the armor from the given index.static intgetFreeSlot(net.minecraft.world.entity.player.Inventory internal) Gets the first free slot in the inventory.static net.minecraft.world.item.ItemStackgetSelected(net.minecraft.world.entity.player.Inventory internal) Gets the selected item in the inventory, this is usually the selected slot in the hotbar.static intgetSlotWithRemainingSpace(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Finds the first slot in the inventory that has remaining space for the given item.static intgetSuitableHotbarSlot(net.minecraft.world.entity.player.Inventory internal) Finds the first suitable hotbar slot for the given item.static intgetTimesChanged(net.minecraft.world.entity.player.Inventory internal) Gets the number of times the inventory has changed.static voidpickSlot(net.minecraft.world.entity.player.Inventory internal, int index) Moves the item at the given index to the first available hotbar slot.static voidremoveItem(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Removes the given item from the inventory.static voidsetPickedItem(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Sets the selected item in the hotbar to the first matching stack in the inventory.
-
Constructor Details
-
ExpandInventory
public ExpandInventory()
-
-
Method Details
-
getSelected
public static net.minecraft.world.item.ItemStack getSelected(net.minecraft.world.entity.player.Inventory internal) Gets the selected item in the inventory, this is usually the selected slot in the hotbar.- Returns:
- The selected item in the inventory.
-
getFreeSlot
public static int getFreeSlot(net.minecraft.world.entity.player.Inventory internal) Gets the first free slot in the inventory.- Returns:
- The first free slot in the inventory.
-
setPickedItem
public static void setPickedItem(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Sets the selected item in the hotbar to the first matching stack in the inventory.- Parameters:
stack- The item to set as the selected item.
-
pickSlot
public static void pickSlot(net.minecraft.world.entity.player.Inventory internal, int index) Moves the item at the given index to the first available hotbar slot.- Parameters:
index- The index of the slot to pick.
-
findSlotMatchingItem
public static int findSlotMatchingItem(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Finds the first slot in the inventory that matches the given item.- Parameters:
stack- The item to find.- Returns:
- The index of the first slot that matches the given item.
-
findSlotMatchingUnusedItem
public static int findSlotMatchingUnusedItem(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Finds the first slot in the inventory that matches the given stack, without being damaged, enchanted, or having a custom name.- Parameters:
stack- The item to find.- Returns:
- The index of the first slot that matches the given stack.
-
getSuitableHotbarSlot
public static int getSuitableHotbarSlot(net.minecraft.world.entity.player.Inventory internal) Finds the first suitable hotbar slot for the given item.- Returns:
- The index of the first suitable hotbar slot.
-
getSlotWithRemainingSpace
public static int getSlotWithRemainingSpace(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Finds the first slot in the inventory that has remaining space for the given item.- Parameters:
stack- The item to find.- Returns:
- The index of the first slot that has remaining space for the given item.
-
add
public static boolean add(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Adds the given item to the inventory.- Parameters:
stack- The item to add.- Returns:
- Whether the item was added successfully.
-
add
public static boolean add(net.minecraft.world.entity.player.Inventory internal, int index, net.minecraft.world.item.ItemStack stack) Adds the given item to the inventory at the given index.- Parameters:
index- The index to add the item to.stack- The item to add.- Returns:
- Whether the item was added successfully.
-
removeItem
public static void removeItem(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Removes the given item from the inventory.- Parameters:
stack- The item to remove.
-
getArmor
public static net.minecraft.world.item.ItemStack getArmor(net.minecraft.world.entity.player.Inventory internal, int armorIndex) Gets the armor from the given index.- Parameters:
armorIndex- The index of the armor to get.- Returns:
- The armor from the given index.
-
dropAll
public static void dropAll(net.minecraft.world.entity.player.Inventory internal) Drops all items from the inventory. -
getTimesChanged
public static int getTimesChanged(net.minecraft.world.entity.player.Inventory internal) Gets the number of times the inventory has changed.- Returns:
- The number of times the inventory has changed.
-
contains
public static boolean contains(net.minecraft.world.entity.player.Inventory internal, net.minecraft.world.item.ItemStack stack) Checks if the inventory contains the given item.- Parameters:
stack- The item to check.- Returns:
- Whether the inventory contains the given item.
-
contains
public static boolean contains(net.minecraft.world.entity.player.Inventory internal, KnownTag<net.minecraft.world.item.Item> tag) Checks if the inventory contains the given item tag.- Parameters:
tag- The item tag to check.- Returns:
- Whether the inventory contains the given item tag.
-