Jump to content

Recommended Posts

Posted

In my mod, I'm trying to cancel the default player rendering and rendering my own model.

 

The problem I'm having, is that in the pre event, I cancel it. Because of that, it cancels the post event too, which my rendering code is in.

 

package net.rpg.handler;

import net.minecraftforge.client.event.RenderPlayerEvent;
import net.rpg.Util;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class PlayerRenderHandler {
@SubscribeEvent
public void renderPrePlayer(RenderPlayerEvent.Pre event) {
	if(!Util.isNewPlayer(event.entityPlayer)) {
		event.setCanceled(true);
	}
}

@SubscribeEvent
public void renderPostPlayer(RenderPlayerEvent.Post event) {
	if(!Util.isNewPlayer(event.entityPlayer)) {
		//Render player
	}
}
}

Kain

Posted

I'll do that for now I guess, someone in the past told me to always do extra rendering in the post event and canceling in the pre event.

What they probably meant is that if you intend to cancel the event, you can only do so in Pre, but if you just want to add some extra rendering on top of the normal player rendering, to do it in Post after the rest of the player renders, though there is nothing stopping you from doing that rendering in Pre as well, and, indeed, if you are canceling the Pre then the Post won't get called, meaning in such a case you must render in Pre.

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.