Package org.moddingx.libx.base
Class ItemInventory<T extends net.minecraftforge.items.IItemHandlerModifiable & net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>>
java.lang.Object
net.minecraft.world.item.Item
org.moddingx.libx.base.ItemBase
org.moddingx.libx.base.ItemInventory<T>
- All Implemented Interfaces:
net.minecraft.world.flag.FeatureElement
,net.minecraft.world.level.ItemLike
,net.minecraftforge.common.extensions.IForgeItem
,CreativeTabItemProvider
public class ItemInventory<T extends net.minecraftforge.items.IItemHandlerModifiable & net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>>
extends ItemBase
Base class for
items
which have an inventory. This will provide the capability to the item.-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.item.Item
net.minecraft.world.item.Item.Properties
-
Field Summary
Fields inherited from class net.minecraft.world.item.Item
BASE_ATTACK_DAMAGE_UUID, BASE_ATTACK_SPEED_UUID, BY_BLOCK, canRepair, EAT_DURATION, MAX_BAR_WIDTH, MAX_STACK_SIZE
Fields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES
-
Constructor Summary
ConstructorDescriptionItemInventory
(ModX mod, net.minecraft.world.item.Item.Properties properties, Function<Runnable, T> inventoryFactory) Creates a new item with inventory. -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraftforge.items.IItemHandlerModifiable
getInventory
(net.minecraft.world.item.ItemStack stack) Gets the inventory of anItemStack
or null if the ItemStack doesn't have the item handler capability or the item handler is not an instance ofIItemHandlerModifiable
.static Optional<net.minecraftforge.items.IItemHandlerModifiable>
getInventoryOption
(net.minecraft.world.item.ItemStack stack) Gets anOptional
containing the inventory of anItemStack
or an empty optional if the ItemStack doesn't have the item handler capability or the item handler is not an instance ofIItemHandlerModifiable
.net.minecraftforge.common.capabilities.ICapabilityProvider
initCapabilities
(net.minecraft.world.item.ItemStack stack, net.minecraft.nbt.CompoundTag capTag) Methods inherited from class org.moddingx.libx.base.ItemBase
makeCreativeTabStacks
Methods inherited from class net.minecraft.world.item.Item
appendHoverText, asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canBeDepleted, canBeHurtBy, canFitInsideContainerItems, finishUsingItem, getBarColor, getBarWidth, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getFoodProperties, getId, getMaxDamage, getMaxStackSize, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getRarity, getRenderPropertiesInternal, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, inventoryTick, isBarVisible, isComplex, isCorrectToolForDrops, isEdible, isEnchantable, isFireResistant, isFoil, isRepairable, isValidRepairItem, mineBlock, onCraftedBy, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, releaseUsing, requiredFeatures, shouldOverrideMultiplayerNbt, toString, use, useOn, useOnRelease, verifyTagAfterLoad
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabled
Methods inherited from interface net.minecraftforge.common.extensions.IForgeItem
canApplyAtEnchantingTable, canContinueUsing, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getAttributeModifiers, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultTooltipHideFlags, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getShareTag, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, isBookEnchantable, isCorrectToolForDrops, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onItemUseFirst, onLeftClickEntity, onStopUsing, readShareTag, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation
-
Constructor Details
-
ItemInventory
public ItemInventory(ModX mod, net.minecraft.world.item.Item.Properties properties, Function<Runnable, T> inventoryFactory) Creates a new item with inventory.- Parameters:
inventoryFactory
- A factory that creates new item handler for an item stack. The runnable given to that function should be called inonContentsChanged
-
-
Method Details
-
initCapabilities
-
getInventory
@Nullable public static net.minecraftforge.items.IItemHandlerModifiable getInventory(net.minecraft.world.item.ItemStack stack) Gets the inventory of anItemStack
or null if the ItemStack doesn't have the item handler capability or the item handler is not an instance ofIItemHandlerModifiable
. -
getInventoryOption
public static Optional<net.minecraftforge.items.IItemHandlerModifiable> getInventoryOption(net.minecraft.world.item.ItemStack stack) Gets anOptional
containing the inventory of anItemStack
or an empty optional if the ItemStack doesn't have the item handler capability or the item handler is not an instance ofIItemHandlerModifiable
.
-