How do I make a curios item using the API?

Started by DerexXD on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make a curios item using the API?

I need someone to help me make a simple artifact using the curios API. Someone here made a plugin for it but I'm not sure where to go after installing it.

 

For reference, curios is the widely used API that allows you to put rings and stuff on you in inventory slots. You find it in many modpacks. 

Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hello Thank you Bounccake, i…
Mon, 09/06/2021 - 13:52

Hello

Thank you Bounccake, i managed to do it thanks to you.

I had some troubles making it work so i'll add details:

First of all, i use MCreator 2021.2 with 1.16.5 generator.

1] Curios as a dependency:

a. Go to https://mcreator.net/plugin/65444/more-apis-support and download the api
b. In MCreator go to File > Preferences > Manage plugins
c. Click on Load plugin... and select the zip you just downloaded
d. "More Apis plugin" should now appears on the list and says in green text "loaded: yes"
e. Click on "Save" and restart MCreator

Now, i saw in another post that you can add Curios as a dependency with these steps:

7. now in the mod go to Workspace/Workspace Settings
8. under External APIs click the check box for Curios
9. click save changes and wait for Gradle to finish its thing

cf: https://mcreator.net/forum/69321/info-curios

But it didn't work for me as the Curios checkbox never showed up.

Here is how I did it:

f. Click on the "Workspace" menu, then Open workspace folder
g. edit build.gradle file
You should add these lines after the minecraft { [whatever] } block :

repositories {
    maven {
        url = "https://maven.theillusivec4.top/"
    }
}

 and add these two lines in the dependencies group (replace ${curios_version} with the version of curios you use in your modpack, e.g. 1.16.5-4.0.5.2)

runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}")
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api")

Finally your build.gradle file should look like this:
 

buildscript {
    repositories {
        maven { url = 'https://maven.minecraftforge.net' }
        mavenCentral()
    }
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
    }
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'

version = '1.0'
group = 'com.yourname.modid'
archivesBaseName = 'modid'

java.toolchain.languageVersion = JavaLanguageVersion.of(8)

minecraft {
    [some uninteresting stuff]
}

repositories {
    maven {
        url = "https://maven.theillusivec4.top/"
    }
}

dependencies {
    minecraft 'net.minecraftforge:forge:1.16.5-36.2.0'
    runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.16.5-4.0.5.2")
    compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.16.5-4.0.5.2:api")
}

apply from: 'mcreator.gradle'

Save the file and restart MCreator now.

2] Add the compatibility code into your mod

a. In your workspace, add a new element by clicking the green "+" button
b. select the "custom element", I called it "CuriosRingEmplacement"
c. add these lines at the top of the file, after the the "package net.mcreator.yourmodname" line :

import top.theillusivec4.curios.api.CuriosApi;
import net.minecraftforge.fml.InterModComms;
import top.theillusivec4.curios.api.SlotTypeMessage;
import top.theillusivec4.curios.api.SlotTypePreset;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;

d. then add these between the main element class (public ElementName() {}) and the first @SubscribeEvent line

private void enqueue(final InterModEnqueueEvent evt) {
	InterModComms.sendTo(CuriosApi.MODID, SlotTypeMessage.REGISTER_TYPE,
    	() -> SlotTypePreset.RING.getMessageBuilder().build());
}

You can replace RING by any of these:
CURIO / BACK / BELT / BODY / CHARM / HEAD  / HANDS / NECKLACE

in the end, your file should look like this:
 

package net.mcreator.curiostrinkets;

import top.theillusivec4.curios.api.CuriosApi;
import net.minecraftforge.fml.InterModComms;
import top.theillusivec4.curios.api.SlotTypeMessage;
import top.theillusivec4.curios.api.SlotTypePreset;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;

import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.world.BiomeLoadingEvent;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class CuriosRingEmplacement {
	public CuriosRingEmplacement() {
	}

	private void enqueue(final InterModEnqueueEvent evt) {
		InterModComms.sendTo(CuriosApi.MODID, SlotTypeMessage.REGISTER_TYPE,
	    	() -> SlotTypePreset.RING.getMessageBuilder().build());
  	}

	@SubscribeEvent
	public static void init(FMLCommonSetupEvent event) {
		new CuriosRingEmplacement();
	}
	
	@Mod.EventBusSubscriber
	private static class ForgeBusEvents {
		// Example Forge bus event registration
		@SubscribeEvent
		public static void addFeatureToBiomes(BiomeLoadingEvent event) {
		}
		
		@SubscribeEvent
		public static void serverLoad(FMLServerStartingEvent event) {
		}

		@OnlyIn(Dist.CLIENT)
		@SubscribeEvent
		public static void clientLoad(FMLClientSetupEvent event) {
		}
	}
}

 

I repeated this for each emplacement I used in my mod, but maybe you can do it in a single file with something like this:

private void enqueue(final InterModEnqueueEvent evt) {
	InterModComms.sendTo(CuriosApi.MODID, SlotTypeMessage.REGISTER_TYPE,
    	() -> SlotTypePreset.RING.getMessageBuilder().build());
    InterModComms.sendTo(CuriosApi.MODID, SlotTypeMessage.REGISTER_TYPE,
    	() -> SlotTypePreset.CHARM.getMessageBuilder().build());
    InterModComms.sendTo(CuriosApi.MODID, SlotTypeMessage.REGISTER_TYPE,
    	() -> SlotTypePreset.NECKLACE.getMessageBuilder().build());
}

But I didn't try it.
 

3. add your item as a curios

Go back to your workspace folder, then go to (create folders that don't exist):
[yourmodname]/src/main/resources/data/curios/tags/items

Create the file ring.json (or charm.json, necklace.json ...)
and add these:

{
	"replace": "false",
	"values": ["yourmodname:item_name1", "yourmodname:item_name2", "yourmodname:item_name3"]
}

and Voilà !

Everything should work fine now

Well I still have some trouble I'll list here:

1) curios mod doesn't work correctly in the test runtime environement, i'm unable to place my items in the curios emplacement because they just don't show up. But if I export the mod and use it in a real environment, everything works fine.

2) in MCreator procedures, I can find a "Curios API" category where i can find two functions: "is Curio item [item] equipped" and "Get item in curio slot type [type] and slot number [number] for [entity]"
These don't work at all, I have an error that says "block [is_curio_itemstack_equipped] is not supported by the selected generator". I think this isn't available for 1.16.5, so I have to make my items work in the inventory and not while equipped. I Hope this will be fixed in future Library version.

 

Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I believe we are missing…
Sun, 09/26/2021 - 21:22

I believe we are missing something, I created a blank mod pack with just the two mods and the UI still does not show so we are registering the item fine but we are not triggering the UI to show so this isn't a MCreators runtime problem, we seem to be missing a trigger for the Curios API to right the config for it or how ever it's meant to be triggered.

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Same for me, MissLexyShadows…
Thu, 02/24/2022 - 23:00

Same for me, MissLexyShadows. Also when I try to go to src/main/resources/data/curios/tags/items in the workspace folder, I can't find the curios folder. When I try altering the build.gradle file, mcreator goes haywire. But I can still see the curios icon in my survival inventory when I run the client.

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Okay now, it's giving me…
Fri, 02/25/2022 - 21:31

Okay now, it's giving me this error when I try to run the client or build: 

public class CuriosAccessoryCode {
          ^
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
1 actionable task: 1 executed

Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi Astah! My curios won't…
Sun, 09/25/2022 - 23:32

Hi Astah! My curios won't appear in my inventory, but it seems like other mods are working. I don't even see the slot. Have you run into a similar issue when running it in a separate environment (outside of MCreator)

Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
FAILURE: Build failed with…
Sun, 09/25/2022 - 23:55
FAILURE: Build failed with an exception. 
* What went wrong: 
Could not resolve all files for configuration ':runtimeClasspathCopy'. 
Could not find top.theillusivec4.curios:curios-forge:1.16.5-36.2.26_mapped_snapshot_20201028-1.16.3. 
  Searched in the following locations: 
    - file:/C:/Users/[omitted]/.mcreator/gradle/caches/forge_gradle/bundeled_repo/top/theillusivec4/curios/curios-forge/1.16.5-36.2.26_mapped_snapshot_20201028-1.16.3/curios-forge-1.16.5-36.2.26_mapped_snapshot_20201028-1.16.3.pom 
    - file:/C:/Users/[omitted]/.mcreator/gradle/caches/forge_gradle/bundeled_repo/top/theillusivec4/curios/curios-forge/1.16.5-36.2.26_mapped_snapshot_20201028-1.16.3/curios-forge-1.16.5-36.2.26_mapped_snapshot_20201028-1.16.3.jar 
  Required by: 
      project : 
* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. 
* Get more help at https://help.gradle.org/ 
BUILD FAILED in 2m 11s