mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-29 19:51:30 +01:00
#638: Add CreativeCategory API for Materials
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
parent
6b7d2d9a91
commit
7c60ceee2c
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<Attribute, AttributeModifier> getDefaultAttributeModifiers(Material material, EquipmentSlot slot);
|
||||
|
||||
CreativeCategory getCreativeCategory(Material material);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user