Jump to content

Recommended Posts

Posted

My configured features were working fine, but now they do not work. Every time I try to make a new world, the game crashes. I am not sure why, and would really appreciate the help. 

 

Here is my configured features java class

package me.ethtdp.customitems.core.world.feature;

import com.google.common.base.Suppliers;
import me.ethtdp.customitems.CustomItems;
import me.ethtdp.customitems.core.init.BlockInit;
import net.minecraft.core.Registry;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;

import java.util.List;
import java.util.function.Supplier;

public class ModConfiguredFeatures {

    public static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES =
            DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, CustomItems.MODID);

    public static final Supplier<List<OreConfiguration.TargetBlockState>> CREEPER_CREEPER_ORE = Suppliers.memoize(() -> List.of(
            OreConfiguration.target(ModOreFeatures.CREEPER_ORE_REPLACEABLE, BlockInit.CREEPER_ORE.get().defaultBlockState()))
    );

    public static final Supplier<List<OreConfiguration.TargetBlockState>> SPIDER_SPIDER_ORE = Suppliers.memoize(() -> List.of(
            OreConfiguration.target(ModOreFeatures.SPIDER_ORE_REPLACEABLE, BlockInit.SPIDER_ORE.get().defaultBlockState())
    ));

    public static final Supplier<List<OreConfiguration.TargetBlockState>> SKELETON_SKELETON_ORE = Suppliers.memoize(() -> List.of(
            OreConfiguration.target(ModOreFeatures.SKELETON_ORE_REPLACEABLE, BlockInit.SKELETON_ORE.get().defaultBlockState())
    ));

    public static final Supplier<List<OreConfiguration.TargetBlockState>> ZOMBIE_ZOMBIE_ORE = Suppliers.memoize(() -> List.of(
            OreConfiguration.target(ModOreFeatures.ZOMBIE_ORE_REPLACEABLE, BlockInit.ZOMBIE_ORE.get().defaultBlockState())
    ));

    public static final RegistryObject<ConfiguredFeature<?, ?>> CREEPER_ORE = CONFIGURED_FEATURES.register("creeper_ore",
            () -> new ConfiguredFeature<>(Feature.ORE, new OreConfiguration(CREEPER_CREEPER_ORE.get(), 7)));

    public static final RegistryObject<ConfiguredFeature<?, ?>> SPIDER_ORE = CONFIGURED_FEATURES.register("spider_ore",
            () -> new ConfiguredFeature<>(Feature.ORE, new OreConfiguration(SPIDER_SPIDER_ORE.get(), 7)));

    public static final RegistryObject<ConfiguredFeature<?, ?>> SKELETON_ORE = CONFIGURED_FEATURES.register("skeleton_ore",
            () -> new ConfiguredFeature<>(Feature.ORE, new OreConfiguration(SKELETON_SKELETON_ORE.get(), 7)));

    public static final RegistryObject<ConfiguredFeature<?, ?>> ZOMBIE_ORE = CONFIGURED_FEATURES.register("zombie_ore",
            () -> new ConfiguredFeature<>(Feature.ORE, new OreConfiguration(ZOMBIE_ZOMBIE_ORE.get(), 7)));

    public static void register(IEventBus bus) {
        CONFIGURED_FEATURES.register(bus);
    }
}

Here is the crash.

 

---- Minecraft Crash Report ----
// There are four lights!

Time: 7/22/22, 7:35 PM
Description: mouseClicked event handler

com.google.gson.JsonParseException: Error loading registry data: Unknown element: ResourceKey[minecraft:worldgen/configured_feature / mobarmor:zombie_ore]
	at net.minecraft.core.RegistryAccess.lambda$readRegistry$13(RegistryAccess.java:211) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] {}
	at net.minecraft.core.RegistryAccess.readRegistry(RegistryAccess.java:210) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.core.RegistryAccess.load(RegistryAccess.java:203) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.resources.RegistryOps.createAndLoad(RegistryOps.java:30) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.core.RegistryAccess.builtinCopy(RegistryAccess.java:183) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.lambda$openFresh$0(CreateWorldScreen.java:117) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.WorldLoader.load(WorldLoader.java:22) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.openFresh(CreateWorldScreen.java:116) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screens.worldselection.SelectWorldScreen.lambda$init$2(SelectWorldScreen.java:57) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.components.Button.onPress(Button.java:29) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.components.AbstractButton.onClick(AbstractButton.java:17) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.components.AbstractWidget.mouseClicked(AbstractWidget.java:110) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.components.events.ContainerEventHandler.mouseClicked(ContainerEventHandler.java:28) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHandler.lambda$onPress$0(MouseHandler.java:88) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screens.Screen.wrapScreenError(Screen.java:524) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHandler.onPress(MouseHandler.java:85) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHandler.lambda$setup$4(MouseHandler.java:185) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.MouseHandler.lambda$setup$5(MouseHandler.java:184) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:43) ~[lwjgl-glfw-3.3.1.jar%23159!/:build 7] {}
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.1.jar%23165!/:build 7] {}
	at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3474) ~[lwjgl-glfw-3.3.1.jar%23159!/:build 7] {}
	at com.mojang.blaze3d.systems.RenderSystem.limitDisplayFPS(RenderSystem.java:186) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1115) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:669) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:206) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
	at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19-41.0.109.jar%2394!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
	at net.minecraft.core.RegistryAccess.lambda$readRegistry$13(RegistryAccess.java:211) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] {}
	at net.minecraft.core.RegistryAccess.readRegistry(RegistryAccess.java:210) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.core.RegistryAccess.load(RegistryAccess.java:203) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.resources.RegistryOps.createAndLoad(RegistryOps.java:30) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.core.RegistryAccess.builtinCopy(RegistryAccess.java:183) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.lambda$openFresh$0(CreateWorldScreen.java:117) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.WorldLoader.load(WorldLoader.java:22) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.openFresh(CreateWorldScreen.java:116) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screens.worldselection.SelectWorldScreen.lambda$init$2(SelectWorldScreen.java:57) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.components.Button.onPress(Button.java:29) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.components.AbstractButton.onClick(AbstractButton.java:17) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.components.AbstractWidget.mouseClicked(AbstractWidget.java:110) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.components.events.ContainerEventHandler.mouseClicked(ContainerEventHandler.java:28) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHandler.lambda$onPress$0(MouseHandler.java:88) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screens.Screen.wrapScreenError(Screen.java:524) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHandler.onPress(MouseHandler.java:85) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHandler.lambda$setup$4(MouseHandler.java:185) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.MouseHandler.lambda$setup$5(MouseHandler.java:184) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:43) ~[lwjgl-glfw-3.3.1.jar%23159!/:build 7] {}
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.1.jar%23165!/:build 7] {}
	at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3474) ~[lwjgl-glfw-3.3.1.jar%23159!/:build 7] {}
-- Affected screen --
Details:
	Screen name: net.minecraft.client.gui.screens.worldselection.SelectWorldScreen
Stacktrace:
	at net.minecraft.client.gui.screens.Screen.wrapScreenError(Screen.java:524) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHandler.onPress(MouseHandler.java:85) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHandler.lambda$setup$4(MouseHandler.java:185) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.MouseHandler.lambda$setup$5(MouseHandler.java:184) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:43) ~[lwjgl-glfw-3.3.1.jar%23159!/:build 7] {}
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.1.jar%23165!/:build 7] {}
	at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3474) ~[lwjgl-glfw-3.3.1.jar%23159!/:build 7] {}
	at com.mojang.blaze3d.systems.RenderSystem.limitDisplayFPS(RenderSystem.java:186) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1115) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:669) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:206) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
	at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19-41.0.109.jar%2394!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {}


-- Last reload --
Details:
	Reload number: 1
	Reload reason: initial
	Finished: Yes
	Packs: Default, Mod Resources
Stacktrace:
	at net.minecraft.client.ResourceLoadStateTracker.fillCrashReport(ResourceLoadStateTracker.java:51) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.fillReport(Minecraft.java:2244) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:686) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:206) ~[forge-1.19-41.0.109_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
	at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19-41.0.109.jar%2394!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23106!/:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {}


-- System Details --
Details:
	Minecraft Version: 1.19
	Minecraft Version ID: 1.19
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 17.0.1, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode, sharing), Oracle Corporation
	Memory: 474954000 bytes (452 MiB) / 772800512 bytes (737 MiB) up to 2107637760 bytes (2010 MiB)
	CPUs: 4
	Processor Vendor: GenuineIntel
	Processor Name: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
	Identifier: Intel64 Family 6 Model 78 Stepping 3
	Microarchitecture: Skylake (Client)
	Frequency (GHz): 2.59
	Number of physical packages: 1
	Number of physical CPUs: 2
	Number of logical CPUs: 4
	Graphics card #0 name: Intel(R) HD Graphics 520
	Graphics card #0 vendor: Intel Corporation (0x8086)
	Graphics card #0 VRAM (MB): 1024.00
	Graphics card #0 deviceId: 0x1916
	Graphics card #0 versionInfo: DriverVersion=30.0.101.1994
	Memory slot #0 capacity (MB): 4096.00
	Memory slot #0 clockSpeed (GHz): 2.13
	Memory slot #0 type: DDR4
	Memory slot #1 capacity (MB): 4096.00
	Memory slot #1 clockSpeed (GHz): 2.13
	Memory slot #1 type: DDR4
	Virtual memory max (MB): 12903.40
	Virtual memory used (MB): 8998.95
	Swap memory total (MB): 4864.00
	Swap memory used (MB): 767.68
	JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
	Launched Version: MOD_DEV
	Backend library: LWJGL version 3.3.1 build 7
	Backend API: Intel(R) HD Graphics 520 GL version 3.2.0 - Build 30.0.101.1994, Intel
	Window size: 1920x1080
	GL Caps: Using framebuffer using OpenGL 3.2
	GL debug messages: 
	Using VBOs: Yes
	Is Modded: Definitely; Client brand changed to 'forge'
	Type: Client (map_client.txt)
	Graphics mode: fast
	Resource Packs: vanilla, mod_resources
	Current Language: English (US)
	CPU: 4x Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
	ModLauncher: 10.0.8+10.0.8+main.0ef7e830
	ModLauncher launch target: forgeclientuserdev
	ModLauncher naming: mcp
	ModLauncher services: 
		mixin-0.8.5.jar mixin PLUGINSERVICE 
		eventbus-6.0.0.jar eventbus PLUGINSERVICE 
		fmlloader-1.19-41.0.109.jar slf4jfixer PLUGINSERVICE 
		fmlloader-1.19-41.0.109.jar object_holder_definalize PLUGINSERVICE 
		fmlloader-1.19-41.0.109.jar runtime_enum_extender PLUGINSERVICE 
		fmlloader-1.19-41.0.109.jar capability_token_subclass PLUGINSERVICE 
		accesstransformers-8.0.4.jar accesstransformer PLUGINSERVICE 
		fmlloader-1.19-41.0.109.jar runtimedistcleaner PLUGINSERVICE 
		modlauncher-10.0.8.jar mixin TRANSFORMATIONSERVICE 
		modlauncher-10.0.8.jar fml TRANSFORMATIONSERVICE 
	FML Language Providers: 
		minecraft@1.0
		lowcodefml@null
		javafml@null
	Mod List: 
		forge-1.19-41.0.109_mapped_official_1.19-recomp.ja|Minecraft                     |minecraft                     |1.19                |DONE      |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f
		main                                              |mobarmor                      |mobarmor                      |0.0NONE             |DONE      |Manifest: NOSIGNATURE
		                                                  |Forge                         |forge                         |41.0.109            |DONE      |Manifest: NOSIGNATURE
		geckolib-forge-1.19-3.1.9_mapped_official_1.19.jar|GeckoLib                      |geckolib3                     |3.1.9               |DONE      |Manifest: NOSIGNATURE
		jei-1.19-forge-11.0.0.215_mapped_official_1.19.jar|Just Enough Items             |jei                           |11.0.0.215          |DONE      |Manifest: NOSIGNATURE
	Crash Report UUID: 53411b88-deae-4680-bdce-09e53cbb65ca
	FML: 41.0
	Forge: net.minecraftforge:41.0.109

 

Posted

The error says your ConfiguredFeature isn't registered. You can test if that is true in your FMLCommonSetUp.

Most likely the static register(IEventBus) isn't getting invoked or the bus value is wrong?

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

I am registering my configured features in my main class. 

package me.ethtdp.customitems;

import me.ethtdp.customitems.client.screen.ModMenuTypes;
import me.ethtdp.customitems.common.event.GlobalLootModifierInit;
import me.ethtdp.customitems.common.recipes.ModRecipe;
import me.ethtdp.customitems.common.villager.ModVillagers;
import me.ethtdp.customitems.core.init.BlockEntityInit;
import me.ethtdp.customitems.core.init.BlockInit;
import me.ethtdp.customitems.core.init.ItemInit;
import me.ethtdp.customitems.core.network.ModMessages;
import me.ethtdp.customitems.core.world.dimension.ModDimensions;
import me.ethtdp.customitems.core.world.dimension.portal.ModPOIs;
import me.ethtdp.customitems.core.world.feature.ModConfiguredFeatures;
import me.ethtdp.customitems.core.world.feature.ModPlacedFeatures;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import software.bernie.geckolib3.GeckoLib;
import software.bernie.geckolib3.resource.ResourceListener;

// The value here should match an entry in the META-INF/mods.toml file
@Mod(CustomItems.MODID)
public class CustomItems {

    // Directly reference a log4j logger.
    private static final Logger LOGGER = LogManager.getLogger();
    public static final String MODID = "mobarmor";

    public static final CreativeModeTab ITEMS_TAB = new CreativeModeTab(CustomItems.MODID) {
        @Override
        public ItemStack makeIcon() {
            return ItemInit.CREEPER_INGOT.get().getDefaultInstance();
        }
    };

    public CustomItems() {
        IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();

        ItemInit.ITEMS.register(bus);
        BlockInit.BLOCKS.register(bus);
        BlockEntityInit.register(bus);

        ModVillagers.register(bus);

        ModMenuTypes.register(bus);
        ModRecipe.register(bus);

        ModConfiguredFeatures.register(bus);
        ModPlacedFeatures.PLACED_FEATURES.register(bus);

        ModDimensions.register();
        ModPOIs.register(bus);

        GlobalLootModifierInit.GLM.register(bus);

        GeckoLib.initialize();

        MinecraftForge.EVENT_BUS.register(this);
    }
}

I am pretty sure the bus value is correct, but, I have only been modding for like 4-5 months so I can't be certain. 

Quote

You can test if that is true in your FMLCommonSetUp.

how exactly would I test it?

Posted (edited)

Sorry, I shouldn't answer questions first thing in the morning. :-) I just answered it as a generic DeferredRegistry question, but this is a ConfiguredFeature.

 

Registration for this works in a different way. They don't have normal registries instead you have to use some utility methods to put them in the "BuiltinRegistries".

I've been pointing people at some Botania code for 1.18 as an example, but the RegistryEvent has been changed to be RegisterEvent in 1.19 and it works in a slightly different way.

 

Here's some code I knocked up to show the equivalent to what Botania does but in 1.19

This following code is not really tested so double check the details. I just checked the objects are available in the MinecraftServer.registryAccess() registries - which is what your problem is.

@Mod.EventBusSubscriber(modid = ExampleMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModRegistration {

    @SubscribeEvent
    public static void register(RegisterEvent event) {
        event.register(Registry.FEATURE_REGISTRY, helper -> {
            // normally this would be one of your blocks
            var block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("minecraft:diamond_block"));

            // registration code starts here
            var target = List.of(OreConfiguration.target(OreFeatures.NATURAL_STONE, block.defaultBlockState()));
            var configuredFeature = FeatureUtils.register(ExampleMod.MODID + ":diamond_blocks", Feature.ORE, new OreConfiguration(target, 64));
            PlacementUtils.register(ExampleMod.MODID + ":diamond_blocks", configuredFeature, commonOrePlacement(10, HeightRangePlacement.triangle(VerticalAnchor.absolute(-24), VerticalAnchor.absolute(56))));
        });
    }
}

This puts the registration in the same place Features would be registered. The example above does not actually register a Feature, it uses the vanilla OreConfiguration feature.

The above code registers a ConfiguredFeature and PlacementFeature in the BuiltinRegistries which will be copied into the world gen registries (overridable and usable by datapacks).

NOTE: The "commonOrePlacement" method is from PlacementUtils and needs an Access Transformer to use it, or you could make your own utility method.

 

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted (edited)

 

Ok thanks, I'll try it out.

 

Edit:

It didn't work. I added in this set of code:

event.register(Registry.FEATURE_REGISTRY, helper -> {
            var block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(CustomItems.MODID, "creeper_ore"));

            var target = List.of(OreConfiguration.target(ModOreFeatures.CREEPER_ORE_REPLACEABLE, block.defaultBlockState()));
            var configuredFeature = FeatureUtils.register(CustomItems.MODID + ":creeper_ore", Feature.ORE, new OreConfiguration(target, 64));
            PlacementUtils.register(CustomItems.MODID + ":creeper_ore", configuredFeature, ModOrePlacement.commonOrePlacement(10, HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(0), VerticalAnchor.aboveBottom(100))));
        });

to my ModEventBus class

@Mod.EventBusSubscriber(modid = CustomItems.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModEventBusEvents {

    @SubscribeEvent
    public static void registerModifierSerializers(RegisterEvent event) {

        event.register(ForgeRegistries.Keys.RECIPE_TYPES, helper -> {
            helper.register(new ResourceLocation(CustomItems.MODID, MobCuttingStationRecipe.Type.ID),
                    MobCuttingStationRecipe.Type.INSTANCE);
        });

        event.register(Registry.FEATURE_REGISTRY, helper -> {
            var block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(CustomItems.MODID, "creeper_ore"));

            var target = List.of(OreConfiguration.target(ModOreFeatures.CREEPER_ORE_REPLACEABLE, block.defaultBlockState()));
            var configuredFeature = FeatureUtils.register(CustomItems.MODID + ":creeper_ore", Feature.ORE, new OreConfiguration(target, 64));
            PlacementUtils.register(CustomItems.MODID + ":creeper_ore", configuredFeature, ModOrePlacement.commonOrePlacement(10, HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(0), VerticalAnchor.aboveBottom(100))));
        });
    }
}

It gives me the same error

Error loading registry data: Unknown element: ResourceKey[minecraft:worldgen/configured_feature / mobarmor:creeper_ore]
	at net.minecraft.core.RegistryAccess.lambda$readRegistry$13(RegistryAccess.java:211) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] {}
	at net.minecraft.core.RegistryAccess.readRegistry(RegistryAccess.java:210) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.core.RegistryAccess.load(RegistryAccess.java:203) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.resources.RegistryOps.createAndLoad(RegistryOps.java:30) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.core.RegistryAccess.builtinCopy(RegistryAccess.java:183) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.lambda$openFresh$0(CreateWorldScreen.java:117) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.WorldLoader.load(WorldLoader.java:22) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading}
	at net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.openFresh(CreateWorldScreen.java:116) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screens.worldselection.SelectWorldScreen.lambda$init$2(SelectWorldScreen.java:57) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.components.Button.onPress(Button.java:29) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.components.AbstractButton.onClick(AbstractButton.java:17) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.components.AbstractWidget.mouseClicked(AbstractWidget.java:110) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.components.events.ContainerEventHandler.mouseClicked(ContainerEventHandler.java:28) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHandler.lambda$onPress$0(MouseHandler.java:88) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screens.Screen.wrapScreenError(Screen.java:524) ~[forge-1.19-41.0.110_mapped_official_1.19-recomp.jar%23180!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	... 24 more

Maybe I did it wrong

Edited by EthTDP
Didn't work
Posted (edited)

Not related to your problem (and not really wrong) but you should be using your

BlockInit.CREEPER_ORE.get()

to get your block.

I only used the ForgeRegistries because I used a vanilla block that I didn't register.

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

I don't spot what you are doing wrong from the code you posted. Are you certain it is using the new code?

Try adding something like the following your common setup:

    private void commonSetup(final FMLCommonSetupEvent event)
    {
        ResourceLocation id = new ResourceLocation(MODID, "creeper_ore");
        LOGGER.info("CF:" + BuiltinRegistries.CONFIGURED_FEATURE.get(id));
        LOGGER.info("PF:" + BuiltinRegistries.PLACED_FEATURE.get(id));
    }

This will confirm they are registered in the builtin registries.

 

I did a bit more testing on my example code to see if I had made a stupid error, but it seems to be correct.

I added a biome modifier to actually use it and I get diamond blocks in my overworld:

{
  "type": "forge:add_features",
  "biomes": "#minecraft:is_overworld",
  "features": "examplemod:diamond_blocks",
  "step": "underground_ores"
}

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

Do you still have the old code? Maybe that is interfering with it somehow?

I don't actually know what using DeferredRegister on those registry keys does.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted (edited)

You said that before, but you didn't know of an example mod to point to that does it that way.

There are many mods using the event, which does work.

 

Anyway, here's an example that works using DeferredRegisters.

public class ModFeatures {
    private static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES = DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, ExampleMod.MODID);
    private static final DeferredRegister<PlacedFeature> PLACED_FEATURES = DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, ExampleMod.MODID);

    public static final RegistryObject<ConfiguredFeature<?, ?>> DIAMOND_BLOCKS_CONFIGURED = CONFIGURED_FEATURES.register("diamond_blocks",
            () -> {
                var block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("minecraft:diamond_block"));
                var target = List.of(OreConfiguration.target(OreFeatures.NATURAL_STONE, block.defaultBlockState()));
                return new ConfiguredFeature<>(Feature.ORE, new OreConfiguration(target, 64));
            });

    public static final RegistryObject<PlacedFeature> DIAMOND_BLOCKS_PLACED = PLACED_FEATURES.register("diamond_blocks",
            () -> new PlacedFeature(DIAMOND_BLOCKS_CONFIGURED.getHolder().get(), 
                        commonOrePlacement(10, HeightRangePlacement.triangle(VerticalAnchor.absolute(-24), VerticalAnchor.absolute(56)))));

    public static void register(IEventBus bus) {
        CONFIGURED_FEATURES.register(bus);
        PLACED_FEATURES.register(bus);
    }
}

 

The static register(IEventBus) method needs to be called with the MOD event bus.

 

From what I can tell, the only difference from the event method is the objects are not registered with the BuiltinRegistries with the above?

They are held elsewhere. 

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted
3 hours ago, warjort said:
var block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("minecraft:diamond_block"));

why did you use this complicated way?

and btw you can store the TargetBlockState list in a static final field (requires a Supplier, since the Blocks are not registered yet when the class is load)

Posted
Quote

and btw you can store the TargetBlockState list in a static final field (requires a Supplier, since the Blocks are not registered yet when the class is load)

That code is already in a supplier that doesn't get called until the ConfiguredFeatures are registered. Its not during classloading.

I already talked above about how to do the block properly for modded blocks.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted
Quote

Try adding something like the following your common setup:

So I added those lines of code to my common setup, and it says 

[11:21:26] [Worker-Main-3/INFO] [me.et.cu.CustomItems/]: CF:Configured: net.minecraft.world.level.levelgen.feature.OreFeature@34d1b2c7: net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration@264d3866
[11:21:26] [Worker-Main-3/INFO] [me.et.cu.CustomItems/]: PF:Placed Reference{ResourceKey[minecraft:worldgen/configured_feature / mobarmor:creeper_ore]=Configured: net.minecraft.world.level.levelgen.feature.OreFeature@34d1b2c7: net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration@264d3866}

I have also tried adding a deferredregister like you did 

Quote

Anyway, here's an example that works using DeferredRegisters.

and it still gives me the error.

Here is my ModFeatures class

private static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES = DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, CustomItems.MODID);
    private static final DeferredRegister<PlacedFeature> PLACED_FEATURE = DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, CustomItems.MODID);

    public static final RegistryObject<ConfiguredFeature<?, ?>> CREEPER_ORE_CONFIGURED = CONFIGURED_FEATURES.register("creeper_ore",
            () -> {
                var block = BlockInit.CREEPER_ORE.get();
                var target = List.of(OreConfiguration.target(ModOreFeatures.CREEPER_ORE_REPLACEABLE, block.defaultBlockState()));
                return new ConfiguredFeature<>(Feature.ORE, new OreConfiguration(target, 64));
            });

    public static final RegistryObject<PlacedFeature> CREEPER_ORE_PLACED = PLACED_FEATURE.register("creeper_ore",
            () -> new PlacedFeature(CREEPER_ORE_CONFIGURED.getHolder().get(),
                    ModOrePlacement.commonOrePlacement(10, HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(0), VerticalAnchor.aboveBottom(100)))));

    public static void register(IEventBus bus) {
        CONFIGURED_FEATURES.register(bus);
        PLACED_FEATURE.register(bus);
    }

and I have registered it into my main class

public CustomItems() {
        IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();

        ItemInit.ITEMS.register(bus);
        BlockInit.BLOCKS.register(bus);
        BlockEntityInit.register(bus);

        ModVillagers.register(bus);

        ModMenuTypes.register(bus);
        ModRecipe.register(bus);
		//here
        ModFeatures.register(bus);

        ModDimensions.register();
        ModPOIs.register(bus);

        GlobalLootModifierInit.GLM.register(bus);

        GeckoLib.initialize();

        MinecraftForge.EVENT_BUS.register(this);
    }

 

Posted

The log messages show the objects were registered when you used the RegisterEvent.

I think you need to post your debug.log and show what is actually referencing the feature. I think there is something else going on here.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

I figured it out on my own. I found out I was registering a loot modifier more than once, which, I guess, caused the configured features to not register correctly. Thanks for helping.

 

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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