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

Add PlayerEvent.ItemSmithingEvent please. #1569

Open
CobaltTheProtogen opened this issue Sep 29, 2024 · 0 comments
Open

Add PlayerEvent.ItemSmithingEvent please. #1569

CobaltTheProtogen opened this issue Sep 29, 2024 · 0 comments
Labels
enhancement New (or improvement to existing) feature or request

Comments

@CobaltTheProtogen
Copy link

CobaltTheProtogen commented Sep 29, 2024

It would work exactly like the ItemCraftedEvent, but for Smithing tables. Suppose I wanted to check for a condition where the Player has to make a Netherite Pickaxe to enter a certain dimension. I could do that if the item was Crafted by regular crafting means, however, if I go to do it with the Smithing Table, it doesn't contribute to the ItemCraftedEvent. I feel like adding this Event would make modders lives a lot easier. Examples of the event in action would be:

public class CraftTracker {
    @SubscribeEvent
    public static void onSmithing(PlayerEvent.ItemSmithingEvent event) {
        if (event.getEntity() != null && event.getEntity() instanceof Player) {
            execute(event, event.getEntity(), event.getSmithing);
        }
    }

    public static void execute(Player player, ItemStack craftedItem) {
        execute(null, player, craftedItem);
    }

    private static void execute(@Nullable Event event, Player player, ItemStack craftedItem) {
        if (player == null || craftedItem == null) {
            System.out.println("CraftTracker: Player or crafted item is null.");
            return;
        }
        System.out.println(craftedItem + "has been forged")
    }
}
@CobaltTheProtogen CobaltTheProtogen added the enhancement New (or improvement to existing) feature or request label Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New (or improvement to existing) feature or request
Projects
None yet
Development

No branches or pull requests

1 participant