0

why minecraft crashing on start?

mod main class(cutted)

public DragonquestMod() {
    ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Config.SERVER, "tutorialmod-server.toml");
    ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, Config.CLIENT, "tutorialmod-client.toml");

    FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
    FMLJavaModLoadingContext.get().getModEventBus().addListener(this::ClientRegistries);

    Config.loadConfig(Config.CLIENT, FMLPaths.CONFIGDIR.get().resolve("tutorialmod-client.toml").toString());
    Config.loadConfig(Config.SERVER, FMLPaths.CONFIGDIR.get().resolve("tutorialmod-server.toml").toString());

    MinecraftForge.EVENT_BUS.register(this);
}

private void setup(final FMLCommonSetupEvent event)
{
    OreGeneration.setupOreGeneration();
    LOGGER.info("SETUP");
}

private void ClientRegistries(final FMLClientSetupEvent event) {
    LOGGER.info("REGISTRY");
}

This starts when i made ore block and oregeneration system

log

repo

  • Does this answer your question? [Avoiding NullPointerException in Java](https://stackoverflow.com/questions/271526/avoiding-nullpointerexception-in-java), It's not skipping a part of the cycle, there is an NPE – Elikill58 Jan 19 '22 at 23:07
  • @Elikill58 i don't have any null in my code – Gabriel Aguiar Jan 19 '22 at 23:10
  • It doesn't need a null value in your code to create an NPE. The error clearly said that at `com.fgsoftwarestudio.dragonquest.world.gen.OreGeneration.setupOreGeneration(OreGeneration.java:20)` you are trying to use an undefined object – Elikill58 Jan 19 '22 at 23:12
  • @Elikill58 l20: ```biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, DragonquestBlocks.DRAGONSCALE_ORE.getDefaultState(), OreGenerationConfig.ore_chance.get()), Placement.COUNT_RANGE, new CountRangeConfig(10, 20, 0, 100)));``` – Gabriel Aguiar Jan 19 '22 at 23:18
  • `biome` or `OreGenerationConfig.ore_chance` are not define. I don't know, i think you should check it by printing or searching all possible variable that can be null – Elikill58 Jan 19 '22 at 23:26
  • @Elikill58 biome is define here: ```if(OreGenerationConfig.generate_overworld.get()) { for(Biome biome : ForgeRegistries.BIOMES) { biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, DragonquestBlocks.DRAGONSCALE_ORE.getDefaultState(), OreGenerationConfig.ore_chance.get()), Placement.COUNT_RANGE, new CountRangeConfig(10, 20, 0, 100))); } }``` – Gabriel Aguiar Jan 20 '22 at 09:06
  • @Elikill58 OreGenerationConfig: ```public static ForgeConfigSpec.BooleanValue generate_overworld; public static ForgeConfigSpec.IntValue ore_chance; public static void init(ForgeConfigSpec.Builder server, ForgeConfigSpec.Builder client) { server.comment("Oregen Config"); generate_overworld = server.comment("Decide if you ores can spawn in the overworld").define("oregen.generate_overworld", true); ore_chance = server.comment("Maximum number of ore veins that can spawn in one chunk.").defineInRange("ore_chance", 10, 0, 20); }``` – Gabriel Aguiar Jan 20 '22 at 09:11
  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jan 28 '22 at 23:08

0 Answers0