Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.19] Banner Patterns Registry


Magistu
 Share

Recommended Posts

I know very little about banner patterns but wouldn't this just be something like?

@Mod("examplemod")
public class ExampleMod
{
    private static final DeferredRegister<BannerPattern> BANNERS = DeferredRegister.create(Registry.BANNER_PATTERN_REGISTRY, "examplemod");
    public ExampleMod()
    {
        IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
        bus.addListener(this::setup);
        BANNERS.register(bus);
    }

    private void setup(final FMLCommonSetupEvent event)
    {
        BANNERS.register("mybanner", () -> new BannerPattern("myb"));
    }
}

Registry is the vanilla registry, its not deprecated, there is no special forge version.

Link to comment
Share on other sites

8 hours ago, warjort said:
    private void setup(final FMLCommonSetupEvent event)
    {
        BANNERS.register("mybanner", () -> new BannerPattern("myb"));
    }

That's the wrong place to register to a DeferredRegister. FMLCommonSetupEvent fires after all registration is already done. All entries must be registered to the DeferredRegister by the end of your mod's constructor. Usually a static initializer is used for this.

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
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.

 Share



×
×
  • Create New...

Important Information

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