Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

Minecraft.getMinecraft().player is an EntityPlayerSP which is a AbstractClientPlayer (see inheritance hierarchy below). Why do you say it isn't the right one?

entityPlayerSP inheritance hierarchy.PNG

  • 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?

entityPlayerSP inheritance hierarchy.PNG

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

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 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.

  • 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();
            }
        }
    }

 

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.

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.

  • 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.

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.