Skip to content

[26.1] IItemStackExtension to ItemInstanceExtension pass#3071

Draft
ApexModder wants to merge 55 commits into
neoforged:26.1.xfrom
ApexModder:26.1/item-extension-pass
Draft

[26.1] IItemStackExtension to ItemInstanceExtension pass#3071
ApexModder wants to merge 55 commits into
neoforged:26.1.xfrom
ApexModder:26.1/item-extension-pass

Conversation

@ApexModder
Copy link
Copy Markdown
Member

@ApexModder ApexModder commented Apr 6, 2026

This PR does a pass over all our IItemStackExtension and moves what we can to ItemInstanceExtension

The following has currently been moved upstream

  • getCraftingRemainder
  • getBurnTime
    • Needed an overload in IItemStackExtension to ensure empty stacks continue to return 0, templates do not support being "empty"
    • Had to patch in a FuelValues.burnDuration(ItemInstance) overload
  • getEquipmentSlot
  • getEntityLifespan
  • getXpRepairRatio
  • canEquip
    • Required a ItemInstance sensitive overload for LivingEntity.isEquippableInSlot, vanilla was patched to call this new overload
  • doesSneakBypassUse
  • isPiglinCurrency
  • makesPiglinsNeutral
  • isGazeDisguise
  • canWalkOnPowderedSnow
  • getSweepHitBox
  • canGrindstoneRepair
  • getAttributeModifiers
  • canFitInsideContainerItems
  • isPrimaryItemFor and supportsEnchantment
    • Had to patch in a Enchantment.isSupportedItem(ItemInstance) overload
  • getAllEnchantments
  • isCombineRepairable
    • Required introducing a isDamageable ItemInstance extension
  • isNotReplaceableByPickAction
    • Implementation was missed/removed during 21.11_unobf work and has been reimplemented with this PR (18cb863)
    • Required introducing a isEnchanted ItemInstance extension
  • getHighlightTip

Troublesome extensions

  • shouldCauseBlockBreakReset
    • Requires bunch of "damgeable" helpers to be patched into ItemInstance/ItemStackTemplate and a DataComponentMap getter

Various callers have also been updated to call the ItemInstance extension
For example the getCraftingRemainder patch in AbstractFurnaceBlockEntity previously this called Item.getCraftingRemainder() now it calls ItemInstance.getCraftingRemainder().

@ApexModder ApexModder added cleanup Change that isn't an enhancement or a bug fix 26.1 Targeted at Minecraft 26.1 labels Apr 6, 2026
@neoforged-pr-publishing
Copy link
Copy Markdown

  • Publish PR to GitHub Packages

@neoforged-compatibility-checks
Copy link
Copy Markdown

neoforged-compatibility-checks Bot commented Apr 6, 2026

@ApexModder, this PR introduces breaking changes.
Fortunately, this project is currently accepting breaking changes, but if they are not intentional, please revert them.
Last checked commit: f6f62efb767f7b606bf9392f65021d593e6cecab.

Compatibility checks

neoforge (:neoforge)

  • net/neoforged/neoforge/event/ItemAttributeModifierEvent
    • getItemStack()Lnet/minecraft/world/item/ItemStack;: ❗ API method was removed
    • <init>(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/component/ItemAttributeModifiers;)V: ⚠ API method was removed
  • net/minecraft/world/item/Item
    • isCombineRepairable(Lnet/minecraft/world/item/ItemStack;)Z: ❗ API method was removed
  • net/neoforged/neoforge/event/furnace/FurnaceFuelBurnTimeEvent
    • getItemStack()Lnet/minecraft/world/item/ItemStack;: ❗ API method was removed
    • <init>(Lnet/minecraft/world/item/ItemStack;ILnet/minecraft/world/item/crafting/RecipeType;Lnet/minecraft/world/level/block/entity/FuelValues;)V: ❗ API method was removed
  • net/neoforged/neoforge/common/CommonHooks
    • computeModifiedAttributes(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/component/ItemAttributeModifiers;)Lnet/minecraft/world/item/component/ItemAttributeModifiers;: ❗ API method was removed
  • net/neoforged/neoforge/common/extensions/IItemExtension
    • isDamageable(Lnet/minecraft/world/item/ItemStack;)Z: ❗ API method was removed
    • makesPiglinsNeutral(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/entity/LivingEntity;)Z: ❗ API method was removed
    • getDefaultAttributeModifiers(Lnet/minecraft/world/item/ItemStack;)Lnet/minecraft/world/item/component/ItemAttributeModifiers;: ❗ API method was removed
    • getBurnTime(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/crafting/RecipeType;Lnet/minecraft/world/level/block/entity/FuelValues;)I: ❗ API method was removed
    • canGrindstoneRepair(Lnet/minecraft/world/item/ItemStack;)Z: ❗ API method was removed
    • getXpRepairRatio(Lnet/minecraft/world/item/ItemStack;)F: ❗ API method was removed
    • getEquipmentSlot(Lnet/minecraft/world/item/ItemStack;)Lnet/minecraft/world/entity/EquipmentSlot;: ❗ API method was removed
    • isCombineRepairable(Lnet/minecraft/world/item/ItemStack;)Z: ❗ API method was removed
    • getEntityLifespan(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/Level;)I: ❗ API method was removed
    • doesSneakBypassUse(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/LevelReader;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/player/Player;)Z: ❗ API method was removed
    • canEquip(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/entity/EquipmentSlot;Lnet/minecraft/world/entity/LivingEntity;)Z: ❗ API method was removed
    • isPiglinCurrency(Lnet/minecraft/world/item/ItemStack;)Z: ❗ API method was removed
    • isPrimaryItemFor(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/core/Holder;)Z: ❗ API method was removed
    • canWalkOnPowderedSnow(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/entity/LivingEntity;)Z: ❗ API method was removed
    • getAllEnchantments(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/core/HolderLookup$RegistryLookup;)Lnet/minecraft/world/item/enchantment/ItemEnchantments;: ❗ API method was removed
    • supportsEnchantment(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/core/Holder;)Z: ❗ API method was removed
    • getHighlightTip(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/network/chat/Component;)Lnet/minecraft/network/chat/Component;: ❗ API method was removed
    • getSweepHitBox(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/entity/Entity;)Lnet/minecraft/world/phys/AABB;: ❗ API method was removed
    • isGazeDisguise(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/entity/LivingEntity;)Z: ❗ API method was removed
    • canFitInsideContainerItems(Lnet/minecraft/world/item/ItemStack;)Z: ❗ API method was removed
    • isCombineRepairable(Lnet/minecraft/world/item/ItemInstance;)Z: ❗ Method was made abstract
    • isNotReplaceableByPickAction(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/entity/player/Player;I)Z: ❗ API method was removed
  • net/neoforged/neoforge/event/EventHooks
    • getItemBurnTime(Lnet/minecraft/world/item/ItemStack;ILnet/minecraft/world/item/crafting/RecipeType;Lnet/minecraft/world/level/block/entity/FuelValues;)I: ❗ API method was removed
    • getAllEnchantmentLevels(Lnet/minecraft/world/item/enchantment/ItemEnchantments;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/core/HolderLookup$RegistryLookup;)Lnet/minecraft/world/item/enchantment/ItemEnchantments;: ❗ API method was removed

Copy link
Copy Markdown
Member

@XFactHD XFactHD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These moves need more justification, it feels like some are being moved just for the sake of it, at the cost of more patching overhead

Comment thread patches/net/minecraft/world/entity/LivingEntity.java.patch Outdated
Comment thread src/main/java/net/neoforged/neoforge/common/extensions/IItemExtension.java Outdated
@ApexModder ApexModder force-pushed the 26.1/item-extension-pass branch from 54557db to 38f3295 Compare April 8, 2026 10:28
@ApexModder ApexModder added the keep rebased Add this label to a PR to keep it rebased continuously automatically label Apr 8, 2026
@ApexModder ApexModder removed the keep rebased Add this label to a PR to keep it rebased continuously automatically label Apr 30, 2026
@ApexModder ApexModder marked this pull request as draft April 30, 2026 14:47
@ApexModder
Copy link
Copy Markdown
Member Author

Converted back to draft to remain as reference material for when this is eventually taken up and implemented.

@neoforged-automation
Copy link
Copy Markdown
Contributor

@ApexModder, this pull request has conflicts, please resolve them for this PR to move forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

26.1 Targeted at Minecraft 26.1 cleanup Change that isn't an enhancement or a bug fix needs rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[26.1] Furnace crafting remainder doesn't consider the stack.

2 participants