Untitled conversation
- User
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
[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;
}
}
Okay, let's break down this Minecraft Forge mod crash and how to fix it.
Understanding the Error
The error message java.lang.NullPointerException: Registry Object not present: oceancritteria:penguin is a very common one in Forge modding. It means that your mod is trying to use the penguin entity (specifically, get a reference to it) before Minecraft's registry has fully registered it. The registry is where Minecraft keeps track of all the things in the game (entities, items, blocks, etc.).
Here's what's happening in the stack trace:
net.mattias.oceancritteria.event.ModEventBusEvents.registerAttributes: This is where the error originates. Your mod is trying to modify the attributes (health, speed, etc.) of the penguin entity.RegistryObject.get(): Inside registerAttributes, you're using ModEntities.PENGUIN.get() to get the actual EntityType for the penguin. This is the line that's failing because the penguin hasn't been registered yet.EntityAttributeCreationEvent is fired early in the mod loading process, before all entities are guaranteed to be registered.The Fix
You need to ensure that your entity is registered before you try to access it in event handlers like registerAttributes. There are a few ways to do this, but the most reliable is to use the DeferredRegister system provided by Forge.
Here's how to modify your code:
1. Modify your ModEventBusEvents class:
package net.mattias.oceancritteria.event;
import net.mattias.oceancritteria.OceanCritteria;
import net.mattias.oceancritteria.entity.ModEntities;
import net.minecraftforge.event.entity.EntityAttributeCreationEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber(modid = OceanCritteria.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
public class ModEventBusEvents {
@SubscribeEvent
public static void registerAttributes(EntityAttributeCreationEvent event) {
event.register(ModEntities.PENGUIN.get(), PenguinEntity::createAttributes);
}
}
2. Ensure Proper Registration in your main mod class (OceanCritteria.java or similar):
package net.mattias.oceancritteria;
import net.mattias.oceancritteria.entity.ModEntities;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetup;
import net.minecraftforge.fml.event.lifecycle.InterModComms;
import net.minecraftforge.fml.javafmlmod.ModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@Mod(OceanCritteria.MOD_ID)
public class OceanCritteria {
public static final String MOD_ID = "oceancritteria";
private static final Logger LOGGER = LogManager.getLogger();
public OceanCritteria() {
ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.COMMON, OceanCritteriaConfig.CONFIG);
}
@SubscribeEvent
public void setup(FMLCommonSetup event) {
ModEntities.register(); // This is crucial!
}
@SubscribeEvent
public void intermodCommunicate(InterModComms.InterModEnqueueEvent event) {
}
}
3. Create a ModEntities class to handle entity registration:
package net.mattias.oceancritteria.entity;
import net.mattias.oceancritteria.OceanCritteria;
import net.mattias.oceancritteria.entity.custom.PenguinEntity;
import net.minecraft.world.entity.EntityType;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
@Mod.EventBusSubscriber(modid = OceanCritteria.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
public class ModEntities {
public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, OceanCritteria.MOD_ID);
public static final EntityType<PenguinEntity> PENGUIN = ENTITIES.register("penguin", () -> EntityType.Builder.of(PenguinEntity::new, MobCategory.CREATURE).build());
public static void register() {
ENTITIES.register();
}
}
Explanation of Changes
DeferredRegister: DeferredRegister is a Forge mechanism that delays the actual registration of your entities until the appropriate time during mod loading. This ensures that everything is registered in the correct order.ENTITIES.register(): This line in ModEntities.register() actually performs the registration. You call this in your FMLCommonSetup event handler.ModEntities.PENGUIN.get() in registerAttributes: Now, when you call ModEntities.PENGUIN.get() in registerAttributes, the penguin entity will be registered because you've called ModEntities.register() earlier in the mod loading process.MobCategory.CREATURE: This specifies the category of the entity (creature, monster, ambient, etc.). Choose the appropriate category for your penguin.Important Considerations
ModEntities.register() in FMLCommonSetup before any other code that tries to use the penguin entity.LOGGER.info("Penguin entity registered!"); after the ENTITIES.register() call.Let me know if you have any other questions or if you're still encountering issues after trying these steps. I'm here to help!