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 -
Method Summary
Modifier and TypeMethodDescriptionvoidCopy 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.voidcopyItemToFakePlayer(int slot) Copy item from drone's IItemHandler inventory to the fake player's main inventory Also handle item equipping where appropriatenet.minecraft.world.item.ItemStackextractItem(int slot, int amount, boolean simulate) intgetSlots()net.minecraft.world.item.ItemStackinsertItem(int slot, net.minecraft.world.item.ItemStack stack, boolean simulate) protected booleanvoidCall this when it's safe to create a fake player (i.e.voidsetStackInSlot(int slot, net.minecraft.world.item.ItemStack stack) voidsetUseableSlots(int useableSlots) Methods inherited from class net.minecraftforge.items.ItemStackHandler
deserializeNBT, getSlotLimit, getStackInSlot, getStackLimit, isItemValid, onContentsChanged, onLoad, serializeNBT, setSize, validateSlotIndex
-
Constructor Details
-
DroneItemHandler
-
-
Method Details
-
insertItem
@Nonnull public net.minecraft.world.item.ItemStack insertItem(int slot, @Nonnull net.minecraft.world.item.ItemStack stack, boolean simulate) - Specified by:
insertItemin interfacenet.minecraftforge.items.IItemHandler- Overrides:
insertItemin classnet.minecraftforge.items.ItemStackHandler
-
extractItem
@Nonnull public net.minecraft.world.item.ItemStack extractItem(int slot, int amount, boolean simulate) - Specified by:
extractItemin interfacenet.minecraftforge.items.IItemHandler- Overrides:
extractItemin classnet.minecraftforge.items.ItemStackHandler
-
setStackInSlot
public void setStackInSlot(int slot, @Nonnull net.minecraft.world.item.ItemStack stack) - Specified by:
setStackInSlotin interfacenet.minecraftforge.items.IItemHandlerModifiable- Overrides:
setStackInSlotin classnet.minecraftforge.items.ItemStackHandler
-
getSlots
public int getSlots()- Specified by:
getSlotsin interfacenet.minecraftforge.items.IItemHandler- Overrides:
getSlotsin classnet.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
-