Skip to content

Commit

Permalink
add supplier overload for item properties event
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Feb 28, 2024
1 parent ddbfa0e commit 1b25e6e
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;

import java.util.function.Supplier;

@SuppressWarnings("deprecation")
public interface RegisterItemPropertiesEvent {

Expand All @@ -18,6 +20,10 @@ default void registerCustomModelData(ItemPropertyFunction property) {
ItemProperties.registerCustomModelData(property);
}

default <T extends Item> void register(Supplier<T> item, ResourceLocation id, ClampedItemPropertyFunction property) {
register(item.get(), id, property);
}

default void register(Item item, ResourceLocation id, ClampedItemPropertyFunction property) {
ItemProperties.register(item, id, property);
}
Expand Down

0 comments on commit 1b25e6e

Please sign in to comment.