Jump to content

OreRegisterEvent not being invoked real event?


jordan30001

Recommended Posts

I found the following class within OreDictionary

public static class OreRegisterEvent extends Event
    {
        public final String Name;
        public final ItemStack Ore;

        public OreRegisterEvent(String name, ItemStack ore)
        {
            this.Name = name;
            this.Ore = ore;
        }
    }

 

and above this method is the forge event bus invoker

private static void registerOre(String name, int id, ItemStack ore)
    {
        ArrayList<ItemStack> ores = getOres(id);
        ore = ore.copy();
        ores.add(ore);
        MinecraftForge.EVENT_BUS.post(new OreRegisterEvent(name, ore));
    }

 

I have my ForgeEvents class setup to receive these events and have successfully received other events but not this one


public class ForgeEvents
{
@ForgeSubscribe
public void DropEvent(LivingDropsEvent e)
{
               //working event snipped for less spam code
}

@ForgeSubscribe
public void oreRegistrationEvent(OreRegisterEvent e)
{
                Log.log("Recieved oreRegistrationEvent");
	if (e.Name.toLowerCase().contains("ore"))
	{
		addOre(e.Name);
	}
}
}

 

and in my preInit method I have

MinecraftForge.EVENT_BUS.register(new ForgeEvents());

 

is there a reason why I am not receiving this particular event?

Link to comment
Share on other sites

 

        MinecraftForge.EVENT_BUS.post(new OreRegisterEvent(name, ore));

No.. no it doesn't.

That should work fine as long as a ore is registered.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Oh wait it is working but due to my listener being registered after vanilla registration it doesn't invoke my method for vanilla ores anyway to register my event before objects start getting registed?

No

But you do have access to get all currently registered ores

You dont need a damn event for that.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.