diff --git a/paper-api/src/main/java/org/bukkit/Material.java b/paper-api/src/main/java/org/bukkit/Material.java index 89f593cd3..df3f24066 100644 --- a/paper-api/src/main/java/org/bukkit/Material.java +++ b/paper-api/src/main/java/org/bukkit/Material.java @@ -94,6 +94,7 @@ import org.bukkit.block.data.type.TripwireHook; import org.bukkit.block.data.type.TurtleEgg; import org.bukkit.block.data.type.Wall; import org.bukkit.block.data.type.WallSign; +import org.bukkit.inventory.CreativeCategory; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.material.MaterialData; import org.jetbrains.annotations.NotNull; @@ -9780,4 +9781,15 @@ public enum Material implements Keyed { return Bukkit.getUnsafe().getDefaultAttributeModifiers(this, slot); } + + /** + * Get the {@link CreativeCategory} to which this material belongs. + * + * @return the creative category. null if does not belong to a category + */ + @Nullable + public CreativeCategory getCreativeCategory() { + return Bukkit.getUnsafe().getCreativeCategory(this); + } + } diff --git a/paper-api/src/main/java/org/bukkit/UnsafeValues.java b/paper-api/src/main/java/org/bukkit/UnsafeValues.java index 9ccef14c8..01e11f882 100644 --- a/paper-api/src/main/java/org/bukkit/UnsafeValues.java +++ b/paper-api/src/main/java/org/bukkit/UnsafeValues.java @@ -5,6 +5,7 @@ import org.bukkit.advancement.Advancement; import org.bukkit.attribute.Attribute; import org.bukkit.attribute.AttributeModifier; import org.bukkit.block.data.BlockData; +import org.bukkit.inventory.CreativeCategory; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; @@ -75,4 +76,6 @@ public interface UnsafeValues { boolean removeAdvancement(NamespacedKey key); Multimap getDefaultAttributeModifiers(Material material, EquipmentSlot slot); + + CreativeCategory getCreativeCategory(Material material); } diff --git a/paper-api/src/main/java/org/bukkit/inventory/CreativeCategory.java b/paper-api/src/main/java/org/bukkit/inventory/CreativeCategory.java new file mode 100644 index 000000000..5bd252c0a --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/inventory/CreativeCategory.java @@ -0,0 +1,53 @@ +package org.bukkit.inventory; + +/** + * Represents a category in the creative inventory. + */ +public enum CreativeCategory { + + /** + * An assortment of building blocks including dirt, bricks, planks, ores + * slabs, etc. + */ + BUILDING_BLOCKS, + /** + * Blocks and items typically used for decorative purposes including + * candles, saplings, flora, fauna, fences, walls, carpets, etc. + */ + DECORATIONS, + /** + * Blocks used and associated with redstone contraptions including buttons, + * levers, pressure plates, redstone components, pistons, etc. + */ + REDSTONE, + /** + * Items pertaining to transportation including minecarts, rails, boats, + * elytra, etc. + */ + TRANSPORTATION, + /** + * Miscellaneous items and blocks that do not fit into other categories + * including gems, dyes, spawn eggs, discs, banner patterns, etc. + */ + MISC, + /** + * Food items consumable by the player including meats, berries, edible + * drops from creatures, etc. + */ + FOOD, + /** + * Equipment items meant for general utility including pickaxes, axes, hoes, + * flint and steel, and useful enchantment books for said tools. + */ + TOOLS, + /** + * Equipment items meant for combat including armor, swords, bows, tipped + * arrows, and useful enchantment books for said equipment. + */ + COMBAT, + /** + * All items related to brewing and potions including all types of potions, + * their variants, and ingredients to brew them. + */ + BREWING; +}