Jump to content

Recommended Posts

Posted

I want to add a custom furnace minecart that's just faster. It seems that I did not register it properly, but I just can't find out what I'm doing wrong. If I use "minecraft" as modid and "furnace_minecart" as id in the ModEntities class, the custom minecart spawns. But when I then rejoin the world, it's a vanilla furnace minecart.

My GitHub repository

Error:

java.lang.NullPointerException: Registry Object not present: transportit:furnace_minecart
	at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?] {}
	at net.minecraftforge.registries.RegistryObject.get(RegistryObject.java:204) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23187%23193!/:?] {re:classloading}
	at de.chrisicrafter.transportit.entity.custom.CustomMinecartFurnace.<init>(CustomMinecartFurnace.java:41) ~[%23194!/:?] {re:classloading}
	at de.chrisicrafter.transportit.item.custom.CustomMinecartItem.createMinecart(CustomMinecartItem.java:113) ~[%23194!/:?] {re:classloading}
	at de.chrisicrafter.transportit.item.custom.CustomMinecartItem.useOn(CustomMinecartItem.java:95) ~[%23194!/:?] {re:classloading}
	at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:515) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23187%23193!/:?] {re:classloading}
	at net.minecraft.world.item.ItemStack.useOn(ItemStack.java:250) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading,xf:fml:forge:itemstack}
	at net.minecraft.server.level.ServerPlayerGameMode.useItemOn(ServerPlayerGameMode.java:355) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading}
	at net.minecraft.server.network.ServerGamePacketListenerImpl.handleUseItemOn(ServerGamePacketListenerImpl.java:1034) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading}
	at net.minecraft.network.protocol.game.ServerboundUseItemOnPacket.handle(ServerboundUseItemOnPacket.java:32) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading}
	at net.minecraft.network.protocol.game.ServerboundUseItemOnPacket.handle(ServerboundUseItemOnPacket.java:8) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading}
	at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:23) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading}
	at net.minecraft.server.TickTask.run(TickTask.java:17) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading}
	at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:143) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:22) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:765) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:160) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:116) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:748) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:742) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.thread.BlockableEventLoop.runAllTasks(BlockableEventLoop.java:104) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:727) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:660) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:249) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar%23188!/:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:833) ~[?:?] {}
Posted

I have cloned your mod to debug this locally and I have changed the following line in your main mod class:

// From
ModEntities.register(modEventBus);
// To
ModEntities.ENTITY_TYPES.register(modEventBus);

And you get the following error:

java.lang.NullPointerException: Cannot invoke "net.minecraft.client.renderer.entity.EntityRenderer.shouldRender(net.minecraft.world.entity.Entity, net.minecraft.client.renderer.culling.Frustum, double, double, double)" because "entityrenderer" is null
	at net.minecraft.client.renderer.entity.EntityRenderDispatcher.shouldRender(EntityRenderDispatcher.java:128) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.LevelRenderer.renderLevel(LevelRenderer.java:942) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.renderLevel(GameRenderer.java:1130) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:910) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1211) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:781) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:221) ~[forge-1.20.2-48.0.35_mapped_official_1.20.2-recomp.jar:?] {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.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:98) ~[fmlloader-1.20.2-48.0.35.jar:?] {}
	at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.lambda$makeService$0(CommonLaunchHandler.java:82) ~[fmlloader-1.20.2-48.0.35.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:17) ~[modlauncher-10.1.1.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:40) ~[modlauncher-10.1.1.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:58) ~[modlauncher-10.1.1.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:96) ~[modlauncher-10.1.1.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) ~[modlauncher-10.1.1.jar:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:13) ~[modlauncher-10.1.1.jar:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:10) ~[modlauncher-10.1.1.jar:?] {}
	at net.minecraftforge.bootstrap.BootstrapLauncher.main(BootstrapLauncher.java:126) ~[bootstrap-1.2.0.jar:?] {}

I don't know why you get a different error with technically the same code.

The error I am getting indicates that your custom entity is missing an EntityRenderer, the crash occurs because Minecraft is unable to render the entity.

Posted

Thanks a lot! I added the following line to common setup and now it works :D

EntityRenderers.register(ModEntities.CUSTOM_MINECART_FURNACE.get(), context -> new MinecartRenderer<>(context, ModelLayers.FURNACE_MINECART));

 

  • chrisicrafter27 changed the title to [1.20.2] EntityType - Registry Object not present [SOLVED]
Posted (edited)

I want my custom furnace mincart now to replace the vanilla one. That does work quite good, but I found a problem. I can spawn the custom furnace minecart with the /summon command as well as with the item.

But calling get() on the RegistryObject

CUSTOM_MINECART_FURNACE.get()

or getType() on the entity itself in an event

CustomMinecartFurnace.getType()

both return

EntityType.PIG

and again I just can't figure out why...

However it seems that the following value is ignored, because nothing changes when changing this value regardless if I use "transportit" or "minecraft" as modid of the DeferredRegister. I also know that the resource key of the Entity is "minecraft:entity_type/transportit:furnace_minecart" or "minecraft:entity_type/minecraft:furnace_minecart".

public static final RegistryObject<EntityType<CustomMinecartFurnace>> CUSTOM_MINECART_FURNACE = VANILLA_ENTITY_TYPES.register("furnace_minecart",
() -> EntityType.Builder.<CustomMinecartFurnace>of(CustomMinecartFurnace::new, MobCategory.MISC)
  .sized(0.98F, 0.7F).clientTrackingRange(8)
  .build(/*This value seems to be ignored*/"furnace_minecart"));


(GitHub)

Edited by chrisicrafter27
  • chrisicrafter27 changed the title to [1.20.2] Registering EntityType Problems
Posted (edited)

Debug Log:

debug_log.txt

Lines with "pig":

Spoiler
645: [11Nov.2023 20:03:31.768] [Render thread/DEBUG] [net.minecraftforge.registries.ForgeRegistry/REGISTRIES]: Registry minecraft:entity_type Override: minecraft:furnace_minecart entity.minecraft.furnace_minecart -> entity.minecraft.pig

910: [11Nov.2023 20:03:33.369] [modloading-worker-0/DEBUG] [net.minecraftforge.registries.ForgeRegistry/REGISTRIES]: Registry minecraft:entity_type Override: minecraft:furnace_minecart entity.minecraft.furnace_minecart -> entity.minecraft.pig

973: [12Nov.2023 09:57:30.450] [Render thread/DEBUG] [net.minecraftforge.registries.ForgeRegistry/REGISTRIES]: Registry minecraft:entity_type Override: minecraft:furnace_minecart entity.minecraft.furnace_minecart -> entity.minecraft.pig

984: [12Nov.2023 09:57:30.475] [Render thread/DEBUG] [net.minecraftforge.registries.ForgeRegistry/REGISTRIES]: Registry minecraft:entity_type Override: minecraft:furnace_minecart entity.minecraft.furnace_minecart -> entity.minecraft.pig

1112: [12Nov.2023 09:58:00.849] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: [Dev: Summoned new Pig]
[12Nov.2023 09:58:00.855] [Render thread/INFO] [net.minecraft.client.gui.components.ChatComponent/]: [System] [CHAT] Summoned new Pig
[12Nov.2023 09:58:12.973] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: [Dev: Killed Pig]
[12Nov.2023 09:58:12.973] [Render thread/INFO] [net.minecraft.client.gui.components.ChatComponent/]: [System] [CHAT] Killed Pig

1142: [12Nov.2023 09:58:18.532] [Server thread/DEBUG] [net.minecraftforge.registries.ForgeRegistry/REGISTRIES]: Registry minecraft:entity_type Override: minecraft:furnace_minecart entity.minecraft.furnace_minecart -> entity.minecraft.pig

In this run I summoned and killed my custom entity via /summon minecraft:furnace_minecart and /kill command. (And I did not summon a pig)

Edited by chrisicrafter27
Posted

The registry override seems to be working but vanilla has a problem to use the override instead the default entity the pig is used.

Have you tried to use debugger to find the cause why vanilla uses the big instead of your entity?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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