Jump to content

[1.16.5] Forge Config


cwJn

Recommended Posts

Hello. I'm currently trying to make a config to build a list of all registered LivingEntity instances from both installed mods and vanilla. Right now I'm attempting to use ForgeConfigSpec, but there's no documentation for it so I'm not sure what I'm doing.

package com.cwjn.hardstuckintegration.Config;

import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.registries.ForgeRegistries;
public class ResistancesConfig {

    public static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
    public static final ForgeConfigSpec SPEC;

    static {

        for (EntityType<?> entity : ForgeRegistries.ENTITIES.getValues()) {
            EntityClassification type = entity.getCategory();
            if (type == EntityClassification.CREATURE || type == EntityClassification.MONSTER || type == EntityClassification.WATER_CREATURE) {
                BUILDER.define("test_config_option_1_" + entity.toString(), 0.0f);
                BUILDER.define("test_config_option_2_" + entity.toString(), 0.0f);
                BUILDER.pop();
            }
        }

        SPEC = BUILDER.build();

    }

}

I guess the question would be, is there a better/easier way to do this? Someone has recommended using a JSON loader on startup, but before I go and learn how to do that I want to see if there's a way to make this work.

Link to comment
Share on other sites

The end goal of this is to apply a set of capabilities to every registered mob in the game, including any mods. I figure the best way to do this would be to autogenerate a list of all registered mobs in some sort of config file, which then will send the values (3 floats) to my capability handler.

Edited by cwJn
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.

Announcements



×
×
  • Create New...

Important Information

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