From c8e3ef6523cdb1228a12a7bcd7aad9752afba711 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Thu, 26 Aug 2021 17:37:14 +0800 Subject: [PATCH] Add javadocs --- .../registry/ItemPropertiesRegistry.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/me/shedaniel/architectury/registry/ItemPropertiesRegistry.java b/common/src/main/java/me/shedaniel/architectury/registry/ItemPropertiesRegistry.java index cb3863bd..ca8d8469 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/ItemPropertiesRegistry.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/ItemPropertiesRegistry.java @@ -24,7 +24,7 @@ import net.fabricmc.api.Environment; import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.client.renderer.item.ItemPropertyFunction; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; +import net.minecraft.world.level.ItemLike; /** * Registry for registering item properties used for model predicates. @@ -36,12 +36,27 @@ public final class ItemPropertiesRegistry { private ItemPropertiesRegistry() { } + /** + * Registers a generic item property function for all items. + * + * @param propertyId the id of the property + * @param function the function to be registered + * @return the function registered + */ public static ItemPropertyFunction registerGeneric(ResourceLocation propertyId, ItemPropertyFunction function) { return ItemProperties.registerGeneric(propertyId, function); } - public static ItemPropertyFunction register(Item item, ResourceLocation propertyId, ItemPropertyFunction function) { - ItemProperties.register(item, propertyId, function); + /** + * Registers a generic item property function for a specific item. + * + * @param item the item to be registered for + * @param propertyId the id of the property + * @param function the function to be registered + * @return the function registered + */ + public static ItemPropertyFunction register(ItemLike item, ResourceLocation propertyId, ItemPropertyFunction function) { + ItemProperties.register(item.asItem(), propertyId, function); return function; } }