Spaceboy Ross Posted September 17, 2018 Share Posted September 17, 2018 I've added the onRender event to my code but I cannot figure out how to render a different texture and change the player size. Quote The official YouTuber Spaceboy Ross Link to comment Share on other sites More sharing options...
jabelar Posted September 18, 2018 Share Posted September 18, 2018 Ummm...bind a different texture and use GL11 scaling methods? Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/ Link to comment Share on other sites More sharing options...
Spaceboy Ross Posted September 18, 2018 Author Share Posted September 18, 2018 (edited) It crashed for me. GitHub: https://github.com/SpaceboyRoss01/MSGundamMod. @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Post event) { EntityPlayer player = event.getEntityPlayer(); IHumanCapability nt = Human.getHuman(player); MobileSuit.MSMob msmob = nt.getMS(); if(msmob != null) { MobileSuit ms = msmob.getMSRegistryEntry(); ResourceLocation texture = new ResourceLocation(ms.getBaseResourceLocation()+".png"); event.getRenderer().bindTexture(texture); GL11.glScalef(msmob.scale,msmob.scale,msmob.scale); } } Edited September 18, 2018 by Spaceboy Ross Quote The official YouTuber Spaceboy Ross Link to comment Share on other sites More sharing options...
Animefan8888 Posted September 18, 2018 Share Posted September 18, 2018 17 minutes ago, Spaceboy Ross said: It crashed for me. GitHub: https://github.com/SpaceboyRoss01/MSGundamMod. @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Post event) { EntityPlayer player = event.getEntityPlayer(); IHumanCapability nt = Human.getHuman(player); MobileSuit.MSMob msmob = nt.getMS(); if(msmob != null) { MobileSuit ms = msmob.getMSRegistryEntry(); ResourceLocation texture = new ResourceLocation(ms.getBaseResourceLocation()+".png"); event.getRenderer().bindTexture(texture); GL11.glScalef(msmob.scale,msmob.scale,msmob.scale); } } Something is null on this line. Quote 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 More sharing options...
Spaceboy Ross Posted September 18, 2018 Author Share Posted September 18, 2018 Ok, it's no longer null but the player is still the same size and still has the same skin. How do I render the new skin and entity size? Quote The official YouTuber Spaceboy Ross Link to comment Share on other sites More sharing options...
Animefan8888 Posted September 18, 2018 Share Posted September 18, 2018 6 minutes ago, Spaceboy Ross said: Ok, it's no longer null but the player is still the same size and still has the same skin. How do I render the new skin and entity size? You have to use the Pre event render it yourself and then cancel the actual rendering from happening. Quote 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 More sharing options...
Spaceboy Ross Posted September 18, 2018 Author Share Posted September 18, 2018 Ok, got the scaling to work but I cannot get the custom skin to work. Quote The official YouTuber Spaceboy Ross Link to comment Share on other sites More sharing options...
Animefan8888 Posted September 18, 2018 Share Posted September 18, 2018 6 minutes ago, Spaceboy Ross said: Ok, got the scaling to work but I cannot get the custom skin to work. *doesn't see code* Cool Quote 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 More sharing options...
Spaceboy Ross Posted September 18, 2018 Author Share Posted September 18, 2018 @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Pre event) { EntityPlayer player = event.getEntityPlayer(); IHumanCapability nt = Human.getHuman(player); MobileSuit.MSMob msmob = nt.getMS(); if(msmob != null) { MobileSuit ms = msmob.getMSRegistryEntry(); event.getRenderer().bindTexture(new ResourceLocation(ms.getBaseResourceLocation()+".png")); GL11.glScalef(msmob.scale,msmob.scale,msmob.scale); event.setCanceled(true); } } Quote The official YouTuber Spaceboy Ross Link to comment Share on other sites More sharing options...
Animefan8888 Posted September 18, 2018 Share Posted September 18, 2018 15 minutes ago, Spaceboy Ross said: @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Pre event) { EntityPlayer player = event.getEntityPlayer(); IHumanCapability nt = Human.getHuman(player); MobileSuit.MSMob msmob = nt.getMS(); if(msmob != null) { MobileSuit ms = msmob.getMSRegistryEntry(); event.getRenderer().bindTexture(new ResourceLocation(ms.getBaseResourceLocation()+".png")); GL11.glScalef(msmob.scale,msmob.scale,msmob.scale); event.setCanceled(true); } } You did one of the three things I said. 31 minutes ago, Animefan8888 said: You have to use the Pre event render it yourself and then cancel the actual rendering from happening. Quote 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 More sharing options...
Spaceboy Ross Posted September 18, 2018 Author Share Posted September 18, 2018 It's still not working. @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Pre event) { EntityPlayer player = event.getEntityPlayer(); IHumanCapability nt = Human.getHuman(player); MobileSuit.MSMob msmob = nt.getMS(); if(msmob != null) { MobileSuit ms = msmob.getMSRegistryEntry(); GL11.glScalef(msmob.scale,msmob.scale,msmob.scale); event.getRenderer().bindTexture(new ResourceLocation(ms.getBaseResourceLocation()+".png")); event.getRenderer().doRender((AbstractClientPlayer)player,event.getX(),event.getY(),event.getZ(),player.cameraYaw,event.getPartialRenderTick()); event.setCanceled(true); } } Quote The official YouTuber Spaceboy Ross Link to comment Share on other sites More sharing options...
Animefan8888 Posted September 18, 2018 Share Posted September 18, 2018 1 hour ago, Spaceboy Ross said: It's still not working. Define not working. 1 Quote 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 More sharing options...
Spaceboy Ross Posted September 18, 2018 Author Share Posted September 18, 2018 How do I make it work? Quote The official YouTuber Spaceboy Ross Link to comment Share on other sites More sharing options...
Animefan8888 Posted September 18, 2018 Share Posted September 18, 2018 9 minutes ago, Spaceboy Ross said: How do I make it work? Define not working 1 Quote 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 More sharing options...
Spaceboy Ross Posted September 18, 2018 Author Share Posted September 18, 2018 11 minutes ago, Animefan8888 said: Define not working Provide me with a fix!! Quote The official YouTuber Spaceboy Ross Link to comment Share on other sites More sharing options...
Draco18s Posted September 18, 2018 Share Posted September 18, 2018 A fix to what? What's broken? You haven't given us any information about how to diagnose what's wrong. All you've said is "doctor, it hurts." 1 Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given. Link to comment Share on other sites More sharing options...
Spaceboy Ross Posted September 18, 2018 Author Share Posted September 18, 2018 The game freezes when my code runs. @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Pre event) { EntityPlayer player = event.getEntityPlayer(); IHumanCapability nt = Human.getHuman(player); MobileSuit.MSMob msmob = nt.getMS(); if(msmob != null) { MobileSuit ms = msmob.getMSRegistryEntry(); GL11.glScalef(msmob.scale,msmob.scale,msmob.scale); event.getRenderer().bindTexture(new ResourceLocation(ms.getBaseResourceLocation()+".png")); event.getRenderer().doRender((AbstractClientPlayer)player,event.getX(),event.getY(),event.getZ(),player.cameraYaw,event.getPartialRenderTick()); event.setCanceled(true); } } Quote The official YouTuber Spaceboy Ross Link to comment Share on other sites More sharing options...
Animefan8888 Posted September 18, 2018 Share Posted September 18, 2018 (edited) 5 minutes ago, Spaceboy Ross said: The game freezes when my code runs. You're causing an infinite loop of code by calling event.getRenderer().doRender. Edited September 18, 2018 by Animefan8888 Typo Quote 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 More sharing options...
Spaceboy Ross Posted September 18, 2018 Author Share Posted September 18, 2018 Well, how do I actually render the player? Quote The official YouTuber Spaceboy Ross Link to comment Share on other sites More sharing options...
Animefan8888 Posted September 18, 2018 Share Posted September 18, 2018 Just now, Spaceboy Ross said: Well, how do I actually render the player? 2 hours ago, Animefan8888 said: You have to use the Pre event render it yourself and then cancel the actual rendering from happening. Write the code. Quote 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 More sharing options...
Spaceboy Ross Posted September 18, 2018 Author Share Posted September 18, 2018 What does rendering it mean? I've canceled the game from rendering the player. Quote The official YouTuber Spaceboy Ross Link to comment Share on other sites More sharing options...
Animefan8888 Posted September 18, 2018 Share Posted September 18, 2018 1 minute ago, Spaceboy Ross said: What does rendering it mean? I've canceled the game from rendering the player. You want to change the texture for the player and edit the scale. Ok. Editing the scale is easy enough as you already found out. But you cant bind the texture you want because it is bound in the vanilla code you dont have access to. So you have to cancel the vanilla rendering which you have done and then render the player yourself with your own code, using your texture. Quote 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 More sharing options...
ZDoctor Posted September 18, 2018 Share Posted September 18, 2018 (edited) From what I can see and understand, you are trying to use the default Minecraft player model as your base model, but you are using the default renderer to do it. You can use the MC player model, but you would need to copy it and change the relevant parts, such as what texture is bound to the gl, scale etc. And then render that instead. The renderer is connected to the default mc model which also hard codes it's texture. That's the easy way, or you can just code the model in yourself. Edited September 18, 2018 by ZDoctor Added Quote Link to comment Share on other sites More sharing options...
Spaceboy Ross Posted September 18, 2018 Author Share Posted September 18, 2018 It doesn't render correctly and it renders upsidedown. GitHub: https://github.com/SpaceboyRoss01/MSGundamMod To recreate the bug, right click on an entity called RX-78-2 Gundam. @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Pre event) { EntityPlayer player = event.getEntityPlayer(); IHumanCapability nt = Human.getHuman(player); MobileSuit.MSMob msmob = nt.getMS(); if(msmob != null) { MobileSuit ms = msmob.getMSRegistryEntry(); event.getRenderer().bindTexture(new ResourceLocation(ms.getBaseResourceLocation()+".png")); event.setCanceled(true); GlStateManager.pushMatrix(); event.getRenderer().getMainModel().bipedHead.render(0.0625F*msmob.scale); event.getRenderer().getMainModel().bipedBody.render(0.0625F*msmob.scale); event.getRenderer().getMainModel().bipedLeftLeg.render(0.0625F*msmob.scale); event.getRenderer().getMainModel().bipedRightLeg.render(0.0625F*msmob.scale); event.getRenderer().getMainModel().bipedLeftArm.render(0.0625F*msmob.scale); event.getRenderer().getMainModel().bipedRightArm.render(0.0625F*msmob.scale); GlStateManager.popMatrix(); } } Quote The official YouTuber Spaceboy Ross Link to comment Share on other sites More sharing options...
ZDoctor Posted September 19, 2018 Share Posted September 19, 2018 (edited) That's something I never understood as to why (but never bothered to look into it too hard) it happens, but what I do is just Rotate the gl 180 and that should fix it. I assume somewhere in the vanilla code something does that, but I haven't found it. Edited September 19, 2018 by ZDoctor Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.