Class ItemMenuHost<T extends net.minecraft.world.item.Item>
java.lang.Object
appeng.api.implementations.menuobjects.ItemMenuHost<T>
- All Implemented Interfaces:
IUpgradeableObject
public class ItemMenuHost<T extends net.minecraft.world.item.Item>
extends Object
implements IUpgradeableObject
Base interface for an adapter that connects an item stack in a player inventory with a menu that is opened by it.
-
Constructor Summary
ConstructorsConstructorDescriptionItemMenuHost
(T item, net.minecraft.world.entity.player.Player player, appeng.menu.locator.ItemMenuHostLocator locator) -
Method Summary
Modifier and TypeMethodDescriptionboolean
consumeIdlePower
(Actionable action) Can only be used with a host that implementsIEnergySource
.getItem()
net.minecraft.world.item.ItemStack
@Nullable appeng.menu.locator.ItemMenuHostLocator
net.minecraft.world.entity.player.Player
@Nullable Integer
protected double
Get power drain per tick.final IUpgradeInventory
Gets the inventory that contains the upgrade cards for this upgradable object.long
insert
(net.minecraft.world.entity.player.Player player, AEKey what, long amount, Actionable mode) Insert something into the host of this menu (i.e.boolean
boolean
isValid()
Checks if the item underlying this host is still in place.void
tick()
Gives the item hosting the GUI a chance to do periodic actions when the menu is being ticked.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface appeng.api.upgrades.IUpgradeableObject
getInstalledUpgrades, isUpgradedWith
-
Constructor Details
-
Method Details
-
getPlayer
public net.minecraft.world.entity.player.Player getPlayer()- Returns:
- The player holding the item.
-
getPlayerInventorySlot
- Returns:
- The index of the item hosting the menu in the
players
inventory. Null if the item is not directly accessible via the inventory.
-
getLocator
@Nullable public @Nullable appeng.menu.locator.ItemMenuHostLocator getLocator() -
getItem
-
getItemStack
public net.minecraft.world.item.ItemStack getItemStack()- Returns:
- The item stack hosting the menu. This can change.
-
isClientSide
public boolean isClientSide()- Returns:
- True if this host is on the client-side.
-
tick
public void tick()Gives the item hosting the GUI a chance to do periodic actions when the menu is being ticked. -
isValid
public boolean isValid()Checks if the item underlying this host is still in place. -
consumeIdlePower
Can only be used with a host that implementsIEnergySource
. -
getPowerDrainPerTick
protected double getPowerDrainPerTick()Get power drain per tick. -
getUpgrades
Description copied from interface:IUpgradeableObject
Gets the inventory that contains the upgrade cards for this upgradable object.- Specified by:
getUpgrades
in interfaceIUpgradeableObject
-
insert
public long insert(net.minecraft.world.entity.player.Player player, AEKey what, long amount, Actionable mode) Insert something into the host of this menu (i.e. by dropping onto the hosting item in the player inventory or by similar mechanisms).- Returns:
- The amount that was inserted.
-