类 PlayerInventory
- java.lang.Object
-
- net.minecraft.entity.player.PlayerInventory
-
-
字段概要
字段 修饰符和类型 字段 说明 DefaultedList<ItemStack>armorprivate intchangeCountprivate List<DefaultedList<ItemStack>>combinedInventoryprivate static intHOTBAR_SIZEThe number of columns (9) in the inventory.static intITEM_USAGE_COOLDOWNThe maximum cooldown (5 ticks) applied to timed use items such as the Eye of Ender.DefaultedList<ItemStack>mainstatic intMAIN_SIZEThe number of slots (36) in the main (non-hotbar) section of the inventory.static intNOT_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.static intOFF_HAND_SLOTZero-based index of the offhand slot.DefaultedList<ItemStack>offHandPlayerEntityplayerintselectedSlot-
从接口继承的字段 net.minecraft.inventory.Inventory
MAX_COUNT_PER_STACK
-
-
构造器概要
构造器 构造器 说明 PlayerInventory(PlayerEntity player)
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddPickBlock(ItemStack stack)private intaddStack(int slot, ItemStack stack)private intaddStack(ItemStack stack)booleancanPlayerUse(PlayerEntity player)private booleancanStackAddMore(ItemStack existingStack, ItemStack stack)voidclear()voidclone(PlayerInventory other)booleancontains(ItemStack stack)booleancontains(Tag<Item> tag)voiddamageArmor(DamageSource damageSource, float amount)voiddropAll()ItemStackgetArmorStack(int slot)floatgetBlockBreakingSpeed(BlockState block)intgetChangeCount()intgetEmptySlot()static intgetHotbarSize()ItemStackgetMainHandStack()TextgetName()intgetOccupiedSlotWithRoomForStack(ItemStack stack)intgetSlotWithStack(ItemStack stack)ItemStackgetStack(int slot)Fetches the stack currently stored at the given slot.intgetSwappableHotbarSlot()intindexOf(ItemStack stack)booleaninsertStack(int slot, ItemStack stack)booleaninsertStack(ItemStack stack)booleanisEmpty()static booleanisValidHotbarIndex(int slot)voidmarkDirty()voidoffer(ItemStack stack, boolean notifiesClient)voidofferOrDrop(ItemStack stack)voidpopulateRecipeFinder(RecipeFinder finder)voidreadNbt(ListTag nbtList)intremove(Predicate<ItemStack> shouldRemove, int maxCount, Inventory craftingInventory)voidremoveOne(ItemStack stack)ItemStackremoveStack(int slot)Removes the stack currently stored at the indicated slot.ItemStackremoveStack(int slot, int amount)Removes a specific number of items from the given slot.voidscrollInHotbar(double scrollAmount)voidsetStack(int slot, ItemStack stack)intsize()voidswapSlotWithHotbar(int slot)voidupdateItems()ListTagwriteNbt(ListTag nbtList)-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 net.minecraft.inventory.Inventory
containsAny, count, getMaxCountPerStack, isValid, onClose, onOpen
-
从接口继承的方法 net.minecraft.util.Nameable
getCustomName, getDisplayName, hasCustomName
-
-
-
-
字段详细资料
-
ITEM_USAGE_COOLDOWN
public static final int ITEM_USAGE_COOLDOWN
The maximum cooldown (5 ticks) applied to timed use items such as the Eye of Ender.- 另请参阅:
- 常量字段值
- Mappings:
Namespace Name Mixin selector official bLbje;b:Iintermediary field_30637Lnet/minecraft/class_1661;field_30637:Inamed ITEM_USAGE_COOLDOWNLnet/minecraft/entity/player/PlayerInventory;ITEM_USAGE_COOLDOWN:I
-
MAIN_SIZE
public static final int MAIN_SIZE
The number of slots (36) in the main (non-hotbar) section of the inventory.- 另请参阅:
- 常量字段值
- Mappings:
Namespace Name Mixin selector official cLbje;c:Iintermediary field_30638Lnet/minecraft/class_1661;field_30638:Inamed MAIN_SIZELnet/minecraft/entity/player/PlayerInventory;MAIN_SIZE:I
-
HOTBAR_SIZE
private static final int HOTBAR_SIZE
The number of columns (9) in the inventory.The same value dictates the size of the player's hotbar, excluding the offhand slot.
- 另请参阅:
- 常量字段值
- Mappings:
Namespace Name Mixin selector official kLbje;k:Iintermediary field_30641Lnet/minecraft/class_1661;field_30641:Inamed HOTBAR_SIZELnet/minecraft/entity/player/PlayerInventory;HOTBAR_SIZE:I
-
OFF_HAND_SLOT
public static final int OFF_HAND_SLOT
Zero-based index of the offhand slot.This value is the result of the sum
MAIN_SIZE (36) + ARMOR_SIZE (4).- 另请参阅:
- 常量字段值
- Mappings:
Namespace Name Mixin selector official dLbje;d:Iintermediary field_30639Lnet/minecraft/class_1661;field_30639:Inamed OFF_HAND_SLOTLnet/minecraft/entity/player/PlayerInventory;OFF_HAND_SLOT:I
-
NOT_FOUND
public static final int NOT_FOUND
The 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.- 另请参阅:
- 常量字段值
- Mappings:
Namespace Name Mixin selector official eLbje;e:Iintermediary field_30640Lnet/minecraft/class_1661;field_30640:Inamed NOT_FOUNDLnet/minecraft/entity/player/PlayerInventory;NOT_FOUND:I
-
main
public final DefaultedList<ItemStack> main
- Mappings:
Namespace Name Mixin selector official fLbje;f:Lgn;intermediary field_7547Lnet/minecraft/class_1661;field_7547:Lnet/minecraft/class_2371;named mainLnet/minecraft/entity/player/PlayerInventory;main:Lnet/minecraft/util/collection/DefaultedList;
-
armor
public final DefaultedList<ItemStack> armor
- Mappings:
Namespace Name Mixin selector official gLbje;g:Lgn;intermediary field_7548Lnet/minecraft/class_1661;field_7548:Lnet/minecraft/class_2371;named armorLnet/minecraft/entity/player/PlayerInventory;armor:Lnet/minecraft/util/collection/DefaultedList;
-
offHand
public final DefaultedList<ItemStack> offHand
- Mappings:
Namespace Name Mixin selector official hLbje;h:Lgn;intermediary field_7544Lnet/minecraft/class_1661;field_7544:Lnet/minecraft/class_2371;named offHandLnet/minecraft/entity/player/PlayerInventory;offHand:Lnet/minecraft/util/collection/DefaultedList;
-
combinedInventory
private final List<DefaultedList<ItemStack>> combinedInventory
- Mappings:
Namespace Name Mixin selector official lLbje;l:Ljava/util/List;intermediary field_7543Lnet/minecraft/class_1661;field_7543:Ljava/util/List;named combinedInventoryLnet/minecraft/entity/player/PlayerInventory;combinedInventory:Ljava/util/List;
-
selectedSlot
public int selectedSlot
- Mappings:
Namespace Name Mixin selector official iLbje;i:Iintermediary field_7545Lnet/minecraft/class_1661;field_7545:Inamed selectedSlotLnet/minecraft/entity/player/PlayerInventory;selectedSlot:I
-
player
public final PlayerEntity player
- Mappings:
Namespace Name Mixin selector official jLbje;j:Lbjf;intermediary field_7546Lnet/minecraft/class_1661;field_7546:Lnet/minecraft/class_1657;named playerLnet/minecraft/entity/player/PlayerInventory;player:Lnet/minecraft/entity/player/PlayerEntity;
-
changeCount
private int changeCount
- Mappings:
Namespace Name Mixin selector official mLbje;m:Iintermediary field_7542Lnet/minecraft/class_1661;field_7542:Inamed changeCountLnet/minecraft/entity/player/PlayerInventory;changeCount:I
-
-
构造器详细资料
-
PlayerInventory
public PlayerInventory(PlayerEntity player)
- Mappings:
Namespace Name Mixin selector official <init>Lbje;<init>(Lbjf;)Vintermediary <init>Lnet/minecraft/class_1661;<init>(Lnet/minecraft/class_1657;)Vnamed <init>Lnet/minecraft/entity/player/PlayerInventory;<init>(Lnet/minecraft/entity/player/PlayerEntity;)V
-
-
方法详细资料
-
getMainHandStack
public ItemStack getMainHandStack()
- Mappings:
Namespace Name Mixin selector official fLbje;f()Lbpr;intermediary method_7391Lnet/minecraft/class_1661;method_7391()Lnet/minecraft/class_1799;named getMainHandStackLnet/minecraft/entity/player/PlayerInventory;getMainHandStack()Lnet/minecraft/item/ItemStack;
-
getHotbarSize
public static int getHotbarSize()
- Mappings:
Namespace Name Mixin selector official gLbje;g()Iintermediary method_7368Lnet/minecraft/class_1661;method_7368()Inamed getHotbarSizeLnet/minecraft/entity/player/PlayerInventory;getHotbarSize()I
-
canStackAddMore
private boolean canStackAddMore(ItemStack existingStack, ItemStack stack)
- Mappings:
Namespace Name Mixin selector official aLbje;a(Lbpr;Lbpr;)Zintermediary method_7393Lnet/minecraft/class_1661;method_7393(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)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 official hLbje;h()Iintermediary method_7376Lnet/minecraft/class_1661;method_7376()Inamed getEmptySlotLnet/minecraft/entity/player/PlayerInventory;getEmptySlot()I
-
addPickBlock
public void addPickBlock(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official aLbje;a(Lbpr;)Vintermediary method_7374Lnet/minecraft/class_1661;method_7374(Lnet/minecraft/class_1799;)Vnamed addPickBlockLnet/minecraft/entity/player/PlayerInventory;addPickBlock(Lnet/minecraft/item/ItemStack;)V
-
swapSlotWithHotbar
public void swapSlotWithHotbar(int slot)
- Mappings:
Namespace Name Mixin selector official cLbje;c(I)Vintermediary method_7365Lnet/minecraft/class_1661;method_7365(I)Vnamed swapSlotWithHotbarLnet/minecraft/entity/player/PlayerInventory;swapSlotWithHotbar(I)V
-
isValidHotbarIndex
public static boolean isValidHotbarIndex(int slot)
- Mappings:
Namespace Name Mixin selector official dLbje;d(I)Zintermediary method_7380Lnet/minecraft/class_1661;method_7380(I)Znamed isValidHotbarIndexLnet/minecraft/entity/player/PlayerInventory;isValidHotbarIndex(I)Z
-
getSlotWithStack
public int getSlotWithStack(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official bLbje;b(Lbpr;)Iintermediary method_7395Lnet/minecraft/class_1661;method_7395(Lnet/minecraft/class_1799;)Inamed getSlotWithStackLnet/minecraft/entity/player/PlayerInventory;getSlotWithStack(Lnet/minecraft/item/ItemStack;)I
-
indexOf
public int indexOf(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official cLbje;c(Lbpr;)Iintermediary method_7371Lnet/minecraft/class_1661;method_7371(Lnet/minecraft/class_1799;)Inamed indexOfLnet/minecraft/entity/player/PlayerInventory;indexOf(Lnet/minecraft/item/ItemStack;)I
-
getSwappableHotbarSlot
public int getSwappableHotbarSlot()
- Mappings:
Namespace Name Mixin selector official iLbje;i()Iintermediary method_7386Lnet/minecraft/class_1661;method_7386()Inamed getSwappableHotbarSlotLnet/minecraft/entity/player/PlayerInventory;getSwappableHotbarSlot()I
-
scrollInHotbar
public void scrollInHotbar(double scrollAmount)
- Mappings:
Namespace Name Mixin selector official aLbje;a(D)Vintermediary method_7373Lnet/minecraft/class_1661;method_7373(D)Vnamed scrollInHotbarLnet/minecraft/entity/player/PlayerInventory;scrollInHotbar(D)V
-
remove
public int remove(Predicate<ItemStack> shouldRemove, int maxCount, Inventory craftingInventory)
- Mappings:
Namespace Name Mixin selector official aLbje;a(Ljava/util/function/Predicate;ILaqz;)Iintermediary method_29280Lnet/minecraft/class_1661;method_29280(Ljava/util/function/Predicate;ILnet/minecraft/class_1263;)Inamed removeLnet/minecraft/entity/player/PlayerInventory;remove(Ljava/util/function/Predicate;ILnet/minecraft/inventory/Inventory;)I
-
addStack
private int addStack(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official iLbje;i(Lbpr;)Iintermediary method_7366Lnet/minecraft/class_1661;method_7366(Lnet/minecraft/class_1799;)Inamed addStackLnet/minecraft/entity/player/PlayerInventory;addStack(Lnet/minecraft/item/ItemStack;)I
-
addStack
private int addStack(int slot, ItemStack stack)- Mappings:
Namespace Name Mixin selector official dLbje;d(ILbpr;)Iintermediary method_7385Lnet/minecraft/class_1661;method_7385(ILnet/minecraft/class_1799;)Inamed addStackLnet/minecraft/entity/player/PlayerInventory;addStack(ILnet/minecraft/item/ItemStack;)I
-
getOccupiedSlotWithRoomForStack
public int getOccupiedSlotWithRoomForStack(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official dLbje;d(Lbpr;)Iintermediary method_7390Lnet/minecraft/class_1661;method_7390(Lnet/minecraft/class_1799;)Inamed getOccupiedSlotWithRoomForStackLnet/minecraft/entity/player/PlayerInventory;getOccupiedSlotWithRoomForStack(Lnet/minecraft/item/ItemStack;)I
-
updateItems
public void updateItems()
- Mappings:
Namespace Name Mixin selector official jLbje;j()Vintermediary method_7381Lnet/minecraft/class_1661;method_7381()Vnamed updateItemsLnet/minecraft/entity/player/PlayerInventory;updateItems()V
-
insertStack
public boolean insertStack(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official eLbje;e(Lbpr;)Zintermediary method_7394Lnet/minecraft/class_1661;method_7394(Lnet/minecraft/class_1799;)Znamed insertStackLnet/minecraft/entity/player/PlayerInventory;insertStack(Lnet/minecraft/item/ItemStack;)Z
-
insertStack
public boolean insertStack(int slot, ItemStack stack)- Mappings:
Namespace Name Mixin selector official cLbje;c(ILbpr;)Zintermediary method_7367Lnet/minecraft/class_1661;method_7367(ILnet/minecraft/class_1799;)Znamed insertStackLnet/minecraft/entity/player/PlayerInventory;insertStack(ILnet/minecraft/item/ItemStack;)Z
-
offerOrDrop
public void offerOrDrop(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official fLbje;f(Lbpr;)Vintermediary method_7398Lnet/minecraft/class_1661;method_7398(Lnet/minecraft/class_1799;)Vnamed offerOrDropLnet/minecraft/entity/player/PlayerInventory;offerOrDrop(Lnet/minecraft/item/ItemStack;)V
-
offer
public void offer(ItemStack stack, boolean notifiesClient)
- Mappings:
Namespace Name Mixin selector official aLbje;a(Lbpr;Z)Vintermediary method_32338Lnet/minecraft/class_1661;method_32338(Lnet/minecraft/class_1799;Z)Vnamed offerLnet/minecraft/entity/player/PlayerInventory;offer(Lnet/minecraft/item/ItemStack;Z)V
-
removeStack
public ItemStack removeStack(int slot, int amount)
Removes a specific number of items from the given slot.- 指定者:
removeStack在接口中Inventory- 返回:
- the removed items as a stack
- Mappings:
Namespace Name Mixin selector official aLaqz;a(II)Lbpr;intermediary method_5434Lnet/minecraft/class_1263;method_5434(II)Lnet/minecraft/class_1799;named removeStackLnet/minecraft/inventory/Inventory;removeStack(II)Lnet/minecraft/item/ItemStack;
-
removeOne
public void removeOne(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official gLbje;g(Lbpr;)Vintermediary method_7378Lnet/minecraft/class_1661;method_7378(Lnet/minecraft/class_1799;)Vnamed removeOneLnet/minecraft/entity/player/PlayerInventory;removeOne(Lnet/minecraft/item/ItemStack;)V
-
removeStack
public ItemStack removeStack(int slot)
Removes the stack currently stored at the indicated slot.- 指定者:
removeStack在接口中Inventory- 返回:
- the stack previously stored at the indicated slot.
- Mappings:
Namespace Name Mixin selector official bLaqz;b(I)Lbpr;intermediary method_5441Lnet/minecraft/class_1263;method_5441(I)Lnet/minecraft/class_1799;named removeStackLnet/minecraft/inventory/Inventory;removeStack(I)Lnet/minecraft/item/ItemStack;
-
setStack
public void setStack(int slot, ItemStack stack)
-
getBlockBreakingSpeed
public float getBlockBreakingSpeed(BlockState block)
- Mappings:
Namespace Name Mixin selector official aLbje;a(Lcjr;)Fintermediary method_7370Lnet/minecraft/class_1661;method_7370(Lnet/minecraft/class_2680;)Fnamed getBlockBreakingSpeedLnet/minecraft/entity/player/PlayerInventory;getBlockBreakingSpeed(Lnet/minecraft/block/BlockState;)F
-
writeNbt
public ListTag writeNbt(ListTag nbtList)
- Mappings:
Namespace Name Mixin selector official aLbje;a(Lnb;)Lnb;intermediary method_7384Lnet/minecraft/class_1661;method_7384(Lnet/minecraft/class_2499;)Lnet/minecraft/class_2499;named writeNbtLnet/minecraft/entity/player/PlayerInventory;writeNbt(Lnet/minecraft/nbt/ListTag;)Lnet/minecraft/nbt/ListTag;
-
readNbt
public void readNbt(ListTag nbtList)
- Mappings:
Namespace Name Mixin selector official bLbje;b(Lnb;)Vintermediary method_7397Lnet/minecraft/class_1661;method_7397(Lnet/minecraft/class_2499;)Vnamed readNbtLnet/minecraft/entity/player/PlayerInventory;readNbt(Lnet/minecraft/nbt/ListTag;)V
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
getStack
public ItemStack getStack(int slot)
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
public Text getName()
-
getArmorStack
public ItemStack getArmorStack(int slot)
- Mappings:
Namespace Name Mixin selector official eLbje;e(I)Lbpr;intermediary method_7372Lnet/minecraft/class_1661;method_7372(I)Lnet/minecraft/class_1799;named getArmorStackLnet/minecraft/entity/player/PlayerInventory;getArmorStack(I)Lnet/minecraft/item/ItemStack;
-
damageArmor
public void damageArmor(DamageSource damageSource, float amount)
- Mappings:
Namespace Name Mixin selector official aLbje;a(Larv;F)Vintermediary method_7375Lnet/minecraft/class_1661;method_7375(Lnet/minecraft/class_1282;F)Vnamed damageArmorLnet/minecraft/entity/player/PlayerInventory;damageArmor(Lnet/minecraft/entity/damage/DamageSource;F)V
-
dropAll
public void dropAll()
- Mappings:
Namespace Name Mixin selector official kLbje;k()Vintermediary method_7388Lnet/minecraft/class_1661;method_7388()Vnamed dropAllLnet/minecraft/entity/player/PlayerInventory;dropAll()V
-
markDirty
public void markDirty()
-
getChangeCount
public int getChangeCount()
- Mappings:
Namespace Name Mixin selector official lLbje;l()Iintermediary method_7364Lnet/minecraft/class_1661;method_7364()Inamed getChangeCountLnet/minecraft/entity/player/PlayerInventory;getChangeCount()I
-
canPlayerUse
public boolean canPlayerUse(PlayerEntity player)
- 指定者:
canPlayerUse在接口中Inventory- Mappings:
Namespace Name Mixin selector official aLaqz;a(Lbjf;)Zintermediary method_5443Lnet/minecraft/class_1263;method_5443(Lnet/minecraft/class_1657;)Znamed canPlayerUseLnet/minecraft/inventory/Inventory;canPlayerUse(Lnet/minecraft/entity/player/PlayerEntity;)Z
-
contains
public boolean contains(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official hLbje;h(Lbpr;)Zintermediary method_7379Lnet/minecraft/class_1661;method_7379(Lnet/minecraft/class_1799;)Znamed containsLnet/minecraft/entity/player/PlayerInventory;contains(Lnet/minecraft/item/ItemStack;)Z
-
contains
public boolean contains(Tag<Item> tag)
- Mappings:
Namespace Name Mixin selector official aLbje;a(Lafs;)Zintermediary method_7382Lnet/minecraft/class_1661;method_7382(Lnet/minecraft/class_3494;)Znamed containsLnet/minecraft/entity/player/PlayerInventory;contains(Lnet/minecraft/tag/Tag;)Z
-
clone
public void clone(PlayerInventory other)
- Mappings:
Namespace Name Mixin selector official aLbje;a(Lbje;)Vintermediary method_7377Lnet/minecraft/class_1661;method_7377(Lnet/minecraft/class_1661;)Vnamed cloneLnet/minecraft/entity/player/PlayerInventory;clone(Lnet/minecraft/entity/player/PlayerInventory;)V
-
clear
public void clear()
-
populateRecipeFinder
public void populateRecipeFinder(RecipeFinder finder)
- Mappings:
Namespace Name Mixin selector official aLbje;a(Lbjh;)Vintermediary method_7387Lnet/minecraft/class_1661;method_7387(Lnet/minecraft/class_1662;)Vnamed populateRecipeFinderLnet/minecraft/entity/player/PlayerInventory;populateRecipeFinder(Lnet/minecraft/recipe/RecipeFinder;)V
-
-