Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ToolActions to ItemAbilities #1148

Merged
merged 7 commits into from
Jun 26, 2024

Conversation

TelepathicGrunt
Copy link
Contributor

The goal is that ToolActions looks like it is only for tools that do some sort of actions. But that is not what this API actually is. The API is basically a marker to signal your item for any sort of itemstack sensitive check easily. Even between mods without any compile dependency.

After asking people for some names, ItemAbilities came up multiple times independently. This means this name is the most intuitive one that people keep thinking of when describing ToolActions to them.

Closes #1032

@TelepathicGrunt TelepathicGrunt added breaking change Breaks binary compatibility 1.21 Targeted at Minecraft 1.21 labels Jun 20, 2024
@TelepathicGrunt TelepathicGrunt self-assigned this Jun 20, 2024
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Jun 20, 2024

  • Publish PR to GitHub Packages

Last commit published: cac68a1318c150ce26ecd8ec425943d0b0896bc2.

PR Publishing

The artifacts published by this PR:

Repository Declaration

In order to use the artifacts published by the PR, add the following repository to your buildscript:

repositories {
    maven {
        name 'Maven for PR #1148' // https://github.com/neoforged/NeoForge/pull/1148
        url 'https://prmaven.neoforged.net/NeoForge/pr1148'
        content {
            includeModule('net.neoforged', 'neoforge')
            includeModule('net.neoforged', 'testframework')
        }
    }
}

MDK installation

In order to setup a MDK using the latest PR version, run the following commands in a terminal.
The script works on both *nix and Windows as long as you have the JDK bin folder on the path.
The script will clone the MDK in a folder named NeoForge-pr1148.
On Powershell you will need to remove the -L flag from the curl invocation.

mkdir NeoForge-pr1148
cd NeoForge-pr1148
curl -L https://prmaven.neoforged.net/NeoForge/pr1148/net/neoforged/neoforge/21.0.47-beta-pr-1148-ToolActionRename/mdk-pr1148.zip -o mdk.zip
jar xf mdk.zip
rm mdk.zip || del mdk.zip

To test a production environment, you can download the installer from here.

pupnewfster
pupnewfster previously approved these changes Jun 24, 2024
@neoforged-compatibility-checks
Copy link

neoforged-compatibility-checks bot commented Jun 24, 2024

@TelepathicGrunt, 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: cac68a1318c150ce26ecd8ec425943d0b0896bc2.

Compatibility checks

neoforge (:neoforge)

  • net/minecraft/world/item/TridentItem
    • canPerformAction(Lnet/minecraft/world/item/ItemStack;Lnet/neoforged/neoforge/common/ToolAction;)Z: ❗ API method was removed
  • net/minecraft/world/item/ShovelItem
    • canPerformAction(Lnet/minecraft/world/item/ItemStack;Lnet/neoforged/neoforge/common/ToolAction;)Z: ❗ API method was removed
  • net/minecraft/world/item/FishingRodItem
    • canPerformAction(Lnet/minecraft/world/item/ItemStack;Lnet/neoforged/neoforge/common/ToolAction;)Z: ❗ API method was removed
  • net/minecraft/world/item/SwordItem
    • canPerformAction(Lnet/minecraft/world/item/ItemStack;Lnet/neoforged/neoforge/common/ToolAction;)Z: ❗ API method was removed
  • net/neoforged/neoforge/common/extensions/IBlockStateExtension
    • getToolModifiedState(Lnet/minecraft/world/item/context/UseOnContext;Lnet/neoforged/neoforge/common/ToolAction;Z)Lnet/minecraft/world/level/block/state/BlockState;: ❗ API method was removed
  • net/neoforged/neoforge/event/level/BlockEvent$BlockToolModificationEvent
    • getToolAction()Lnet/neoforged/neoforge/common/ToolAction;: ❗ API method was removed
    • <init>(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/item/context/UseOnContext;Lnet/neoforged/neoforge/common/ToolAction;Z)V: ❗ API method was removed
  • net/neoforged/neoforge/common/loot/CanToolPerformAction
    • ❗ API class no longer exists
  • net/neoforged/neoforge/common/extensions/IItemExtension
    • canPerformAction(Lnet/minecraft/world/item/ItemStack;Lnet/neoforged/neoforge/common/ToolAction;)Z: ❗ API method was removed
  • net/minecraft/world/item/BrushItem
    • canPerformAction(Lnet/minecraft/world/item/ItemStack;Lnet/neoforged/neoforge/common/ToolAction;)Z: ❗ API method was removed
  • net/minecraft/world/item/ShieldItem
    • canPerformAction(Lnet/minecraft/world/item/ItemStack;Lnet/neoforged/neoforge/common/ToolAction;)Z: ❗ API method was removed
  • net/neoforged/neoforge/common/advancements/critereon/ToolActionItemPredicate
    • ❗ API class no longer exists
  • net/neoforged/neoforge/common/ToolActions
    • ❗ API class no longer exists
  • net/minecraft/world/item/HoeItem
    • canPerformAction(Lnet/minecraft/world/item/ItemStack;Lnet/neoforged/neoforge/common/ToolAction;)Z: ❗ API method was removed
  • net/neoforged/neoforge/common/extensions/IBlockExtension
    • getToolModifiedState(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/item/context/UseOnContext;Lnet/neoforged/neoforge/common/ToolAction;Z)Lnet/minecraft/world/level/block/state/BlockState;: ❗ API method was removed
  • net/minecraft/world/item/AxeItem
    • canPerformAction(Lnet/minecraft/world/item/ItemStack;Lnet/neoforged/neoforge/common/ToolAction;)Z: ❗ API method was removed
  • net/neoforged/neoforge/common/extensions/IItemStackExtension
    • canPerformAction(Lnet/neoforged/neoforge/common/ToolAction;)Z: ❗ API method was removed
  • net/minecraft/world/item/PickaxeItem
    • canPerformAction(Lnet/minecraft/world/item/ItemStack;Lnet/neoforged/neoforge/common/ToolAction;)Z: ❗ API method was removed
  • net/minecraft/world/item/ShearsItem
    • canPerformAction(Lnet/minecraft/world/item/ItemStack;Lnet/neoforged/neoforge/common/ToolAction;)Z: ❗ API method was removed
  • net/neoforged/neoforge/common/ToolAction
    • ❗ API class no longer exists
  • net/neoforged/neoforge/event/EventHooks
    • onToolUse(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/item/context/UseOnContext;Lnet/neoforged/neoforge/common/ToolAction;Z)Lnet/minecraft/world/level/block/state/BlockState;: ❗ API method was removed
  • net/neoforged/neoforge/common/NeoForgeMod
    • TOOL_ACTION_PREDICATE:Lnet/neoforged/neoforge/registries/DeferredHolder;: ❗ API field was removed

pupnewfster
pupnewfster previously approved these changes Jun 24, 2024
@TelepathicGrunt TelepathicGrunt marked this pull request as draft June 24, 2024 23:15
@TelepathicGrunt
Copy link
Contributor Author

Yo neo modders, do we want to add namespaces to these ItemAbilities (ToolActions) strings? So shears_dig becomes neoforge:shears_dig. Speak now

@RaymondBlaze
Copy link
Contributor

Yo neo modders, do we want to add namespaces to these ItemAbilities (ToolActions) strings? So shears_dig becomes neoforge:shears_dig. Speak now

Then it also applies to the EffectCure system, since they share some level of similarity where the instances are computed if absent and represented from String inputs.
I personally agree with switching to ResourceLocation for that, since all the benefits for using a String other than a ResourceLocation could be covered by using the conventional namespace c, and switching to ResourceLocation will make them be more consistent with other stuffs.

@TelepathicGrunt
Copy link
Contributor Author

TelepathicGrunt commented Jun 25, 2024

Me and the other maintainers talked some more and decided it may be best to not namespace. The existing ItemAbilities in Neo would’ve gotten the neo namespace which would make modders not realize they should use c or some other namespace for common ItemAbilities. So it’ll lead to most modders using neo namespace and at that point, there’s just no need for namespaces. We aren’t seeing much benefit to namespacing that outweighs the confusion over what namespace to use when

Convo: https://discord.com/channels/313125603924639766/1154167065519861831/1254934108610756740

(Note, maintainer's decisions could change in more discussions back to namespaces. May still be on-going)

@TelepathicGrunt TelepathicGrunt marked this pull request as ready for review June 25, 2024 10:33
pupnewfster
pupnewfster previously approved these changes Jun 26, 2024
@TelepathicGrunt TelepathicGrunt merged commit fd2db10 into neoforged:1.21.x Jun 26, 2024
6 checks passed
@TelepathicGrunt TelepathicGrunt deleted the ToolActionRename branch June 26, 2024 23:35
robotgryphon pushed a commit to robotgryphon/NeoForge that referenced this pull request Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21 Targeted at Minecraft 1.21 breaking change Breaks binary compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename ToolActions in 1.21
5 participants