Class DroneItemHandler

java.lang.Object
net.minecraftforge.items.ItemStackHandler
me.desht.pneumaticcraft.common.util.fakeplayer.DroneItemHandler
All Implemented Interfaces:
net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>, net.minecraftforge.items.IItemHandler, net.minecraftforge.items.IItemHandlerModifiable

public class DroneItemHandler extends net.minecraftforge.items.ItemStackHandler
  • Field Summary

    Fields inherited from class net.minecraftforge.items.ItemStackHandler

    stacks
  • Constructor Summary

    Constructors
    Constructor
    Description
    DroneItemHandler(IDrone holder, int useableSlots)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Copy of the contents of the fake player's inventory back to this inventory (other than the item in slot 0), dropping in the world any items which don't fit due to the drone's inventory being too small.
    void
    Copy item from drone's IItemHandler inventory to the fake player's main inventory Also handle item equipping where appropriate
    net.minecraft.world.item.ItemStack
    extractItem(int slot, int amount, boolean simulate)
     
    int
     
    net.minecraft.world.item.ItemStack
    insertItem(int slot, net.minecraft.world.item.ItemStack stack, boolean simulate)
     
    protected boolean
     
    void
    Call this when it's safe to create a fake player (i.e.
    void
    setStackInSlot(int slot, net.minecraft.world.item.ItemStack stack)
     
    void
    setUseableSlots(int useableSlots)
     

    Methods inherited from class net.minecraftforge.items.ItemStackHandler

    deserializeNBT, getSlotLimit, getStackInSlot, getStackLimit, isItemValid, onContentsChanged, onLoad, serializeNBT, setSize, validateSlotIndex

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DroneItemHandler

      public DroneItemHandler(IDrone holder, int useableSlots)
  • Method Details

    • insertItem

      @Nonnull public net.minecraft.world.item.ItemStack insertItem(int slot, @Nonnull net.minecraft.world.item.ItemStack stack, boolean simulate)
      Specified by:
      insertItem in interface net.minecraftforge.items.IItemHandler
      Overrides:
      insertItem in class net.minecraftforge.items.ItemStackHandler
    • extractItem

      @Nonnull public net.minecraft.world.item.ItemStack extractItem(int slot, int amount, boolean simulate)
      Specified by:
      extractItem in interface net.minecraftforge.items.IItemHandler
      Overrides:
      extractItem in class net.minecraftforge.items.ItemStackHandler
    • setStackInSlot

      public void setStackInSlot(int slot, @Nonnull net.minecraft.world.item.ItemStack stack)
      Specified by:
      setStackInSlot in interface net.minecraftforge.items.IItemHandlerModifiable
      Overrides:
      setStackInSlot in class net.minecraftforge.items.ItemStackHandler
    • getSlots

      public int getSlots()
      Specified by:
      getSlots in interface net.minecraftforge.items.IItemHandler
      Overrides:
      getSlots in class net.minecraftforge.items.ItemStackHandler
    • setUseableSlots

      public void setUseableSlots(int useableSlots)
    • isFakePlayerReady

      protected boolean isFakePlayerReady()
    • setFakePlayerReady

      public void setFakePlayerReady()
      Call this when it's safe to create a fake player (i.e. NOT when reading NBT during entity/block entity creation!)
    • copyFromFakePlayer

      public void copyFromFakePlayer()
      Copy of the contents of the fake player's inventory back to this inventory (other than the item in slot 0), dropping in the world any items which don't fit due to the drone's inventory being too small. Also clears the fake player inventory.
    • copyItemToFakePlayer

      public void copyItemToFakePlayer(int slot)
      Copy item from drone's IItemHandler inventory to the fake player's main inventory Also handle item equipping where appropriate
      Parameters:
      slot - slot that is being updated