Registering Custom Bogey Styles - Rabbitminers/Extended-Bogeys GitHub Wiki

Once you have created your Custom Style you need to register it. Bogey styles must be initialised during FMLCommonSetupEvent this can be done like so in your mods Entry Point class (the one with the @Mod annotation).

Here is our example Bogey Style, (note - this must implement the IBogeyStyle interface as detailed Here)

public class ExampleBogeyStyle implements IBogeyStyle {
    @Override
    public String getStyleName() {
        // It is recommended to use translation keys to allow for localisation of your bogey names, this is detailed in the tips page
        return "Example Style";
    }

    /* remainder of your code, e.g rendering and properties goes here */
}

To register this first create a common setup method so both the server and client will be able to access your bogey style, in your mods Entry Point.

private void setup(final FMLCommonSetupEvent event) {
    // Register your custom style
    BogeyStyles.addBogeyStyle(ExampleBogeyStyle.class);
    // Log that your mod has finished loading its custom bogeys
    LOGGER.info("Registered bogey types from: " + CustomBogeyStyleDemonstration.MODID);
}

This will register your Custom Bogey style, once finished it will log that every style from your mod has been added, while this logging is not necessary it is helpful when identifying problems with registration.

If you wish to add multiple styles simply call BogeyStyles#addBogeyStyle multiple times with each of your styles. Style ids are automatically handled by Extended Bogeys so you dont need to worry about handling them yourself.

Finally, to call this setup event in your mods constructor add an EventBusListner like so:

// Capture the event bus
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
// Provide your setup event
eventBus.addListener(this::setup);
// Register the event
MinecraftForge.EVENT_BUS.register(this);

And there you have it, your own Custom Bogeys!

Here is our final demo Entry Point class (excluding PartialModel initialisation):

@Mod(CustomBogeyStyleDemonstration.MODID)
public class CustomBogeyStyleDemonstration {
    public static final String MODID = "demo";
    // Access the logger
    public static final Logger LOGGER = LogUtils.getLogger();

    public CustomBogeyStyleDemonstration() {
        IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
        eventBus.addListener(this::setup);
        MinecraftForge.EVENT_BUS.register(this);
    }

    private void setup(final FMLCommonSetupEvent event) {
        // Register your custom style
        BogeyStyles.addBogeyStyle(ExampleBogeyStyle.class);
        // Log that your mod has finished loading its custom bogeys
        LOGGER.info("Registered bogey types from: " + CustomBogeyStyleDemonstration.MODID);
    }
}