Package net.minecraft.entity.player
Class PlayerInventory
java.lang.Object
net.minecraft.entity.player.PlayerInventory
- Mappings:
Namespace Name intermediary net/minecraft/class_1661official bylnamed net/minecraft/entity/player/PlayerInventory
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal DefaultedList<ItemStack>static final int[]private intprivate final List<DefaultedList<ItemStack>>static final int[]private static final intThe number of columns (9) in the inventory.static final intThe maximum cooldown (5 ticks) applied to timed use items such as the Eye of Ender.final DefaultedList<ItemStack>static final intThe number of slots (36) in the main (non-hotbar) section of the inventory.static final intThe slot index (-1) used to indicate no result (item not present / no available space) when querying the inventory's contents or to indicate no preference when inserting an item into the inventory.static final intZero-based index of the offhand slot.final DefaultedList<ItemStack>final PlayerEntityintFields inherited from interface net.minecraft.inventory.Inventory
field_42619, MAX_COUNT_PER_STACK -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPickBlock(ItemStack stack) private intprivate intbooleancanPlayerUse(PlayerEntity player) private booleancanStackAddMore(ItemStack existingStack, ItemStack stack) voidclear()voidclone(PlayerInventory other) booleanbooleanvoiddamageArmor(DamageSource damageSource, float amount, int[] slots) voiddropAll()dropSelectedItem(boolean entireStack) getArmorStack(int slot) floatgetBlockBreakingSpeed(BlockState block) intintstatic intgetName()Returns the name of this object.intintgetSlotWithStack(ItemStack stack) getStack(int slot) Fetches the stack currently stored at the given slot.intintGiven the item stack to search for, returns the equivalent slot index with a matching stack that is all of: not damaged, not enchanted, and not renamed.booleaninsertStack(int slot, ItemStack stack) booleaninsertStack(ItemStack stack) booleanisEmpty()static booleanisValidHotbarIndex(int slot) voidvoidvoidofferOrDrop(ItemStack stack) voidpopulateRecipeFinder(RecipeMatcher finder) voidintvoidremoveStack(int slot) Removes the stack currently stored at the indicated slot.removeStack(int slot, int amount) Removes a specific number of items from the given slot.voidscrollInHotbar(double scrollAmount) voidintsize()voidswapSlotWithHotbar(int slot) voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.inventory.Inventory
canTransferTo, containsAny, containsAny, count, getMaxCountPerStack, isValid, onClose, onOpenMethods inherited from interface net.minecraft.util.Nameable
getCustomName, getDisplayName, hasCustomName
-
Field Details
-
ITEM_USAGE_COOLDOWN
public static final int ITEM_USAGE_COOLDOWNThe maximum cooldown (5 ticks) applied to timed use items such as the Eye of Ender.- See Also:
- Mappings:
Namespace Name Mixin selector intermediary field_30637Lnet/minecraft/class_1661;field_30637:Iofficial cLbyl;c:Inamed ITEM_USAGE_COOLDOWNLnet/minecraft/entity/player/PlayerInventory;ITEM_USAGE_COOLDOWN:I
-
MAIN_SIZE
public static final int MAIN_SIZEThe number of slots (36) in the main (non-hotbar) section of the inventory.- See Also:
- Mappings:
Namespace Name Mixin selector intermediary field_30638Lnet/minecraft/class_1661;field_30638:Iofficial dLbyl;d:Inamed MAIN_SIZELnet/minecraft/entity/player/PlayerInventory;MAIN_SIZE:I
-
HOTBAR_SIZE
private static final int HOTBAR_SIZEThe number of columns (9) in the inventory.The same value dictates the size of the player's hotbar, excluding the offhand slot.
- See Also:
- Mappings:
Namespace Name Mixin selector intermediary field_30641Lnet/minecraft/class_1661;field_30641:Iofficial nLbyl;n:Inamed HOTBAR_SIZELnet/minecraft/entity/player/PlayerInventory;HOTBAR_SIZE:I
-
OFF_HAND_SLOT
public static final int OFF_HAND_SLOTZero-based index of the offhand slot.This value is the result of the sum
MAIN_SIZE (36) + ARMOR_SIZE (4).- See Also:
- Mappings:
Namespace Name Mixin selector intermediary field_30639Lnet/minecraft/class_1661;field_30639:Iofficial eLbyl;e:Inamed OFF_HAND_SLOTLnet/minecraft/entity/player/PlayerInventory;OFF_HAND_SLOT:I
-
NOT_FOUND
public static final int NOT_FOUNDThe slot index (-1) used to indicate no result (item not present / no available space) when querying the inventory's contents or to indicate no preference when inserting an item into the inventory.- See Also:
- Mappings:
Namespace Name Mixin selector intermediary field_30640Lnet/minecraft/class_1661;field_30640:Iofficial fLbyl;f:Inamed NOT_FOUNDLnet/minecraft/entity/player/PlayerInventory;NOT_FOUND:I
-
ARMOR_SLOTS
public static final int[] ARMOR_SLOTS- Mappings:
Namespace Name Mixin selector intermediary field_33767Lnet/minecraft/class_1661;field_33767:[Iofficial gLbyl;g:[Inamed ARMOR_SLOTSLnet/minecraft/entity/player/PlayerInventory;ARMOR_SLOTS:[I
-
HELMET_SLOTS
public static final int[] HELMET_SLOTS- Mappings:
Namespace Name Mixin selector intermediary field_33768Lnet/minecraft/class_1661;field_33768:[Iofficial hLbyl;h:[Inamed HELMET_SLOTSLnet/minecraft/entity/player/PlayerInventory;HELMET_SLOTS:[I
-
main
- Mappings:
Namespace Name Mixin selector intermediary field_7547Lnet/minecraft/class_1661;field_7547:Lnet/minecraft/class_2371;official iLbyl;i:Lhn;named mainLnet/minecraft/entity/player/PlayerInventory;main:Lnet/minecraft/util/collection/DefaultedList;
-
armor
- Mappings:
Namespace Name Mixin selector intermediary field_7548Lnet/minecraft/class_1661;field_7548:Lnet/minecraft/class_2371;official jLbyl;j:Lhn;named armorLnet/minecraft/entity/player/PlayerInventory;armor:Lnet/minecraft/util/collection/DefaultedList;
-
offHand
- Mappings:
Namespace Name Mixin selector intermediary field_7544Lnet/minecraft/class_1661;field_7544:Lnet/minecraft/class_2371;official kLbyl;k:Lhn;named offHandLnet/minecraft/entity/player/PlayerInventory;offHand:Lnet/minecraft/util/collection/DefaultedList;
-
combinedInventory
- Mappings:
Namespace Name Mixin selector intermediary field_7543Lnet/minecraft/class_1661;field_7543:Ljava/util/List;official oLbyl;o:Ljava/util/List;named combinedInventoryLnet/minecraft/entity/player/PlayerInventory;combinedInventory:Ljava/util/List;
-
selectedSlot
public int selectedSlot- Mappings:
Namespace Name Mixin selector intermediary field_7545Lnet/minecraft/class_1661;field_7545:Iofficial lLbyl;l:Inamed selectedSlotLnet/minecraft/entity/player/PlayerInventory;selectedSlot:I
-
player
- Mappings:
Namespace Name Mixin selector intermediary field_7546Lnet/minecraft/class_1661;field_7546:Lnet/minecraft/class_1657;official mLbyl;m:Lbym;named playerLnet/minecraft/entity/player/PlayerInventory;player:Lnet/minecraft/entity/player/PlayerEntity;
-
changeCount
private int changeCount- Mappings:
Namespace Name Mixin selector intermediary field_7542Lnet/minecraft/class_1661;field_7542:Iofficial pLbyl;p:Inamed changeCountLnet/minecraft/entity/player/PlayerInventory;changeCount:I
-
-
Constructor Details
-
PlayerInventory
- Mappings:
Namespace Name Mixin selector intermediary <init>Lnet/minecraft/class_1661;<init>(Lnet/minecraft/class_1657;)Vofficial <init>Lbyl;<init>(Lbym;)Vnamed <init>Lnet/minecraft/entity/player/PlayerInventory;<init>(Lnet/minecraft/entity/player/PlayerEntity;)V
-
-
Method Details
-
getMainHandStack
- Mappings:
Namespace Name Mixin selector intermediary method_7391Lnet/minecraft/class_1661;method_7391()Lnet/minecraft/class_1799;official fLbyl;f()Lcfx;named getMainHandStackLnet/minecraft/entity/player/PlayerInventory;getMainHandStack()Lnet/minecraft/item/ItemStack;
-
getHotbarSize
public static int getHotbarSize()- Mappings:
Namespace Name Mixin selector intermediary method_7368Lnet/minecraft/class_1661;method_7368()Iofficial gLbyl;g()Inamed getHotbarSizeLnet/minecraft/entity/player/PlayerInventory;getHotbarSize()I
-
canStackAddMore
- Mappings:
Namespace Name Mixin selector intermediary method_7393Lnet/minecraft/class_1661;method_7393(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Zofficial aLbyl;a(Lcfx;Lcfx;)Znamed canStackAddMoreLnet/minecraft/entity/player/PlayerInventory;canStackAddMore(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z
-
getEmptySlot
public int getEmptySlot()- Mappings:
Namespace Name Mixin selector intermediary method_7376Lnet/minecraft/class_1661;method_7376()Iofficial hLbyl;h()Inamed getEmptySlotLnet/minecraft/entity/player/PlayerInventory;getEmptySlot()I
-
addPickBlock
- Mappings:
Namespace Name Mixin selector intermediary method_7374Lnet/minecraft/class_1661;method_7374(Lnet/minecraft/class_1799;)Vofficial aLbyl;a(Lcfx;)Vnamed addPickBlockLnet/minecraft/entity/player/PlayerInventory;addPickBlock(Lnet/minecraft/item/ItemStack;)V
-
swapSlotWithHotbar
public void swapSlotWithHotbar(int slot) - Mappings:
Namespace Name Mixin selector intermediary method_7365Lnet/minecraft/class_1661;method_7365(I)Vofficial cLbyl;c(I)Vnamed swapSlotWithHotbarLnet/minecraft/entity/player/PlayerInventory;swapSlotWithHotbar(I)V
-
isValidHotbarIndex
public static boolean isValidHotbarIndex(int slot) - Mappings:
Namespace Name Mixin selector intermediary method_7380Lnet/minecraft/class_1661;method_7380(I)Zofficial dLbyl;d(I)Znamed isValidHotbarIndexLnet/minecraft/entity/player/PlayerInventory;isValidHotbarIndex(I)Z
-
getSlotWithStack
- Mappings:
Namespace Name Mixin selector intermediary method_7395Lnet/minecraft/class_1661;method_7395(Lnet/minecraft/class_1799;)Iofficial bLbyl;b(Lcfx;)Inamed getSlotWithStackLnet/minecraft/entity/player/PlayerInventory;getSlotWithStack(Lnet/minecraft/item/ItemStack;)I
-
indexOf
Given the item stack to search for, returns the equivalent slot index with a matching stack that is all of: not damaged, not enchanted, and not renamed.- Returns:
- the index where a matching stack was found, or -1
- Mappings:
Namespace Name Mixin selector intermediary method_7371Lnet/minecraft/class_1661;method_7371(Lnet/minecraft/class_1799;)Iofficial cLbyl;c(Lcfx;)Inamed indexOfLnet/minecraft/entity/player/PlayerInventory;indexOf(Lnet/minecraft/item/ItemStack;)I
-
getSwappableHotbarSlot
public int getSwappableHotbarSlot()- Mappings:
Namespace Name Mixin selector intermediary method_7386Lnet/minecraft/class_1661;method_7386()Iofficial iLbyl;i()Inamed getSwappableHotbarSlotLnet/minecraft/entity/player/PlayerInventory;getSwappableHotbarSlot()I
-
scrollInHotbar
public void scrollInHotbar(double scrollAmount) - Mappings:
Namespace Name Mixin selector intermediary method_7373Lnet/minecraft/class_1661;method_7373(D)Vofficial aLbyl;a(D)Vnamed scrollInHotbarLnet/minecraft/entity/player/PlayerInventory;scrollInHotbar(D)V
-
remove
- Mappings:
Namespace Name Mixin selector intermediary method_29280Lnet/minecraft/class_1661;method_29280(Ljava/util/function/Predicate;ILnet/minecraft/class_1263;)Iofficial aLbyl;a(Ljava/util/function/Predicate;ILbdp;)Inamed removeLnet/minecraft/entity/player/PlayerInventory;remove(Ljava/util/function/Predicate;ILnet/minecraft/inventory/Inventory;)I
-
addStack
- Mappings:
Namespace Name Mixin selector intermediary method_7366Lnet/minecraft/class_1661;method_7366(Lnet/minecraft/class_1799;)Iofficial iLbyl;i(Lcfx;)Inamed addStackLnet/minecraft/entity/player/PlayerInventory;addStack(Lnet/minecraft/item/ItemStack;)I
-
addStack
- Mappings:
Namespace Name Mixin selector intermediary method_7385Lnet/minecraft/class_1661;method_7385(ILnet/minecraft/class_1799;)Iofficial dLbyl;d(ILcfx;)Inamed addStackLnet/minecraft/entity/player/PlayerInventory;addStack(ILnet/minecraft/item/ItemStack;)I
-
getOccupiedSlotWithRoomForStack
- Mappings:
Namespace Name Mixin selector intermediary method_7390Lnet/minecraft/class_1661;method_7390(Lnet/minecraft/class_1799;)Iofficial dLbyl;d(Lcfx;)Inamed getOccupiedSlotWithRoomForStackLnet/minecraft/entity/player/PlayerInventory;getOccupiedSlotWithRoomForStack(Lnet/minecraft/item/ItemStack;)I
-
updateItems
public void updateItems()- Mappings:
Namespace Name Mixin selector intermediary method_7381Lnet/minecraft/class_1661;method_7381()Vofficial jLbyl;j()Vnamed updateItemsLnet/minecraft/entity/player/PlayerInventory;updateItems()V
-
insertStack
- Mappings:
Namespace Name Mixin selector intermediary method_7394Lnet/minecraft/class_1661;method_7394(Lnet/minecraft/class_1799;)Zofficial eLbyl;e(Lcfx;)Znamed insertStackLnet/minecraft/entity/player/PlayerInventory;insertStack(Lnet/minecraft/item/ItemStack;)Z
-
insertStack
- Mappings:
Namespace Name Mixin selector intermediary method_7367Lnet/minecraft/class_1661;method_7367(ILnet/minecraft/class_1799;)Zofficial cLbyl;c(ILcfx;)Znamed insertStackLnet/minecraft/entity/player/PlayerInventory;insertStack(ILnet/minecraft/item/ItemStack;)Z
-
offerOrDrop
- Mappings:
Namespace Name Mixin selector intermediary method_7398Lnet/minecraft/class_1661;method_7398(Lnet/minecraft/class_1799;)Vofficial fLbyl;f(Lcfx;)Vnamed offerOrDropLnet/minecraft/entity/player/PlayerInventory;offerOrDrop(Lnet/minecraft/item/ItemStack;)V
-
offer
- Mappings:
Namespace Name Mixin selector intermediary method_32338Lnet/minecraft/class_1661;method_32338(Lnet/minecraft/class_1799;Z)Vofficial aLbyl;a(Lcfx;Z)Vnamed offerLnet/minecraft/entity/player/PlayerInventory;offer(Lnet/minecraft/item/ItemStack;Z)V
-
removeStack
Removes a specific number of items from the given slot.- Specified by:
removeStackin interfaceInventory- Returns:
- the removed items as a stack
- Mappings:
Namespace Name Mixin selector intermediary method_5434Lnet/minecraft/class_1263;method_5434(II)Lnet/minecraft/class_1799;official aLbdp;a(II)Lcfx;named removeStackLnet/minecraft/inventory/Inventory;removeStack(II)Lnet/minecraft/item/ItemStack;
-
removeOne
- Mappings:
Namespace Name Mixin selector intermediary method_7378Lnet/minecraft/class_1661;method_7378(Lnet/minecraft/class_1799;)Vofficial gLbyl;g(Lcfx;)Vnamed removeOneLnet/minecraft/entity/player/PlayerInventory;removeOne(Lnet/minecraft/item/ItemStack;)V
-
removeStack
Removes the stack currently stored at the indicated slot.- Specified by:
removeStackin interfaceInventory- Returns:
- the stack previously stored at the indicated slot.
- Mappings:
Namespace Name Mixin selector intermediary method_5441Lnet/minecraft/class_1263;method_5441(I)Lnet/minecraft/class_1799;official bLbdp;b(I)Lcfx;named removeStackLnet/minecraft/inventory/Inventory;removeStack(I)Lnet/minecraft/item/ItemStack;
-
setStack
-
getBlockBreakingSpeed
- Mappings:
Namespace Name Mixin selector intermediary method_7370Lnet/minecraft/class_1661;method_7370(Lnet/minecraft/class_2680;)Fofficial aLbyl;a(Ldby;)Fnamed getBlockBreakingSpeedLnet/minecraft/entity/player/PlayerInventory;getBlockBreakingSpeed(Lnet/minecraft/block/BlockState;)F
-
writeNbt
- Mappings:
Namespace Name Mixin selector intermediary method_7384Lnet/minecraft/class_1661;method_7384(Lnet/minecraft/class_2499;)Lnet/minecraft/class_2499;official aLbyl;a(Lqx;)Lqx;named writeNbtLnet/minecraft/entity/player/PlayerInventory;writeNbt(Lnet/minecraft/nbt/NbtList;)Lnet/minecraft/nbt/NbtList;
-
readNbt
- Mappings:
Namespace Name Mixin selector intermediary method_7397Lnet/minecraft/class_1661;method_7397(Lnet/minecraft/class_2499;)Vofficial bLbyl;b(Lqx;)Vnamed readNbtLnet/minecraft/entity/player/PlayerInventory;readNbt(Lnet/minecraft/nbt/NbtList;)V
-
size
public int size() -
isEmpty
public boolean isEmpty() -
getStack
Fetches the stack currently stored at the given slot. If the slot is empty, or is outside the bounds of this inventory, returns seeItemStack.EMPTY. -
getName
Returns the name of this object.This should return the custom name if it exists, otherwise the default name. This should not have styling applied.
- Specified by:
getNamein interfaceNameable- Returns:
- the name of this object
- Mappings:
Namespace Name Mixin selector intermediary method_5477Lnet/minecraft/class_1275;method_5477()Lnet/minecraft/class_2561;official YLbea;Y()Lsw;named getNameLnet/minecraft/util/Nameable;getName()Lnet/minecraft/text/Text;
-
getArmorStack
- Mappings:
Namespace Name Mixin selector intermediary method_7372Lnet/minecraft/class_1661;method_7372(I)Lnet/minecraft/class_1799;official eLbyl;e(I)Lcfx;named getArmorStackLnet/minecraft/entity/player/PlayerInventory;getArmorStack(I)Lnet/minecraft/item/ItemStack;
-
damageArmor
- Mappings:
Namespace Name Mixin selector intermediary method_7375Lnet/minecraft/class_1661;method_7375(Lnet/minecraft/class_1282;F[I)Vofficial aLbyl;a(Lbem;F[I)Vnamed damageArmorLnet/minecraft/entity/player/PlayerInventory;damageArmor(Lnet/minecraft/entity/damage/DamageSource;F[I)V
-
dropAll
public void dropAll()- Mappings:
Namespace Name Mixin selector intermediary method_7388Lnet/minecraft/class_1661;method_7388()Vofficial kLbyl;k()Vnamed dropAllLnet/minecraft/entity/player/PlayerInventory;dropAll()V
-
markDirty
public void markDirty() -
getChangeCount
public int getChangeCount()- Mappings:
Namespace Name Mixin selector intermediary method_7364Lnet/minecraft/class_1661;method_7364()Iofficial lLbyl;l()Inamed getChangeCountLnet/minecraft/entity/player/PlayerInventory;getChangeCount()I
-
canPlayerUse
- Specified by:
canPlayerUsein interfaceInventory- Mappings:
Namespace Name Mixin selector intermediary method_5443Lnet/minecraft/class_1263;method_5443(Lnet/minecraft/class_1657;)Zofficial aLbdp;a(Lbym;)Znamed canPlayerUseLnet/minecraft/inventory/Inventory;canPlayerUse(Lnet/minecraft/entity/player/PlayerEntity;)Z
-
contains
- Mappings:
Namespace Name Mixin selector intermediary method_7379Lnet/minecraft/class_1661;method_7379(Lnet/minecraft/class_1799;)Zofficial hLbyl;h(Lcfx;)Znamed containsLnet/minecraft/entity/player/PlayerInventory;contains(Lnet/minecraft/item/ItemStack;)Z
-
contains
- Mappings:
Namespace Name Mixin selector intermediary method_7382Lnet/minecraft/class_1661;method_7382(Lnet/minecraft/class_6862;)Zofficial aLbyl;a(Lanl;)Znamed containsLnet/minecraft/entity/player/PlayerInventory;contains(Lnet/minecraft/registry/tag/TagKey;)Z
-
clone
- Mappings:
Namespace Name Mixin selector intermediary method_7377Lnet/minecraft/class_1661;method_7377(Lnet/minecraft/class_1661;)Vofficial aLbyl;a(Lbyl;)Vnamed cloneLnet/minecraft/entity/player/PlayerInventory;clone(Lnet/minecraft/entity/player/PlayerInventory;)V
-
clear
public void clear() -
populateRecipeFinder
- Mappings:
Namespace Name Mixin selector intermediary method_7387Lnet/minecraft/class_1661;method_7387(Lnet/minecraft/class_1662;)Vofficial aLbyl;a(Lbyq;)Vnamed populateRecipeFinderLnet/minecraft/entity/player/PlayerInventory;populateRecipeFinder(Lnet/minecraft/recipe/RecipeMatcher;)V
-
dropSelectedItem
- Mappings:
Namespace Name Mixin selector intermediary method_37417Lnet/minecraft/class_1661;method_37417(Z)Lnet/minecraft/class_1799;official aLbyl;a(Z)Lcfx;named dropSelectedItemLnet/minecraft/entity/player/PlayerInventory;dropSelectedItem(Z)Lnet/minecraft/item/ItemStack;
-