Started by
MissLexyShaodws
on
Topic category: Help with Minecraft modding (Java Edition)
I added this to the mrcreator.gradle
repositories {
maven {
url = "https://maven.theillusivec4.top/"
}
}
dependencies {
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")
}
Then I created a custom element
package mcr.modname;
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 Curios {
public Curios() {
}
private void enqueue(final InterModEnqueueEvent evt) {
InterModComms.sendTo(CuriosApi.MODID, SlotTypeMessage.REGISTER_TYPE,
() -> SlotTypePreset.BELT.getMessageBuilder().build());
}
@SubscribeEvent
public static void init(FMLCommonSetupEvent event) {
new Curios();
}
@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 created the belt.json file
"data/curios/tags/items/"
{
"replace": false,
"values": [
"modname:item"
]
}
The item shows it's apart of the slot belt but the slots don't show not in the build env and not in a normal mod pack, we are missing something to show the belt option, and yes I pressed the little start, when pressed it hides any affects but no UI shows.
After looking at loads of mods what have curios none of them do it the way mcreator say we need to so I would like to know if anyone can shade some light on it, it would be helpful.
Not to be rude, but this code is a mess.
This code should work.
I suggest you to learn java, It's easy.
What have you changed from what I can tell you just deleted parts what don't affect the slot function in the first place, saying you code is a mess is also very rude and you just also called every user that submit code to Mcreator bad coders as that code was created by the tool it's self not me.
I suggest you learn that NO one knows everything about JAVA, I am a programmer, not java but still, when you reply to someone whom has posted code you explain what part of the code is braking the code and why, I asked if you could shed some light on it not just send me the code what will just work, tho I don't believe it will as that is the same code I already have, the other events and triggers wouldn't affect the UI not showing when I already explained the item is registered as a belt item the UI isn't there.
Also using @SubscribeEvent would lead to a illegal annotation, so maybe you should lead JAVA.
Oh, sorry for being rude!
And also yeah, I’ve noticed my error, I forgot to change modifiers from private to public static.
Sorry about that, I don’t have access to computer and IDE to check correctness of the code.
And since you asked me to explain why the code didn't work, here's why: you created a new instance of the class in the Common Setup event, which is pointless, because the class doesn't even have a constructor(the main method), and the method that registered your curio wasn't even subscribed to mod EventBus as a result, it didn't work.
Now try using this code, it should work. also re-import the imports(ctrl+w, if I'm not mistaken).
And I don't understand what's rude about offering to learn java? This is really easy, of course not in a few days, but still.
I think we both over looked things here and was both rude in our own ways, I know the basics behind many programming languages but I have a lot on my plate I am not some kid whom as time to learn alot of things, I know how to look at coding and see some things are broken but the logic behind JAVA well to me there isn't one.
But I will give you this you replied to me how I wanted the why thanks I give this a test when I get a free moment the slot code wasn't been run that is for sure.
OK here is the updated version what works, this will also work for all the other people that said it didn't work until it was in a mod pack
What ever you called your custom element I would replace CuriosBelt with so it all registers fine
if you don't want belt then replace BELT with CURIO/BACK/BELT/BODY/BRACELET/CHARM/HEAD/HANDS/NECKLACE/RING
Thank you Frostygames0 for helping me with the register bus, don't follow the other tuts on here what tell you to just add it to the custom class clean it up as, as you can see much less code is needed this way.
little update, just a little update so you not trying to register the slot if the mod isn't installed
This was very helpful thank you both!
Shooting my shots by asking this here but does anyone know perhaps how to make it so when you equip a curios head item, a helmet actually shows up on the player model?
I don't rly know how to code, so I was thinking if there was a way to make it so when you equip the "Head Curio" it extends the Armor item in order for it to render on a player?
That being said it would act like a Cosmetic Armor mod, but only with curios.
Any help appreciated thanks!
I'm facing the same problem!!
I have learned how to add an item and a slot for the Curious API,
but I do not know how to add models or properties for this item.