### Initialize Curios Config Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Fabric-Users Start with an empty 'curios' object in your `curios.json5` file to define new slots. ```json "curios": { } ``` -------------------------------- ### Configure Custom Curio Slots Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Users Examples of defining single and multiple custom slots in the curios-server.toml file. ```toml [[curiosSettings]] identifier = "eggs" ``` ```toml [[curiosSettings]] identifier = "eggs" [[curiosSettings]] identifier = "someotherslot" ``` -------------------------------- ### Example Command: Kill players with specific curio Source: https://github.com/theillusivec4/curios/wiki/Commands Kills all players who possess a 'minecraft:glass_bottle' within a 'ring' slot in their curios inventory. This demonstrates combining item and slot selectors. ```minecraft-commands /kill @a[curios={item:{id:"minecraft:glass_bottle"},slot:["ring"]}] ``` -------------------------------- ### Define a Single Ring Slot Type Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Fabric-Users Example of defining a custom 'ring' slot type with specific properties like size, icon, priority, and visibility. Ensure the icon path is correct for your resource pack. ```json { "ring": { "size": 2, "icon": "curios:item/empty_ring_slot", "priority": 160, "locked": false, "visible": true, "hasCosmetic": false, "override": false } } ``` -------------------------------- ### Item Tag for Curio Classification Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Fabric-Users Example of an item tag file used to classify items belonging to the 'ring' curio type. The tag file must be named after the curio identifier and placed in the correct directory structure within a data pack. ```json { "replace": false, "values": [ "curios:ring" ] } ``` -------------------------------- ### Get Curio Predicate Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Retrieve a registered curio predicate using its ResourceLocation. ```java Predicate predicate = CuriosApi.getCurioPredicate(new ResourceLocation("curios", "my_curio_predicate")); ``` -------------------------------- ### Define Initial Curios Settings Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Users The initial state of the curios-server.toml file before adding custom slots. ```toml `curiosSettings = []` ``` -------------------------------- ### Curios Commands Source: https://github.com/theillusivec4/curios/wiki/Commands Commands for managing player curios. ```APIDOC ## Curios Commands ### `set ` #### Description Sets a number of slots of a certain curio type to a player. ### `add ` #### Description Adds a number of slots of a certain curio type to a player. ### `remove ` #### Description Removes a number of slots of a certain curio type from a player. ### `clear [slot]` #### Description Clears all curio contents for a player. The slots will remain, but their contents will be empty. ### `reset ` #### Description Resets player curios to default. The contents will be empty, and the slots will return to their default settings. ### `unlock` (Pre-1.17) #### Description Enables a curio type for a player. ### `lock` (Pre-1.17) #### Description Disables a curio type for a player. ### `enable` (Pre-1.16) #### Description Enables a curio type for a player. ### `disable` (Pre-1.16) #### Description Disables a curio type for a player. ``` -------------------------------- ### Implement ICurioItem for Custom Accessories Source: https://context7.com/theillusivec4/curios/llms.txt Implement ICurioItem on an Item class to enable curio functionality, including tick logic, equip events, and attribute modifiers. ```java import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.resources.Identifier; import top.theillusivec4.curios.api.CurioAttributeModifiers; import top.theillusivec4.curios.api.SlotContext; import top.theillusivec4.curios.api.type.capability.ICurioItem; public class MagicRingItem extends Item implements ICurioItem { public MagicRingItem(Properties properties) { super(properties); } @Override public void curioTick(SlotContext slotContext, ItemStack stack) { // Called every tick while equipped if (!slotContext.entity().level().isClientSide()) { // Server-side logic here } } @Override public void onEquip(SlotContext slotContext, ItemStack prevStack, ItemStack stack) { // Called when the item is equipped slotContext.entity().heal(2.0f); } @Override public void onUnequip(SlotContext slotContext, ItemStack newStack, ItemStack stack) { // Called when the item is unequipped } @Override public boolean canEquip(SlotContext slotContext, ItemStack stack) { // Determine if item can be equipped in this slot return slotContext.identifier().equals("ring"); } @Override public boolean canEquipFromUse(SlotContext slotContext, ItemStack stack) { // Allow right-click to auto-equip return true; } @Override public CurioAttributeModifiers getDefaultCurioAttributeModifiers(ItemStack stack) { // Add attribute modifiers when equipped return CurioAttributeModifiers.builder() .addModifier(Attributes.MAX_HEALTH, new AttributeModifier( Identifier.fromNamespaceAndPath("mymod", "ring_health"), 4.0, // +4 max health AttributeModifier.Operation.ADD_VALUE ), "ring") // Only active in ring slots .build(); } } ``` -------------------------------- ### Custom Curio Renderer with Full Control Source: https://context7.com/theillusivec4/curios/llms.txt Implement the base ICurioRenderer interface for complete control over rendering, including custom transformations. Use setupHumanoidAnimations for standard humanoid animations and apply transformations like translation, rotation, and scaling as needed. ```java import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.world.item.ItemDisplayContext; import top.theillusivec4.curios.api.client.ICurioRenderer; public class FloatingCurioRenderer implements ICurioRenderer { @Override public > void render( ItemStack stack, SlotContext slotContext, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int packedLight, S renderState, RenderLayerParent renderLayerParent, EntityRendererProvider.Context context, float yRotation, float xRotation) { // Apply humanoid animations first ICurioRenderer.setupHumanoidAnimations(renderLayerParent.getModel(), renderState); poseStack.pushPose(); // Position above the entity's head poseStack.translate(0.0, -0.5, 0.0); // Rotate based on game time for floating effect float rotation = (System.currentTimeMillis() % 3600) / 10.0f; poseStack.mulPose(Axis.YP.rotationDegrees(rotation)); // Scale down poseStack.scale(0.5f, 0.5f, 0.5f); // Render the item ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); // Use submitNodeCollector for modern rendering poseStack.popPose(); } } ``` -------------------------------- ### Add /curios list Command Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Lists all registered curio slots and the mods they originate from. Useful for debugging and understanding slot configurations. ```java /curios list ``` -------------------------------- ### Add ICurio#canWalkOnPowderedSnow Method Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Implement this method in your curio implementations to allow walking on Powdered Snow blocks. Requires bconlon's contribution. ```java public interface ICurio { // ... other methods /** * @param stack The curio item stack * @param world The world * @param entity The entity wearing the curio * @return true if the curio allows walking on powdered snow */ default boolean canWalkOnPowderedSnow(ItemStack stack, Level world, Entity entity) { return false; } } ``` -------------------------------- ### Listen to Curio Events Source: https://context7.com/theillusivec4/curios/llms.txt Subscribe to NeoForge events to react to curio changes, control equip/unequip behavior, and modify drop rules. This class demonstrates how to register an event handler and implement various event callbacks. ```java import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.neoforge.common.NeoForge; import net.minecraft.util.TriState; import top.theillusivec4.curios.api.event.*; public class CurioEventHandler { public static void register() { NeoForge.EVENT_BUS.register(new CurioEventHandler()); } @SubscribeEvent public void onCurioChange(CurioChangeEvent.Item event) { // Fired when the curio item changes (different item) ItemStack from = event.getFrom(); ItemStack to = event.getTo(); SlotContext ctx = event.getSlotContext(); System.out.println("Curio changed in " + ctx.identifier() + " from " + from + " to " + to); } @SubscribeEvent public void onCurioStateChange(CurioChangeEvent.State event) { // Fired when the same item's state changes (count, components) System.out.println("Curio state changed in " + event.getSlotContext().identifier()); } @SubscribeEvent public void onCanEquip(CurioCanEquipEvent event) { // Control whether an item can be equipped ItemStack stack = event.getStack(); SlotContext ctx = event.getSlotContext(); // Prevent cursed items from being equipped if (stack.isEnchanted() && hasCurse(stack)) { event.setEquipResult(TriState.FALSE); } // Force-allow specific items if (stack.getItem() == Items.NETHER_STAR) { event.setEquipResult(TriState.TRUE); } } @SubscribeEvent public void onCanUnequip(CurioCanUnequipEvent event) { // Control whether an item can be unequipped if (event.getStack().getItem() == ModItems.CURSED_RING.get()) { // Prevent removal unless player is creative if (!event.getEntity().isCreative()) { event.setUnequipResult(TriState.FALSE); } } } @SubscribeEvent public void onDropRules(DropRulesEvent event) { // Modify drop rules globally for all curios event.addOverride(stack -> stack.getItem() == Items.TOTEM_OF_UNDYING, DropRule.ALWAYS_KEEP); } @SubscribeEvent public void onCurioDrops(CurioDropsEvent event) { // Modify the actual drops from curios on death Collection drops = event.getDrops(); // Filter or modify drops as needed } } ``` -------------------------------- ### Curios Initial Release Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Details the initial beta release of the Curios API. ```APIDOC ## [0.1] - 2019.02.24 Initial beta release ``` -------------------------------- ### Register a Curio Renderer Source: https://github.com/theillusivec4/curios/wiki/1.16.5-to-1.17-and-1.18:-Updates-and-Changes Register a renderer implementation for a specific item within the FMLClientSetupEvent. ```java private void clientSetup(final FMLClientSetupEvent evt) { CuriosRendererRegistry.register(item, () -> new CurioRenderer()); } ``` -------------------------------- ### Registering IRenderableCurio for Client-Side Rendering Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Fabric-Developers Attach IRenderableCurio to enable rendering for curios. Ensure this is only initialized on the client as it may access client-only classes. ```java ItemComponentCallbackV2.event(/*your item*/).register( ((item, itemStack, componentContainer) -> componentContainer .put(CuriosComponent.ITEM_RENDER, new IRenderableCurio() { //// Your implementation })))); ``` -------------------------------- ### Add ICuriosHelper Methods Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Utilize ICuriosHelper for programmatic interaction with curio slots. Use `setEquippedCurio` to place items and `findCurio` to retrieve them. ```java public interface ICuriosHelper { // ... other methods /** * Sets an item into a player's curio slot. * @param player The player wearing the curio. * @param slot The slot to set. * @param stack The item stack to set. * @return true if the item was successfully set. */ boolean setEquippedCurio(Player player, String slot, ItemStack stack); /** * Finds an item in a player's curio slots. * @param player The player to search within. * @param slot The slot to search in. * @return The item stack found in the slot, or an empty stack if not found. */ ItemStack findCurio(Player player, String slot); } ``` -------------------------------- ### Add /curios replace Command Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Use this command to set items into a player's curio slots. Specify the slot, index, player, item, and optionally the count. ```java /curios replace with [count] ``` -------------------------------- ### Assign Items to Slot Types using Item Tags Source: https://context7.com/theillusivec4/curios/llms.txt Use vanilla item tags to assign items to slot types. Create tag files at `data/curios/tags/item/.json`. ```json { "replace": false, "values": [ "mymod:magic_ring", "mymod:golden_ring", "#mymod:all_rings", { "id": "othermod:special_ring", "required": false } ] } ``` -------------------------------- ### Define Multiple Slot Types Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Fabric-Users Illustrates how to define multiple custom slot types (e.g., 'ring', 'head', 'hands') within the same `curios.json` configuration file by adding them as separate entries. ```json { "ring": {...}, "head": {...}, "hands": {...} } ``` -------------------------------- ### Registering a Curio to an Existing Item Source: https://context7.com/theillusivec4/curios/llms.txt Use this method to add curio functionality to items that do not natively implement ICurioItem. Requires the Curios API and an instance of ICurioItem to define behavior. ```java import net.minecraft.world.item.Items; import net.minecraft.world.item.ItemStack; import top.theillusivec4.curios.api.CuriosApi; import top.theillusivec4.curios.api.SlotContext; import top.theillusivec4.curios.api.type.capability.ICurioItem; import top.theillusivec4.curios.api.common.DropRule; public class ModSetup { public static void registerCurios() { // Register a compass as a curio that can go in charm slots CuriosApi.registerCurio(Items.COMPASS, new ICurioItem() { @Override public void curioTick(SlotContext slotContext, ItemStack stack) { // Custom tick behavior } @Override public DropRule getDropRule(SlotContext slotContext, DamageSource source, boolean recentlyHit, ItemStack stack) { // Keep the compass on death return DropRule.ALWAYS_KEEP; } @Override public int getFortuneLevel(SlotContext slotContext, LootContext lootContext, ItemStack stack) { // Compass provides +1 fortune when equipped return 1; } }); } } ``` -------------------------------- ### Curios Commands Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Overview of the administrative and utility commands provided by the Curios mod. ```APIDOC ## /curios drop ### Description Drops curio items from the player's slots. ## /curios replace with [count] ### Description Sets a specific item into a designated curio slot for a player. ## /curios list ### Description Lists all registered curio slots and the mods they originate from. ``` -------------------------------- ### Add Curios Dependency to build.gradle Source: https://github.com/theillusivec4/curios/blob/1.21.x/README.md Include the Curios API and runtime dependencies in your project's build.gradle file. Replace ${version} with the desired Curios version. ```gradle repositories { maven { name = "Curios" url = uri("https://maven.theillusivec4.top/") } } dependencies { runtimeOnly "top.theillusivec4.curios:curios-neoforge:${version}" compileOnly "top.theillusivec4.curios:curios-neoforge:${version}:api" } ``` -------------------------------- ### Curios API - Helper Methods and Commands Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Information on new helper methods for item handling and new commands for managing curios, introduced in version 4.1.0.0. ```APIDOC ## API Additions and Commands in Curios v4.1.0.0 ### Description This section covers new API functionalities for interacting with Curios items and new in-game commands for managing them. ### Added - **SlotModifiersUpdatedEvent**: An event to listen for dynamic changes to player slot sizes caused by slot modifiers. - **ICuriosHelper#setEquippedCurio and ICuriosHelper#findCurio()**: Methods for setting items into curio slots and retrieving items from them. - **New Commands**: - `/curios drop`: Drops curio items from slots. - `/curios list`: Lists curio slots and their origins. - `/curios replace`: Sets curio items into specified slots. - **curios:set_curio_attributes**: A new loot function for setting curio attributes. ### Related Issues - None explicitly mentioned for these additions in the provided text. ``` -------------------------------- ### Implement ICurioRenderer for Humanoid Entities Source: https://context7.com/theillusivec4/curios/llms.txt Implement ICurioRenderer.HumanoidRender to render curio items on humanoid entities. Register renderers during the EntityRenderersEvent.AddLayers event. Ensure the model and texture are correctly initialized. ```java import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.state.HumanoidRenderState; import net.minecraft.client.renderer.SubmitNodeCollector; import net.minecraft.resources.Identifier; import net.minecraft.world.item.ItemStack; import top.theillusivec4.curios.api.SlotContext; import top.theillusivec4.curios.api.client.ICurioRenderer; public class RingRenderer implements ICurioRenderer.HumanoidRender { private final HumanoidModel model; private final Identifier texture; public RingRenderer(HumanoidModel model) { this.model = model; this.texture = Identifier.fromNamespaceAndPath("mymod", "textures/entity/ring.png"); } @Override public EntityModel getModel(ItemStack stack, SlotContext slotContext) { return (EntityModel) this.model; } @Override public Identifier getModelTexture(ItemStack stack, SlotContext slotContext) { return this.texture; } // Register during EntityRenderersEvent.AddLayers public static void registerRenderers() { ICurioRenderer.register(ModItems.MAGIC_RING.get(), () -> { // Create model here - this is called during AddLayers event return new RingRenderer(new HumanoidModel<>( Minecraft.getInstance().getEntityModels() .bakeLayer(ModelLayers.PLAYER_INNER_ARMOR) )); }); } } ``` -------------------------------- ### Empty Curios Configuration Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Fabric-Users An empty JSON object representing the initial state of the `curios.json` file before any custom slot types are defined. ```json {} ``` -------------------------------- ### Query Slot Types and Properties in Java Source: https://context7.com/theillusivec4/curios/llms.txt Programmatically access registered slot types and their properties to check availability or iterate over configured slots. Requires importing necessary Curios API classes. ```java import top.theillusivec4.curios.api.CuriosSlotTypes; import top.theillusivec4.curios.api.type.ISlotType; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.ItemStack; public class SlotTypeQueries { public static void querySlotTypes() { // Get a specific slot type ISlotType ringSlot = CuriosSlotTypes.getSlotType("ring"); if (ringSlot != null) { int defaultSize = ringSlot.getSize(); int order = ringSlot.getOrder(); boolean hasCosmetic = ringSlot.hasCosmetic(); DropRule dropRule = ringSlot.getDropRule(); } // Get all registered slot types Map allSlots = CuriosSlotTypes.getSlotTypes(); // Get slots available to players by default Map playerSlots = CuriosSlotTypes.getDefaultPlayerSlotTypes(false); // false = server side // Get slots for a specific entity type Map villagerSlots = CuriosSlotTypes.getDefaultEntitySlotTypes(EntityType.VILLAGER, false); // Get valid slot types for an item ItemStack stack = new ItemStack(Items.DIAMOND); Map validSlots = CuriosSlotTypes.getItemSlotTypes(stack, false); } } ``` -------------------------------- ### Create pack.mcmeta for Data Pack Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Users The required metadata file for a Minecraft data pack. ```json { "pack": { "pack_format": 4, "description": "put a description here, or not" } } ``` -------------------------------- ### Curios Server Commands Source: https://context7.com/theillusivec4/curios/llms.txt Manage player curio slots using server commands. Commands include setting, adding, removing, clearing, and resetting slots for specific players and curio types. ```bash # Set a specific number of slots /curios set @p ring 4 ``` ```bash # Add slots to existing count /curios add @p necklace 2 ``` ```bash # Remove slots /curios remove @p charm 1 ``` ```bash # Clear all curio contents (slots remain, items removed) /curios clear @p /curios clear @p ring ``` ```bash # Reset to default slots (removes custom slot modifications) /curios reset @p ``` -------------------------------- ### Register Multiple Curio Slot Types Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Users Add multiple slot configurations to the curios-server.toml file by repeating the [[curiosSettings]] block. ```toml [[curiosSettings]] identifier = "ring" size = 2 [[curiosSettings]] identifier = "charm" [[curiosSettings]] identifier = "necklace" ``` -------------------------------- ### Assign Entity Slots via JSON Source: https://context7.com/theillusivec4/curios/llms.txt Assign slot types to entities using JSON files at `data//curios/entities/.json`. Multiple files can target the same entity. ```json { "entities": [ "minecraft:player", "minecraft:armor_stand" ], "slots": [ "ring", "necklace", { "id": "charm", "size": 3, "operation": "SET", "conditions": [ { "type": "neoforge:mod_loaded", "modid": "charm_mod" } ] } ] } ``` -------------------------------- ### Register Curio Item Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Register a curio item using CuriosApi#registerCurio or by implementing ICurioItem on the item itself. Forge no longer supports stack capabilities for curios. ```java CuriosApi.registerCurio(new ResourceLocation("mymod", "my_curio_item"), myItem); // or implement ICurioItem on your Item class ``` -------------------------------- ### Configure Slot Icon in TOML Source: https://github.com/theillusivec4/curios/wiki/Slot-Textures Define a custom slot icon within the curios-server.toml configuration file using the identifier and icon path. ```toml [[curiosSettings]] identifier = "custom" icon = "curios:slot/image_name" ``` -------------------------------- ### Define Curio Item Tags Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Users JSON tag files used to associate items with specific Curio slots. The filename must match the identifier defined in the configuration. ```json { "replace": "false", "values": [] } ``` ```json { "replace": "false", "values": ["minecraft:egg"] } ``` ```json { "replace": "false", "values": ["minecraft:egg", "minecraft:someotheritem"] } ``` -------------------------------- ### Add Curios Dependency to Gradle Source: https://context7.com/theillusivec4/curios/llms.txt Include the Curios repository and dependencies in your build.gradle file to access the API. ```groovy repositories { maven { name = "Curios" url = uri("https://maven.theillusivec4.top/") } } dependencies { runtimeOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}" compileOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}:api" } ``` -------------------------------- ### Assign Items to a Curio Slot Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Fabric-Users Populate the 'values' array in the item tag file with the registry names of items that should be accepted by the curio slot. ```json { "replace": "false", "values": ["minecraft:egg"] } ``` -------------------------------- ### Check if an Item is Equipped Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Use ICuriosItemHandler#isEquipped to check if a specific item or an item matching a predicate is currently equipped. ```java ICuriosItemHandler curiosHandler = ...; // Check for a specific item boolean isSpecificItemEquipped = curiosHandler.isEquipped(Items.DIAMOND_SWORD); // Check for an item matching a predicate boolean isMatchingItemEquipped = curiosHandler.isEquipped(itemStack -> itemStack.getItem() == Items.IRON_SWORD && itemStack.getCount() > 1); ``` -------------------------------- ### Assign Multiple Items to a Curio Slot Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Fabric-Users List multiple item registry names, separated by commas, within the 'values' array to allow several different items in the same slot. ```json { "replace": "false", "values": ["minecraft:egg", "minecraft:someotheritem"] } ``` -------------------------------- ### Register Curio Component Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Fabric-Developers Attach a component to an item using the Cardinal Components API to enable custom behavior like ticking or attributes. ```java ItemComponentCallbackV2.event(/*your item*/).register( ((item, itemStack, componentContainer) -> componentContainer .put(CuriosComponent.ITEM, new ICurio() { //// Your implementation }))); ``` -------------------------------- ### Curios API - Core Item Handling Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Information on core API changes related to `ICurio` and `ICurioItem` interfaces, including new methods and deprecations in version 5.0.0.0. ```APIDOC ## API Changes in Curios v5.0.0.0 ### Description This section outlines significant changes to the core `ICurio` and `ICurioItem` interfaces, including new methods, a new rendering system, and deprecated functionalities. ### Added - **`getStack` method to `ICurio`**: A new method for retrieving the item stack associated with a Curio. - **Slot Context-Sensitive Methods**: New methods in `ICurio` and `ICurioItem` that consider slot context. - **New Rendering System**: A revamped rendering system. Refer to the [GitHub wiki](https://github.com/TheIllusiveC4/Curios/wiki/1.16.5-to-1.17:-Updates-and-Changes#rendering-system) for details. ### Changed - Updated to Minecraft 1.17.1. ### Deprecated - Methods in `ICurio` and `ICurioItem` that do not consider slot contexts. - Slot locking and unlocking states. ### Removed - `render` and `canRender` methods from `ICurio` and `ICurioItem`. - Ring, amulet, crown, and knuckles items. ``` -------------------------------- ### Entity Selector: Curios Index Match Source: https://github.com/theillusivec4/curios/wiki/Commands Matches entities based on the indices within their curios slots. Specify a min/max range for the indices. ```minecraft-commands curios={index:[0,1]} ``` -------------------------------- ### Define Item Tag for Curio Slot Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Fabric-Users Create a JSON file named after your slot identifier to specify which items are allowed in that slot. 'replace: false' adds to existing tags. ```json { "replace": "false", "values": [] } ``` -------------------------------- ### Curios Command: Add Source: https://github.com/theillusivec4/curios/wiki/Commands Adds a specified number of slots of a curio type to a player's inventory. Use this to increase existing curio counts. ```minecraft-commands /curios add ``` -------------------------------- ### Entity Selector with Curios Source: https://context7.com/theillusivec4/curios/llms.txt Target entities based on their equipped curios using the `curios=` entity selector option. This allows for complex targeting based on item ID, slot, and index. ```bash # Kill players with a diamond in any curio slot /kill @a[curios={item:{id:"minecraft:diamond"}}] ``` ```bash # Give effect to players with items in ring slots /effect give @a[curios={slot:["ring"]}] minecraft:strength 60 1 ``` ```bash # Target players with specific item in specific slot /tp @a[curios={item:{id:"minecraft:glass_bottle"},slot:["ring"]}] 0 100 0 ``` ```bash # Target players WITHOUT ring slots (inverted) /say @a[curios=!{slot:["ring"]}] ``` ```bash # Complex selector with index range /kill @a[curios={item:{id:"minecraft:emerald"},slot:["charm"],index:[0,1]}] ``` -------------------------------- ### Curios Command: Enable (Pre-1.16) Source: https://github.com/theillusivec4/curios/wiki/Commands Enables a specific curio type for a player. This command is only available in versions prior to 1.16. ```minecraft-commands (Pre-1.16) /curios enable ``` -------------------------------- ### Triggering on Curio Equip Source: https://github.com/theillusivec4/curios/wiki/Advancement-Triggers Use this criteria to detect when a specific item is equipped into any curio slot. ```json "criteria": { "ring": { "trigger": "curios:equip_curio", "conditions": { "item": { "item": "curios:curious_ring" } } } } ``` -------------------------------- ### Registering a Custom Slot Icon Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Developers Use the TextureStitchEvent.Pre event to register custom slot icons into the texture atlas. ```java evt.addSprite(new ResourceLocation(MODID, "item/empty_curio_slot")); ``` -------------------------------- ### Curios API Additions Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Details API methods added in version 0.2. ```APIDOC ## [0.2] - 2019.02.28 ### Added - [API] Added ICurio#playEquipSound(EntityLivingBase) method ``` -------------------------------- ### Entity Selector Options Source: https://github.com/theillusivec4/curios/wiki/Commands Advanced entity selector options for targeting entities based on their curios. ```APIDOC ## Entity Selector Options Curios 1.16.5-4.0.8.0+ and 1.18.1-5.0.6.0+ introduces a new entity selector option to use with commands that target entities, such as `@a` or `@p`. The option starts with `curios=` and takes in a single `CompoundTag` as an argument. A blank tag would be `curios={}`. ### Tag Format The `CompoundTag` has the following fields: #### `item` * **required**: false * **type**: `CompoundTag` * **description**: Denotes an item to match in the target's curios inventory. * **example**: `curios={item:{id:"minecraft:glass_bottle"}}` will search for a `minecraft:glass_bottle` in the target's curios inventory. #### `slot` * **required**: false * **type**: `string[]` * **description**: Denotes a slot type to search in the target's curios inventory. * **example**: `curios={slot:["ring"]}` will search for `"ring"` slots in the target's curios inventory. #### `index` * **required**: false * **type**: `int[min, max]` * **description**: Denotes the indices in slots to search in the target's curios inventory. * **example**: `curios={index:[0,1]}` will search for the first index of each slot type in the target's curios inventory. #### `exclusive` * **required**: false * **type**: `boolean` * **description**: Denotes whether or not the selector is searching for _only_ one match. * **example**: `curios={slot:["ring"],exclusive:true}` will search for `"ring"` slots in the target's curios inventory but will not return a match if any other slot type is found in the inventory as well. ### Inverting The selector option also supports inverting. Placing a `!` before the `CompoundTag` will invert the search. For example, `curios=!{slot:["ring"]}` will search for targets that do _not_ have `"ring"` slots in their curios inventory. ### Examples Command: `/kill @a[curios={item:{id:"minecraft:glass_bottle"},slot:["ring"]}]` Result: Kills all players who have a `minecraft:glass_bottle` in a `"ring"` slot of the curios inventory. ``` -------------------------------- ### Curios API - Entity Selector and Localization Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Details on the new entity selector option and localization updates in version 4.0.8.0. ```APIDOC ## API Additions and Localization in Curios v4.0.8.0 ### Description This section highlights the addition of a new entity selector option for commands and updates to game localization. ### Added - **New Entity Selector Option**: `curios=`. This allows targeting entities based on their curios. More details can be found on the [wiki](https://github.com/TheIllusiveC4/Curios/wiki/Commands#entity-selector-options). - **Localization**: Added `uk_ua.json` localization. ### Changed - Updated `fr_fr.json` localization (thanks HollishKid!). - Updated `ko_kr.json` localization (thanks PixVoxel!). ``` -------------------------------- ### Curios Entity Selector Option Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Use the `curios=` entity selector option to target entities based on their equipped curios. Refer to the wiki for detailed usage. ```java curios=[:] ``` -------------------------------- ### Create Slot Types with Java Data Generation Source: https://context7.com/theillusivec4/curios/llms.txt Use CuriosDataProvider to programmatically define slot types, their properties, and assign them to entities. This is the recommended method for mods. ```java import net.minecraft.data.PackOutput; import net.minecraft.core.HolderLookup; import net.minecraft.world.entity.EntityType; import top.theillusivec4.curios.api.CuriosDataProvider; import top.theillusivec4.curios.api.common.DropRule; public class ModCuriosDataProvider extends CuriosDataProvider { public ModCuriosDataProvider(String modId, PackOutput output, CompletableFuture registries) { super(modId, output, registries); } @Override public void generate(HolderLookup.Provider registries) { // Create a new "bracelet" slot type createSlot("bracelet") .size(2) // 2 slots by default .order(500) // Display order priority .icon(Identifier.fromNamespaceAndPath("mymod", "textures/gui/bracelet_slot.png")) .dropRule(DropRule.DEFAULT) // Default drop behavior on death .useNativeGui(true) // Show in Curios GUI .addCosmetic(true) // Include cosmetic slot .renderToggle(true) // Allow render toggling .addEntity(EntityType.PLAYER, EntityType.ARMOR_STAND); // Create a slot with custom validators createSlot("amulet") .size(1) .order(100) .addValidator(Identifier.fromNamespaceAndPath("mymod", "is_magical")); // Assign existing slots to entities createEntities("villager_curios") .addPlayer() .addEntities(EntityType.VILLAGER) .addSlots("ring", "necklace", "charm"); // Add items to slot tags tag("bracelet") .add(ModItems.GOLDEN_BRACELET.get()) .add(ModItems.IRON_BRACELET.get()); tag("ring") .addOptional(Identifier.fromNamespaceAndPath("othermod", "magic_ring")); } } ``` -------------------------------- ### Curios Command: Set Source: https://github.com/theillusivec4/curios/wiki/Commands Sets a specific number of slots of a curio type for a player. Ensure the target, slot, and amount are correctly specified. ```minecraft-commands /curios set ``` -------------------------------- ### Access Preset Slot Type IDs in Java Source: https://context7.com/theillusivec4/curios/llms.txt Accesses predefined slot type identifiers for maximum compatibility across mods. Use these constants when creating new slots. ```java import top.theillusivec4.curios.api.CuriosSlotTypes; public class SlotTypeConstants { // Access preset slot type IDs public static final String BACK = CuriosSlotTypes.Preset.BACK.id(); // "back" public static final String BELT = CuriosSlotTypes.Preset.BELT.id(); // "belt" public static final String BODY = CuriosSlotTypes.Preset.BODY.id(); // "body" public static final String BRACELET = CuriosSlotTypes.Preset.BRACELET.id(); // "bracelet" public static final String CHARM = CuriosSlotTypes.Preset.CHARM.id(); // "charm" public static final String CURIO = CuriosSlotTypes.Preset.CURIO.id(); // "curio" (universal) public static final String FEET = CuriosSlotTypes.Preset.FEET.id(); // "feet" public static final String HANDS = CuriosSlotTypes.Preset.HANDS.id(); // "hands" public static final String HEAD = CuriosSlotTypes.Preset.HEAD.id(); // "head" public static final String NECKLACE = CuriosSlotTypes.Preset.NECKLACE.id(); // "necklace" public static final String RING = CuriosSlotTypes.Preset.RING.id(); // "ring" } ``` -------------------------------- ### Register Curio Predicates Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Register custom predicates for curios using CuriosApi#registerCurioPredicates. This allows for more complex validation and identification of curios. ```java CuriosApi.registerCurioPredicates(new ResourceLocation("curios", "my_curio_predicate"), slotResult -> { // Your predicate logic here return true; }); ``` -------------------------------- ### Add /curios drop Command Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Command to drop curio items from a player's inventory. This is useful for removing items from curio slots. ```java /curios drop ``` -------------------------------- ### Entity Selector: Curios Item Match Source: https://github.com/theillusivec4/curios/wiki/Commands Matches entities based on an item in their curios inventory. Requires the item's ID to be specified. ```minecraft-commands curios={item:{id:"minecraft:glass_bottle"}} ``` -------------------------------- ### Serialize Dynamic Stack Handler Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Serialize the NBT data for an IDynamicStackHandler, requiring a HolderLookup.Provider. ```java IDynamicStackHandler stackHandler = ...; HolderLookup.Provider provider = ...; CompoundTag nbt = stackHandler.serializeNbt(provider); ``` -------------------------------- ### Add Multiple Curio Slots Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Fabric-Users You can define multiple curio slots by adding additional entries to the 'curios' object, separated by commas. ```json "curios": { "egg": {...}, "someotherslot": {...} } ``` -------------------------------- ### Define Slot Types via JSON Source: https://context7.com/theillusivec4/curios/llms.txt Define slot types using JSON files located at `data//curios/slots/.json`. This method is suitable for modpacks and mods. ```json { "replace": false, "order": 100, "size": 2, "operation": "SET", "use_native_gui": true, "add_cosmetic": true, "render_toggle": true, "icon": "mymod:textures/gui/custom_slot.png", "drop_rule": "default", "validators": ["curios:tag"], "entities": [ "minecraft:player", "#minecraft:raiders" ] } ``` -------------------------------- ### Register a Custom Curio Slot Type Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Users Define a new slot type in the curios-server.toml file using the identifier property. ```toml [[curiosSettings]] identifier = "ring" ``` -------------------------------- ### Curios API - Slot Modifiers and Events Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Details on the slot modifier system, equip/unequip events, and texture registration added in version 5.0.2.0. ```APIDOC ## API Additions in Curios v5.0.2.0 ### Description This section details the new API features introduced, including the slot modifier system, event hooks for item equipping/unequipping, and a new method for registering slot textures. ### Added - **Slot Modifier System**: A new system for modifying slots. Refer to the [wiki page](https://github.com/TheIllusiveC4/Curios/wiki/Slot-Modifiers) for more information. This system is experimental and may have compatibility issues with older methods. - **CurioEquipEvent and CurioUnequipEvent**: Events that allow modders to intercept and modify the results of equipping or unequipping Curios items. - **Slot Texture Registration**: A new method for registering slot textures. Textures placed in `assets/curios/textures/slot` within mods or resource packs will be automatically processed. - **ICuriosItemHandler#saveInventory and ICuriosItemHandler#loadInventory**: Utility methods for saving and loading the Curios inventory. ### Related Issues - [#178](https://github.com/TheIllusiveC4/Curios/issues/178) - [#174](https://github.com/TheIllusiveC4/Curios/issues/174) - [#145](https://github.com/TheIllusiveC4/Curios/issues/145) - [#164](https://github.com/TheIllusiveC4/Curios/issues/164) ``` -------------------------------- ### Add Curios Dependency to build.gradle Source: https://github.com/theillusivec4/curios/wiki/How-to-Use:-Fabric-Developers Include the Curios repository and dependency in your Fabric project's build configuration. ```gradle repositories { maven { url = "https://maven.theillusivec4.top/" } maven { name = "Ladysnake Libs" url = 'https://dl.bintray.com/ladysnake/libs' } } dependencies { modImplementation "top.theillusivec4.curios:curios-fabric:${version}" } ``` -------------------------------- ### Entity Selector: Curios Slot Match Source: https://github.com/theillusivec4/curios/wiki/Commands Matches entities based on the types of slots present in their curios inventory. Accepts an array of slot type strings. ```minecraft-commands curios={slot:["ring"]} ``` -------------------------------- ### Test Curio Predicates Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Test a set of registered curio predicates against a SlotResult. ```java Set predicateIds = Set.of(new ResourceLocation("curios", "my_curio_predicate")); SlotResult slotResult = ...; boolean allMatch = CuriosApi.testCurioPredicates(predicateIds, slotResult); ``` -------------------------------- ### Curios Command: Clear Source: https://github.com/theillusivec4/curios/wiki/Commands Clears all curio contents for a player, leaving the slots themselves intact but empty. An optional slot argument can clear specific slots. ```minecraft-commands /curios clear [slot] ``` -------------------------------- ### Deserialize Dynamic Stack Handler Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md Deserialize NBT data into an IDynamicStackHandler, requiring a HolderLookup.Provider. ```java IDynamicStackHandler stackHandler = ...; CompoundTag nbt = ...; HolderLookup.Provider provider = ...; stackHandler.deserializeNbt(provider, nbt); ``` -------------------------------- ### Refactor Curio Events to Use TriState Source: https://github.com/theillusivec4/curios/blob/1.21.x/CHANGELOG.md NeoForge's CurioCanEquipEvent and CurioCanUnequipEvent now use the TriState enum for results, replacing previous boolean or similar return types. ```java event.setResult(TriState.TRUE); // Or TriState.FALSE, TriState.DEFAULT ``` -------------------------------- ### Curios Command: Unlock (Pre-1.17) Source: https://github.com/theillusivec4/curios/wiki/Commands Enables a specific curio type for a player. This command is only available in versions prior to 1.17. ```minecraft-commands (Pre-1.17) /curios unlock ``` -------------------------------- ### Accessing Entity Curios Inventory Source: https://context7.com/theillusivec4/curios/llms.txt Interact with the curios inventory capability on living entities to check, find, or modify equipped items. Access is provided via the CuriosApi.getCuriosInventory method. ```java import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Items; import net.minecraft.world.item.ItemStack; import top.theillusivec4.curios.api.CuriosApi; import top.theillusivec4.curios.api.SlotResult; import top.theillusivec4.curios.api.type.capability.ICuriosItemHandler; public class CuriosInventoryExample { public static void accessCuriosInventory(Player player) { // Get the curios inventory handler CuriosApi.getCuriosInventory(player).ifPresent(handler -> { // Check if a specific item is equipped if (handler.isEquipped(Items.DIAMOND)) { System.out.println("Player has a diamond equipped!"); } // Find first curio matching a predicate handler.findFirstCurio(stack -> stack.getItem() == Items.EMERALD) .ifPresent(result -> { SlotContext ctx = result.slotContext(); System.out.println("Found emerald in slot: " + ctx.identifier() + " at index " + ctx.index()); }); // Find all curios in specific slot types List rings = handler.findCurios("ring", "necklace"); for (SlotResult result : rings) { ItemStack stack = result.stack(); System.out.println("Found: " + stack.getDisplayName().getString()); } // Get curio at specific slot and index handler.findCurio("ring", 0).ifPresent(result -> { ItemStack ringStack = result.stack(); // Work with the ring }); // Set a curio in a specific slot handler.setEquippedCurio("belt", 0, new ItemStack(Items.LEATHER)); // Get total number of curio slots int totalSlots = handler.getSlots(); // Get Fortune/Looting bonuses from all equipped curios int fortuneBonus = handler.getFortuneLevel(null); int lootingBonus = handler.getLootingLevel(null); }); } } ``` -------------------------------- ### Entity Selector: Inverted Curios Slot Match Source: https://github.com/theillusivec4/curios/wiki/Commands Matches entities that do NOT have the specified slot types in their curios inventory. The '!' inverts the search condition. ```minecraft-commands curios=!{slot:["ring"]} ```