Jump to content

Recommended Posts

Posted (edited)

Just search in your IDE for RenderEvent (Type "RenderEvent" and press Ctrl + Space, then something like EntityRenderEvent should show up)

Edited by OutCraft

Sorry if my Posts are weird sometimes, I just try to help and learn as much as I can :D

Also: PLEASE use SPOILERS for logs!

Posted
5 minutes ago, OutCraft said:

Just search in your IDE for RenderEvent (Type "RenderEvent" and press Ctrl + Space, then something like EntityRenderEvent should show up)

QQ%E6%88%AA%E5%9B%BE20211225195456.png

 

No

Posted

The class is here:

net.minecraftforge.client.event.EntityRenderersEvent

try

	@SubscribeEvent
	public static void registerEntityRenders(net.minecraftforge.client.event.EntityRenderersEvent.RegisterRenderers event) {
		event.registerEntityRenderer(EntityList.FIRE_CRACKER.get(), ThrownItemRenderer::new);
	}

 

Sorry if my Posts are weird sometimes, I just try to help and learn as much as I can :D

Also: PLEASE use SPOILERS for logs!

Posted
12 minutes ago, OutCraft said:

The class is here:

net.minecraftforge.client.event.EntityRenderersEvent

try

	@SubscribeEvent
	public static void registerEntityRenders(net.minecraftforge.client.event.EntityRenderersEvent.RegisterRenderers event) {
		event.registerEntityRenderer(EntityList.FIRE_CRACKER.get(), ThrownItemRenderer::new);
	}

 

not work.Very strange

Posted

Yes, very strange...

If you have Discord try going on the official Discord server of Forge, they have a bot that gets the name of a class for each Version (I don't have Discord, so I don't know how this works...)

Sorry if my Posts are weird sometimes, I just try to help and learn as much as I can :D

Also: PLEASE use SPOILERS for logs!

Posted
1 minute ago, OutCraft said:

Yes, very strange...

If you have Discord try going on the official Discord server of Forge, they have a bot that gets the name of a class for each Version (I don't have Discord, so I don't know how this works...)

Where is this code in vanilla, let me see

Posted

package net.minecraft.client.renderer.entity.EntityRenderers

at the bottom

Sorry if my Posts are weird sometimes, I just try to help and learn as much as I can :D

Also: PLEASE use SPOILERS for logs!

Posted (edited)
8 minutes ago, OutCraft said:

package net.minecraft.client.renderer.entity.EntityRenderers

at the bottom

you forge version?Detailed version like this: 1.16.5-36.2.2

Edited by Spring
Posted (edited)

Hi! So apparently in 1.16.5 you don't use EntityRenderers and my mod was on 1.17. So you need to update or use

SpriteRenderer<>(EntityRendererManager, net.minecraft.client.renderer.ItemRenderer)

but I have no Idea how to use this :(

Sorry that I didn't realized this until now

Edited by OutCraft

Sorry if my Posts are weird sometimes, I just try to help and learn as much as I can :D

Also: PLEASE use SPOILERS for logs!

Posted
    @Override
    public IPacket<?> getAddEntityPacket() {
        return NetworkHooks.getEntitySpawningPacket(this);
    }

You need to add this into your entity class for the spawning to actually work, if your parent class doesn't have a implementation for this that works.

It gets me everytime.

Posted
18 hours ago, LocusAzzurro said:
    @Override
    public IPacket<?> getAddEntityPacket() {
        return NetworkHooks.getEntitySpawningPacket(this);
    }

You need to add this into your entity class for the spawning to actually work, if your parent class doesn't have a implementation for this that works.

It gets me everytime.

java.lang.NullPointerException: Cannot invoke "net.minecraft.client.renderer.entity.EntityRenderer.shouldRender(net.minecraft.entity.Entity, net.minecraft.client.renderer.culling.ClippingHelper, double, double, double)" because "entityrenderer" is null
	at net.minecraft.client.renderer.entity.EntityRendererManager.shouldRender(EntityRendererManager.java:238) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.WorldRenderer.renderLevel(WorldRenderer.java:987) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.renderLevel(GameRenderer.java:608) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:425) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:976) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:607) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-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.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:108) [forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {}

 

He broke down

Posted (edited)
1 hour ago, Spring said:
java.lang.NullPointerException: Cannot invoke "net.minecraft.client.renderer.entity.EntityRenderer.shouldRender(net.minecraft.entity.Entity, net.minecraft.client.renderer.culling.ClippingHelper, double, double, double)" because "entityrenderer" is null
	at net.minecraft.client.renderer.entity.EntityRendererManager.shouldRender(EntityRendererManager.java:238) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.WorldRenderer.renderLevel(WorldRenderer.java:987) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.renderLevel(GameRenderer.java:608) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:425) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:976) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:607) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-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.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:108) [forge-1.16.5-36.2.2_mapped_official_1.16.5-recomp.jar:?] {}

 

He broke down

At least that means you're making some progress, because without the packet the (logical) client won't even know that the entity is spawned so it should render it. And there was no way to know if your renderer/model is done correctly because it never gets to that stage. (What the packet does is notify the client when an entity is spawned to start the rendering.)

Now we know from the crash that you have something wrong in your renderer. Here is my checklist that I go thru when making en entity.

  • Make the actual entity class.
  • Make sure it has the spawning packet and data syncing.
  • Register the EntityType for that entity. (In turn make sure the registry itself is registered too. I see you've done it.)
  • Make the Model class for the entity. (Usually extends EntityModel.)
  • Make the Renderer class for the above model and entity. (Usually extends EntityRenderer.) (You can skip these 2 steps if you're using a built-in renderer like the thrown item one as I can see.)
  • Actually register the renderer itself. (During FMLClientSetupEvent call
    RenderingRegistry.registerEntityRenderingHandler([your EntityType], [a new instance of your Renderer]);

    (It is fired on the MOD Bus, client side, make sure to handle that as well.)

 

Edited by LocusAzzurro
Posted
21 hours ago, LocusAzzurro said:

At least that means you're making some progress, because without the packet the (logical) client won't even know that the entity is spawned so it should render it. And there was no way to know if your renderer/model is done correctly because it never gets to that stage. (What the packet does is notify the client when an entity is spawned to start the rendering.)

Now we know from the crash that you have something wrong in your renderer. Here is my checklist that I go thru when making en entity.

  • Make the actual entity class.
  • Make sure it has the spawning packet and data syncing.
  • Register the EntityType for that entity. (In turn make sure the registry itself is registered too. I see you've done it.)
  • Make the Model class for the entity. (Usually extends EntityModel.)
  • Make the Renderer class for the above model and entity. (Usually extends EntityRenderer.) (You can skip these 2 steps if you're using a built-in renderer like the thrown item one as I can see.)
  • Actually register the renderer itself. (During FMLClientSetupEvent call
    RenderingRegistry.registerEntityRenderingHandler([your EntityType], [a new instance of your Renderer]);

    (It is fired on the MOD Bus, client side, make sure to handle that as well.)

 

You are right, he works now

Posted

One thing: When I copied your code and throwed the firecracker, it didn't kill itself when it hit a block, it just went through the block, what it, I suppose, shouldn't do. So don't forget to kill it in the hit block event

Sorry if my Posts are weird sometimes, I just try to help and learn as much as I can :D

Also: PLEASE use SPOILERS for logs!

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.