NeoForge
NeoForge copied to clipboard
Add PlayerEvent.ItemSmithingEvent please.
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")
}
}