Untitled conversation
- User
[16Jun2025 23:05:10.724] [Render thread/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/]: Exception caught during firing event: Registry Object not present: oceancritteria:penguin Index: 1 Listeners: 0: NORMAL 1: ASM: class net.mattias.oceancritteria.event.ModEventBusEvents registerAttributes(Lnet/minecraftforge/event/entity/EntityAttributeCreationEvent;)V java.lang.NullPointerException: Registry Object not present: oceancritteria:penguin at java.base/java.util.Objects.requireNonNull(Objects.java:336) at TRANSFORMER/forge@47.3.1/net.minecraftforge.registries.RegistryObject.get(RegistryObject.java:204) at TRANSFORMER/oceancritteria@1.0.0/net.mattias.oceancritteria.event.ModEventBusEvents.registerAttributes(ModEventBusEvents.java:14) at TRANSFORMER/oceancritteria@1.0.0/net.mattias.oceancritteria.event.__ModEventBusEvents_registerAttributes_EntityAttributeCreationEvent.invoke(.dynamic) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) at LAYER PLUGIN/javafmllanguage@1.20.1-47.3.1/net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:114) at LAYER PLUGIN/fmlcore@1.20.1-47.3.1/net.minecraftforge.fml.ModLoader.lambda29(ModLoader.java:326) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at LAYER PLUGIN/fmlcore@1.20.1-47.3.1/net.minecraftforge.fml.ModList.forEachModInOrder(ModList.java:227) at LAYER PLUGIN/fmlcore@1.20.1-47.3.1/net.minecraftforge.fml.ModLoader.postEvent(ModLoader.java:326) at TRANSFORMER/forge@47.3.1/net.minecraftforge.common.ForgeHooks.modifyAttributes(ForgeHooks.java:1222) at TRANSFORMER/forge@47.3.1/net.minecraftforge.registries.GameData.postRegisterEvents(GameData.java:350) at TRANSFORMER/forge@47.3.1/net.minecraftforge.common.ForgeStatesProvider.lambda4(ForgeStatesProvider.java:25) at LAYER PLUGIN/fmlcore@1.20.1-47.3.1/net.minecraftforge.fml.ModLoader.handleInlineTransition(ModLoader.java:217) at LAYER PLUGIN/fmlcore@1.20.1-47.3.1/net.minecraftforge.fml.ModLoader.lambda19(ModLoader.java:209) at java.base/java.util.Optional.ifPresent(Optional.java:178) at LAYER PLUGIN/fmlcore@1.20.1-47.3.1/net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:209) at LAYER PLUGIN/fmlcore@1.20.1-47.3.1/net.minecraftforge.fml.ModLoader.lambda13(ModLoader.java:183) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at LAYER PLUGIN/fmlcore@1.20.1-47.3.1/net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:183) at TRANSFORMER/forge@47.3.1/net.minecraftforge.client.loading.ClientModLoader.lambda1(ClientModLoader.java:69) at TRANSFORMER/forge@47.3.1/net.minecraftforge.client.loading.ClientModLoader.lambda4(ClientModLoader.java:89) at TRANSFORMER/forge@47.3.1/net.minecraftforge.client.loading.ClientModLoader.begin(ClientModLoader.java:69) at TRANSFORMER/minecraft@1.20.1/net.minecraft.client.Minecraft.(Minecraft.java:459) at TRANSFORMER/minecraft@1.20.1/net.minecraft.client.main.Main.main(Main.java:182) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at MC-BOOTSTRAP/fmlloader@1.20.1-47.3.1/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111) at MC-BOOTSTRAP/fmlloader@1.20.1-47.3.1/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:99) at MC-BOOTSTRAP/fmlloader@1.20.1-47.3.1/net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.devService(ForgeClientUserdevLaunchHandler.java:19) at MC-BOOTSTRAP/fmlloader@1.20.1-47.3.1/net.minecraftforge.fml.loading.targets.CommonDevLaunchHandler.lambda7(CommonDevLaunchHandler.java:135) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.Launcher.run(Launcher.java:108) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.Launcher.main(Launcher.java:78) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) at cpw.mods.bootstraplauncher@1.1.2/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141)
[16Jun2025 23:05:10.726] [Render thread/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Caught exception during event net.minecraftforge.event.entity.EntityAttributeCreationEvent@6ce15112 dispatch for modid oceancritteria java.lang.NullPointerException: Registry Object not present: oceancritteria:penguin at java.util.Objects.requireNonNull(Objects.java:336) ~[?:?] at net.minecraftforge.registries.RegistryObject.get(RegistryObject.java:204) ~[forge-1.20.1-47.3.1_mapped_official_1.20.1.jar%23190%23197!/:?] at net.mattias.oceancritteria.event.ModEventBusEvents.registerAttributes(ModEventBusEvents.java:14) ~[%23196!/:?] at net.mattias.oceancritteria.event.__ModEventBusEvents_registerAttributes_EntityAttributeCreationEvent.invoke(.dynamic) ~[%23196!/:?] at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.5.jar:?] at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar:?] at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar:?] at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:114) ~[javafmllanguage-1.20.1-47.3.1.jar:?] at net.minecraftforge.fml.ModLoader.lambda29(ModLoader.java:326) ~[fmlcore-1.20.1-47.3.1.jar:?] at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] at net.minecraftforge.fml.ModList.forEachModInOrder(ModList.java:227) ~[fmlcore-1.20.1-47.3.1.jar:?] at net.minecraftforge.fml.ModLoader.postEvent(ModLoader.java:326) ~[fmlcore-1.20.1-47.3.1.jar:?] at net.minecraftforge.common.ForgeHooks.modifyAttributes(ForgeHooks.java:1222) ~[forge-1.20.1-47.3.1_mapped_official_1.20.1.jar:?] at net.minecraftforge.registries.GameData.postRegisterEvents(GameData.java:350) ~[forge-1.20.1-47.3.1_mapped_official_1.20.1.jar:?] at net.minecraftforge.common.ForgeStatesProvider.lambda4(ForgeStatesProvider.java:25) ~[forge-1.20.1-47.3.1_mapped_official_1.20.1.jar:?] at net.minecraftforge.fml.ModLoader.handleInlineTransition(ModLoader.java:217) ~[fmlcore-1.20.1-47.3.1.jar:?] at net.minecraftforge.fml.ModLoader.lambda19(ModLoader.java:209) ~[fmlcore-1.20.1-47.3.1.jar:?] at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:209) ~[fmlcore-1.20.1-47.3.1.jar:?] at net.minecraftforge.fml.ModLoader.lambda13(ModLoader.java:183) ~[fmlcore-1.20.1-47.3.1.jar:?] at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:183) ~[fmlcore-1.20.1-47.3.1.jar:?] at net.minecraftforge.client.loading.ClientModLoader.lambda1(ClientModLoader.java:69) ~[forge-1.20.1-47.3.1_mapped_official_1.20.1.jar:?] at net.minecraftforge.client.loading.ClientModLoader.lambda4(ClientModLoader.java:89) ~[forge-1.20.1-47.3.1_mapped_official_1.20.1.jar:?] at net.minecraftforge.client.loading.ClientModLoader.begin(ClientModLoader.java:69) ~[forge-1.20.1-47.3.1_mapped_official_1.20.1.jar:?] at net.minecraft.client.Minecraft.(Minecraft.java:459) ~[forge-1.20.1-47.3.1_mapped_official_1.20.1.jar:?] at net.minecraft.client.main.Main.main(Main.java:182) ~[forge-1.20.1-47.3.1_mapped_official_1.20.1.jar:?] 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:569) ~[?:?] at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111) ~[fmlloader-1.20.1-47.3.1.jar:?] at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:99) ~[fmlloader-1.20.1-47.3.1.jar:?] at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.devService(ForgeClientUserdevLaunchHandler.java:19) ~[fmlloader-1.20.1-47.3.1.jar:?] at net.minecraftforge.fml.loading.targets.CommonDevLaunchHandler.lambda7(CommonDevLaunchHandler.java:135) ~[fmlloader-1.20.1-47.3.1.jar:?] at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) ~[modlauncher-10.0.9.jar:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) ~[modlauncher-10.0.9.jar:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) ~[modlauncher-10.0.9.jar:?] at cpw.mods.modlauncher.Launcher.run(Launcher.java:108) ~[modlauncher-10.0.9.jar:?] at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar:?] at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar:?] at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar:?] at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?] [16Jun2025 23:05:11.225] [Render thread/FATAL] [net.minecraftforge.common.ForgeMod/]: Preparing crash report with UUID 979a1355-36a8-41f6-82b4-a2d6d0419424 [16Jun2025 23:05:11.240] [Render thread/FATAL] [net.minecraftforge.common.ForgeMod/]: Preparing crash report with UUID 192426a5-0832-421a-a839-4036f164b889
package net.mattias.oceancritteria.entity.custom;
import net.mattias.oceancritteria.entity.ModEntities; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.AnimationState; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.goal.*; import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.Level; import org.jetbrains.annotations.Nullable;
public class PenguinEntity extends Animal { public PenguinEntity(EntityType<? extends Animal> pEntityType, Level pLevel) { super(pEntityType, pLevel); }
public final AnimationState idleAnimationState = new AnimationState(); private int idleAnimationTimeout = 0; @Override public void tick() { super.tick(); if(this.level().isClientSide()) { setupAnimationStates(); } } private void setupAnimationStates() { if(this.idleAnimationTimeout <= 0) { this.idleAnimationTimeout = this.random.nextInt(40) + 80; this.idleAnimationState.start(this.tickCount); } else { --this.idleAnimationTimeout; } } @Override protected void updateWalkAnimation(float pPartialTick) { float f; if(this.getPose() == Pose.STANDING) { f = Math.min(pPartialTick * 6F, 1f); } else { f = 0f; } this.walkAnimation.update(f, 0.2f); } @Override protected void registerGoals() { this.goalSelector.addGoal(0, new FloatGoal(this)); this.goalSelector.addGoal(1, new BreedGoal(this, 1.15D)); this.goalSelector.addGoal(2, new TemptGoal(this, 1.2D, Ingredient.of(Items.COD, Items.SALMON, Items.COOKED_SALMON, Items.COOKED_COD), false)); this.goalSelector.addGoal(3, new FollowParentGoal(this, 1.1D)); this.goalSelector.addGoal(4, new WaterAvoidingRandomStrollGoal(this, 1.1D)); this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 3f)); this.goalSelector.addGoal(6, new RandomLookAroundGoal(this)); } public static AttributeSupplier.Builder createAttributes() { return Animal.createLivingAttributes() .add(Attributes.MAX_HEALTH, 5D) .add(Attributes.FOLLOW_RANGE, 24D) .add(Attributes.MOVEMENT_SPEED, 0.25D); } @Nullable @Override public AgeableMob getBreedOffspring(ServerLevel pLevel, AgeableMob pOtherParent) { return ModEntities.PENGUIN.get().create(pLevel); } @Override public boolean isFood(ItemStack pStack) { return pStack.is(Items.COD); } @Nullable @Override protected SoundEvent getAmbientSound() { return SoundEvents.DOLPHIN_AMBIENT; } @Nullable @Override protected SoundEvent getHurtSound(DamageSource pDamageSource) { return SoundEvents.DOLPHIN_HURT; } @Nullable @Override protected SoundEvent getDeathSound() { return SoundEvents.DOLPHIN_DEATH; }}
Assistant
The error you're encountering is a
NullPointerExceptionindicating that the registry object foroceancritteria:penguinis not present. This typically means that the entity registration for the penguin is not happening correctly, or it is happening too late in the mod loading process.Here are some steps to troubleshoot and fix the issue:
-
Check Entity Registration: Ensure that the entity is registered correctly in your mod's initialization code. Typically, this is done in a method annotated with
@SubscribeEventfor theRegistryEvent.Register<EntityType<?>>event.@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class ModEntityTypes { @SubscribeEvent public static void onEntityRegister(final RegistryEvent.Register<EntityType<?>> event) { event.getRegistry().register(ModEntities.PENGUIN.get()); } } -
Check Entity Initialization: Ensure that the
ModEntitiesclass is correctly set up to register the entity. This usually involves usingDeferredRegisterandRegistryObject.public class ModEntities { public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, "oceancritteria"); public static final RegistryObject<EntityType<PenguinEntity>> PENGUIN = ENTITIES.register("penguin", () -> EntityType.Builder.of(PenguinEntity::new, MobCategory.CREATURE) .sized(0.5F, 0.5F) .build("penguin")); } -
Check Mod Initialization Order: Ensure that your mod's initialization code is running in the correct order. The entity registration should happen before any events that depend on the entity being registered.
-
Check for Typos or Misconfigurations: Double-check for any typos or misconfigurations in your entity registration code. Ensure that the registry name (
oceancritteria:penguin) matches exactly. -
Debug Logging: Add some debug logging to ensure that the entity registration is happening as expected.
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class ModEntityTypes { @SubscribeEvent public static void onEntityRegister(final RegistryEvent.Register<EntityType<?>> event) { System.out.println("Registering entities for oceancritteria"); event.getRegistry().register(ModEntities.PENGUIN.get()); System.out.println("Registered penguin entity"); } } -
Check for Dependency Issues: Ensure that all dependencies are correctly specified in your
build.gradleorpom.xmlfile. Missing or incorrect dependencies can cause registration issues. -
Check for Conflicting Mods: If you are using other mods, ensure that there are no conflicts or dependencies that might be causing the issue.
-
Check Event Listener Registration: Ensure that the event listener for
EntityAttributeCreationEventis registered correctly and that it is not being called before the entity is registered.@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class ModEventBusEvents { @SubscribeEvent public static void registerAttributes(EntityAttributeCreationEvent event) { event.put(ModEntities.PENGUIN.get(), PenguinEntity.createAttributes().build()); } }
By following these steps, you should be able to identify and fix the issue causing the
NullPointerExceptionrelated to theoceancritteria:penguinregistry object.-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.