Class InventoryPlayer

  • All Implemented Interfaces:
    IInventory, IWorldNameable, org.teavm.jso.JSObject

    public class InventoryPlayer
    extends PluginData
    implements IInventory
    + This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!" Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team EaglercraftX 1.8 patch files are (c) 2022-2023 LAX1DUDE. All Rights Reserved. WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR. NOT FOR COMMERCIAL OR MALICIOUS USE (please read the 'LICENSE' file this repo's root directory for more info)
    • Field Detail

      • mainInventory

        public ItemStack[] mainInventory
        + An array of 36 item stacks indicating the main player inventory (including the visible bar).
      • armorInventory

        public ItemStack[] armorInventory
        + An array of 4 item stacks containing the currently worn armor pieces.
      • currentItem

        public int currentItem
      • inventoryChanged

        public boolean inventoryChanged
    • Constructor Detail

      • InventoryPlayer

        public InventoryPlayer​(EntityPlayer playerIn)
    • Method Detail

      • loadPluginData

        public void loadPluginData​(BaseData data)
      • makePluginData

        public PluginData makePluginData()
      • getCurrentItem

        public ItemStack getCurrentItem()
        + Returns the item stack currently held by the player.
      • getHotbarSize

        public static int getHotbarSize()
        + Get the size of the player hotbar inventory
      • getFirstEmptyStack

        public int getFirstEmptyStack()
        + Returns the first item stack that is empty.
      • setCurrentItem

        public void setCurrentItem​(Item itemIn,
                                   int parInt1,
                                   boolean parFlag,
                                   boolean parFlag2)
      • changeCurrentItem

        public void changeCurrentItem​(int parInt1)
        + Switch the current item to the next one or the previous one
      • clearMatchingItems

        public int clearMatchingItems​(Item itemIn,
                                      int metadataIn,
                                      int removeCount,
                                      NBTTagCompound itemNBT)
        + Removes matching items from the inventory.\n@param itemIn The item to match, null ignores.\n@param metadataIn The metadata to match, -1 ignores.\n@param removeCount The number of items to remove. If less than 1, removes all matching items.\n@param itemNBT The NBT data to match, null ignores.\n@return The number of items removed from the inventory.
      • decrementAnimations

        public void decrementAnimations()
        + Decrement the number of animations remaining. Only called on client side. This is used to handle the animation of receiving a block.
      • consumeInventoryItem

        public boolean consumeInventoryItem​(Item itemIn)
        + removed one item of specified Item from inventory (if it is in a stack, the stack size will reduce with 1)
      • hasItem

        public boolean hasItem​(Item itemIn)
        + Checks if a specified Item is inside the inventory
      • addItemStackToInventory

        public boolean addItemStackToInventory​(ItemStack itemStackIn)
        + Adds the item stack to the inventory, returns false if it is impossible.
      • decrStackSize

        public ItemStack decrStackSize​(int i,
                                       int j)
        + Removes up to a specified number of items from an inventory slot and returns them in a new stack.
        Specified by:
        decrStackSize in interface IInventory
      • setInventorySlotContents

        public void setInventorySlotContents​(int i,
                                             ItemStack itemstack)
        + Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
        Specified by:
        setInventorySlotContents in interface IInventory
      • getStrVsBlock

        public float getStrVsBlock​(Block blockIn)
      • writeToNBT

        public NBTTagList writeToNBT​(NBTTagList parNBTTagList)
        + Writes the inventory out as a list of compound tags. This is where the slot indices are used (+100 for armor, +80 for crafting).
      • readFromNBT

        public void readFromNBT​(NBTTagList parNBTTagList)
        + Reads from the given tag list and fills the slots in the inventory with the correct items.
      • getSizeInventory

        public int getSizeInventory()
        + Returns the number of slots in the inventory.
        Specified by:
        getSizeInventory in interface IInventory
      • getName

        public java.lang.String getName()
        + Gets the name of this command sender (usually username, but possibly "Rcon")
        Specified by:
        getName in interface IWorldNameable
      • hasCustomName

        public boolean hasCustomName()
        + Returns true if this thing is named
        Specified by:
        hasCustomName in interface IWorldNameable
      • getInventoryStackLimit

        public int getInventoryStackLimit()
        + Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended.
        Specified by:
        getInventoryStackLimit in interface IInventory
      • canHeldItemHarvest

        public boolean canHeldItemHarvest​(Block blockIn)
      • armorItemInSlot

        public ItemStack armorItemInSlot​(int parInt1)
        + returns a player armor item (as itemstack) contained in specified armor slot.
      • getTotalArmorValue

        public int getTotalArmorValue()
        + Based on the damage values and maximum damage values of each armor item, returns the current armor value.
      • damageArmor

        public void damageArmor​(float damage)
        + Damages armor in each slot by the specified amount.
      • dropAllItems

        public void dropAllItems()
        + Drop all armor and main inventory items.
      • markDirty

        public void markDirty()
        + For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it hasn't changed and skip it.
        Specified by:
        markDirty in interface IInventory
      • setItemStack

        public void setItemStack​(ItemStack itemStackIn)
        + Set the stack helds by mouse, used in GUI/Container
      • getItemStack

        public ItemStack getItemStack()
        + Stack helds by mouse, used in GUI and Containers
      • isUseableByPlayer

        public boolean isUseableByPlayer​(EntityPlayer entityplayer)
        + Do not make give this method the name canInteractWith because it clashes with Container
        Specified by:
        isUseableByPlayer in interface IInventory
      • hasItemStack

        public boolean hasItemStack​(ItemStack itemStackIn)
        + Returns true if the specified ItemStack exists in the inventory.
      • isItemValidForSlot

        public boolean isItemValidForSlot​(int var1,
                                          ItemStack var2)
        + Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
        Specified by:
        isItemValidForSlot in interface IInventory
      • copyInventory

        public void copyInventory​(InventoryPlayer playerInventory)
        + Copy the ItemStack contents from another InventoryPlayer instance
      • getField

        public int getField​(int var1)
        Specified by:
        getField in interface IInventory
      • setField

        public void setField​(int var1,
                             int var2)
        Specified by:
        setField in interface IInventory
      • clear

        public void clear()
        Specified by:
        clear in interface IInventory