Jump to content

RenderLivingEvent never runs.


goodiesohhi

Recommended Posts

I have this block:

 

@SideOnly(Side.CLIENT)
    @SubscribeEvent
        public void entityLivingRender(RenderLivingEvent<EntityLivingBase> event)  {
        EntityLivingBase e = event.getEntity();
    RenderLivingBase<EntityLivingBase> r = event.getRenderer();

    drawTexturedQuadFit(e.getPosition().getX(), e.getPosition().getY(), 4, 2, e.getPosition().getZ());
    r.getFontRendererFromRenderManager().drawStringWithShadow("HP:" + e.getHealth()+"/"+e.getMaxHealth(), e.getPosition().getX(), e.getPosition().getY()+10, 0xFFFFFF);
       
    System.out.println("HELLLLLLLLLLO");
    int i = 0;
    i/=0;
        
    }

@SideOnly(Side.CLIENT)
	@SubscribeEvent
		public void entityLivingRender(RenderLivingEvent<EntityLivingBase> event)  {
		EntityLivingBase e = event.getEntity();
	RenderLivingBase<EntityLivingBase> r = event.getRenderer();

	drawTexturedQuad(e.getPosition().getX(), e.getPosition().getY(), 4, 2, e.getPosition().getZ());
	r.getFontRendererFromRenderManager().drawStringWithShadow("HP:" + e.getHealth()+"/"+e.getMaxHealth(), e.getPosition().getX(), e.getPosition().getY()+10, 0xFFFFFF);
       
	System.out.println("HELLLLLLLLLLO");
	int i = 0;
	i/=0;
		
	}

in the same class as all my other working Subscribed Events.

Does it have to be somewhere else?

I have it log  a string but nothing shows up in console. I even have it divide by zero but no dividebyzero error is thrown..

Link to comment
Share on other sites

58 minutes ago, goodiesohhi said:

 in the same class as all my other working Subscribed Events.

How did you register your event class if you used EventBusSubscriber you need to make your method static.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

2 hours ago, Animefan8888 said:

How did you register your event class if you used EventBusSubscriber you need to make your method static.

Really? None of my other methods are static. Lemme try this.

EDIT: Nope. Didn't do anything.

Edited by goodiesohhi
Update
Link to comment
Share on other sites

26 minutes ago, goodiesohhi said:

Really? None of my other methods are static. Lemme try this.

You didnt answer my question.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Just now, Animefan8888 said:

You didnt answer my question.

Sorry. I assumed it can be inferred. I have a class with the @EventBusSubscriber annotation.

It's registered in my common proxy init like so: MinecraftForge.EVENT_BUS.register(new MyEventHandler());

All my SubscribeEvents are in this class.

Link to comment
Share on other sites

I create an empty RenderLivingEvent.

and it doesn't register and I get

 

 Error registering event handler: FMLMod:pushthelinemc{1.1} class net.minecraftforge.client.event.RenderLivingEvent public void com.foxfyre.pushtheline.MyEventHandler.entityLivingRender(net.minecraftforge.client.event.RenderLivingEvent)
java.lang.InstantiationException: null
	at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_181]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181]
	at net.minecraftforge.fml.common.eventhandler.EventBus.register(EventBus.java:130) [EventBus.class:?]
	at net.minecraftforge.fml.common.eventhandler.EventBus.register(EventBus.java:112) [EventBus.class:?]
	at com.foxfyre.pushtheline.ExampleMod.init(ExampleMod.java:88) [ExampleMod.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
	at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:626) [FMLModContainer.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) [guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) [guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) [guava-21.0.jar:?]
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) [guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) [guava-21.0.jar:?]
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) [guava-21.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:217) [guava-21.0.jar:?]
	at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:218) [LoadController.class:?]
	at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:196) [LoadController.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) [guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) [guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) [guava-21.0.jar:?]
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) [guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) [guava-21.0.jar:?]
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) [guava-21.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:217) [guava-21.0.jar:?]
	at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135) [LoadController.class:?]
	at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:744) [Loader.class:?]
	at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:336) [FMLClientHandler.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:581) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]

as the stacktrace. I've done nothing different compared to my other handler.

Link to comment
Share on other sites

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.