Posted May 20, 201510 yr Hello, what I'm trying to do is change the player model by using forge events to override the players pre-rendering. I have the event handler setup and working, (aka registered correctly, as I tested other things and they work just fine) but I can't seem to figure out how to actually render a new model instead of the normal player. I have one of the things I've tried below, which is what I'm finding everywhere that apparently should work, but instead locks up the game and spams the same crash message. Here is my event handler class... public class PreRenderEvent { RenderManager manager = Minecraft.getMinecraft().getRenderManager(); @SubscribeEvent public void preRenderPlayer(RenderLivingEvent.Pre event) { if (!(event.entity instanceof EntityPlayer)) return; event.setCanceled(true); new RenderPlayer(manager).doRender(event.entity, 0d, 0d, 0d, 0f, 0f); } } And here is the crash message.. at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_PreRenderEvent_preRenderPlayer_Pre.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138) ~[EventBus.class:?] at net.minecraft.client.renderer.entity.RendererLivingEntity.doRender(RendererLivingEntity.java:100) ~[RendererLivingEntity.class:?] at net.minecraft.client.renderer.entity.RenderPlayer.func_180596_a(RenderPlayer.java:70) ~[RenderPlayer.class:?] at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:244) ~[RenderPlayer.class:?] at teampap.villager.events.PreRenderEvent.preRenderPlayer(PreRenderEvent.java:18) ~[PreRenderEvent.class:?]
May 20, 201510 yr new RenderPlayer(manager).doRender(event.entity, 0d, 0d, 0d, 0f, 0f); Don't do this ;_; (new every frame) There is RenderPlayerEvent - use that one. 1.7.10 is no longer supported by forge, you are on your own.
May 20, 201510 yr Author Okay. @SubscribeEvent public void preRenderPlayer(RenderPlayerEvent.Pre event) { System.out.println("I'm working"); } Doesn't get called? =/ And how would I go about changing the player model then?
May 20, 201510 yr Build 1.8-11.14.1.1354: ohai.iChun: Readded but deprecated the old RenderPlayerEvent that were deleted. Sorry, Lex. Build 1.8-11.14.1.1353: ohai.iChun: Reimplement RenderPlayerEvent that was removed in the port to 1.8 from 1.7.10. RenderPlayerEvent.Specials was removed because the special effects are done in the LayerRenderer now. Is it possible that you are outdated? Also - I hope you are registering event in client proxy. Extend RenderPlayer and alter anything you want, Model, whatever. DO NOT make "new" every frame, declare static firld for your extending class. EDIT And btw. you HAVE TO use x/y/z from event, not zeros. 1.7.10 is no longer supported by forge, you are on your own.
May 20, 201510 yr Author Please be more specific. new RenderPlayer(manager).doRender(event.entity, 0d, 0d, 0d, 0f, 0f); Okay, then I ask how do I change the model.. response: Extend RenderPlayer and alter anything you want, Model, whatever. So.... when do I use my renderer?
May 21, 201510 yr Author Build 1.8-11.14.1.1354: ohai.iChun: Readded but deprecated the old RenderPlayerEvent that were deleted. Sorry, Lex. Build 1.8-11.14.1.1353: ohai.iChun: Reimplement RenderPlayerEvent that was removed in the port to 1.8 from 1.7.10. RenderPlayerEvent.Specials was removed because the special effects are done in the LayerRenderer now. Is it possible that you are outdated? Also - I hope you are registering event in client proxy. Extend RenderPlayer and alter anything you want, Model, whatever. DO NOT make "new" every frame, declare static firld for your extending class. EDIT And btw. you HAVE TO use x/y/z from event, not zeros. Okay, I've tried doing it that way, but it seems any time I can get it to render without catching at nulls or anything, it simply gets stuck on the loop mentioned in the OP. @SubscribeEvent public void preRenderPlayer(RenderLivingEvent.Pre event) { if (!(event.entity instanceof EntityPlayer)) return; if(Villager.newModel == null) return; if(Villager.manager == null) return; event.setCanceled(true); Villager.newModel.doRender(event.entity, event.x, event.y, event.z, 0f, 0f); }
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.