curios UI not showing

Started by MissLexyShaodws on Sun, 09/26/2021 - 20:19

Topic category: Help with modding (Java Edition)

Last seen on 17:48, 19. May 2022
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
curios UI not showing
Sun, 09/26/2021 - 20:19

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"
    ]
}

https://i.imgur.com/JztrFF3.png

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.

Last seen on 07:55, 19. May 2022
Joined Apr 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Not to be rude, but this…
Sun, 09/26/2021 - 20:54

Not to be rude, but this code is a mess.

This code should work. 

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(modid = *YOUR MOD ID*, bus = Mod.EventBusSubscriber.Bus.MOD)
public class Curios {

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

I suggest you to learn java, It's easy.

Last seen on 17:48, 19. May 2022
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
What have you changed from…
Sun, 09/26/2021 - 21:05

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.

Last seen on 17:48, 19. May 2022
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Also using @SubscribeEvent…
Sun, 09/26/2021 - 21:12

Also using @SubscribeEvent would lead to a illegal annotation, so maybe you should lead JAVA.

Last seen on 07:55, 19. May 2022
Joined Apr 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Oh, sorry for being rude!…
Sun, 09/26/2021 - 21:51

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.

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(modid = *YOUR MOD ID*, bus = Mod.EventBusSubscriber.Bus.MOD)
public class Curios {

	@SubscribeEvent
	public static void enqueue(final InterModEnqueueEvent evt) {
		InterModComms.sendTo(CuriosApi.MODID, SlotTypeMessage.REGISTER_TYPE,
	    	() -> SlotTypePreset.BELT.getMessageBuilder().build());
	}
}

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.

Last seen on 17:48, 19. May 2022
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I think we both over looked…
Mon, 09/27/2021 - 08:42

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.

Last seen on 17:48, 19. May 2022
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
OK here is the updated…
Mon, 09/27/2021 - 08:59

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

package {YOURPACKAGEID}

import top.theillusivec4.curios.api.SlotTypePreset;
import top.theillusivec4.curios.api.SlotTypeMessage;
import top.theillusivec4.curios.api.CuriosApi;

import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.eventbus.api.SubscribeEvent;

@Mod.EventBusSubscriber(modid="{YOURMODID}", bus=Mod.EventBusSubscriber.Bus.MOD)
public class CuriosBelt {
	@SubscribeEvent
	public static void enqueue(final InterModEnqueueEvent evt) {
		InterModComms.sendTo(CuriosApi.MODID, SlotTypeMessage.REGISTER_TYPE,
	    	() -> SlotTypePreset.BELT.getMessageBuilder().build());
	}
}

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.

Last seen on 17:48, 19. May 2022
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
little update, just a little…
Mon, 09/27/2021 - 11:41

little update, just a little update so you not trying to register the slot if the mod isn't installed
 

package {YOURPACKAGEID}

import top.theillusivec4.curios.api.SlotTypeMessage;
import top.theillusivec4.curios.api.CuriosApi;

import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.eventbus.api.SubscribeEvent;

@Mod.EventBusSubscriber(modid = "{YOURMODID}", bus = Mod.EventBusSubscriber.Bus.MOD)
public class CuriosBelt {
	@SubscribeEvent
	public static void enqueue(final InterModEnqueueEvent evt) {
		
		if (ModList.get().isLoaded("curios")) {
			InterModComms.sendTo(CuriosApi.MODID, SlotTypeMessage.REGISTER_TYPE, () -> new SlotTypeMessage.Builder("nappy").build());
		}
	}
}

 

Last seen on 17:13, 11. Feb 2022
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
This was very helpful thank…
Thu, 01/27/2022 - 10:04

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!