Posted August 29, 20178 yr How can I get AbstractClientPlayer? Minecraft.getMinecraft().player isn't the right one, even tho it's accepted... I need it for drawing an object
August 29, 20178 yr Minecraft.getMinecraft().player is an EntityPlayerSP which is a AbstractClientPlayer (see inheritance hierarchy below). Why do you say it isn't the right one?
August 29, 20178 yr Author 7 hours ago, lexy said: Minecraft.getMinecraft().player is an EntityPlayerSP which is a AbstractClientPlayer (see inheritance hierarchy below). Why do you say it isn't the right one? Well... to be honest, I don't think that my assumption that it wasn't the correct one was correct, but when I try it with Minecraft.player, I get NPE. And I'm 100% sure that I call it when it's not null
August 29, 20178 yr 1 minute ago, MGlolenstine said: Well... to be honest, I don't think that my assumption that it wasn't the correct one was correct, but when I try it with Minecraft.player, I get NPE. And I'm 100% sure that I call it when it's not null Post your code and the exception using Gist/Pastebin. What do you need the player for? Why does it need to be an AbstractClientPlayer specifically? Edited August 29, 20178 yr by Choonster Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
August 30, 20178 yr Author Ok, so I'm trying to use Minecraft's deadmou5e ears code, so I copy-pasted code from Minecraft's class into my class, and it requires AbstractClientPlayer. public static void renderEars(AbstractClientPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { if (entitylivingbaseIn.hasSkin() && !entitylivingbaseIn.isInvisible()) { playerRenderer.bindTexture(entitylivingbaseIn.getLocationSkin()); for (int i = 0; i < 2; ++i) { float f = entitylivingbaseIn.prevRotationYaw + (entitylivingbaseIn.rotationYaw - entitylivingbaseIn.prevRotationYaw) * partialTicks - (entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks); float f1 = entitylivingbaseIn.prevRotationPitch + (entitylivingbaseIn.rotationPitch - entitylivingbaseIn.prevRotationPitch) * partialTicks; GlStateManager.pushMatrix(); GlStateManager.rotate(f, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(f1, 1.0F, 0.0F, 0.0F); GlStateManager.translate(0.375F * (float)(i * 2 - 1), 0.0F, 0.0F); GlStateManager.translate(0.0F, -0.375F, 0.0F); GlStateManager.rotate(-f1, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(-f, 0.0F, 1.0F, 0.0F); float f2 = 1.3333334F; GlStateManager.scale(1.3333334F, 1.3333334F, 1.3333334F); playerRenderer.getMainModel().renderDeadmau5Head(0.0625F); GlStateManager.popMatrix(); } } }
August 30, 20178 yr 1 hour ago, MGlolenstine said: Ok, so I'm trying to use Minecraft's deadmou5e ears code, so I copy-pasted code from Minecraft's class into my class, and it requires AbstractClientPlayer. Where are you calling this from? Which player are you trying to render the ears for? Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
August 31, 20178 yr Author I only want to render ears for the local player and I'm calling it from RenderLivingEvent.Post event
August 31, 20178 yr 14 minutes ago, MGlolenstine said: I only want to render ears for the local player and I'm calling it from RenderLivingEvent.Post event Use RenderLivingEvent#getEntity to get the entity being rendered, check if it's the client player (Minecraft#player) and then cast it to AbstractClientPlayer before rendering the ears. Since you're only rendering this for a player, it's probably best to subscribe to RenderPlayerEvent.Post instead of RenderLivingEvent.Post. This is only fired for players rather than every living entity. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
August 31, 20178 yr Author Just now, Choonster said: Use RenderLivingEvent#getEntity to get the entity being rendered, check if it's the client player (Minecraft#player) and then cast it to AbstractClientPlayer before rendering the ears. Since you're only rendering this for a player, it's probably best to subscribe to RenderPlayerEvent.Post instead of RenderLivingEvent.Post. This is only fired for players rather than every living entity. Thank you!
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.