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

The reason for my question is that you used to be able in a TickHandler to specify capes by changing the cloakUrl in EntityPlayer and then using "Minecraft.getMinecraft().renderEngine.obtainImageData(player.cloakUrl, new ImageBufferDownload());" to download the image.

 

cloakUrl seems to have moved, or minecraft has changed the way it handles them. If anyone can point me in the right direction I would be very grateful.

 

-Pow3rCut

If I helped you click the Thank You button

  • Author

I was wondering this as well.

 

It does seems strange, I'll keep looking and if I find anything I'll post it here.

If I helped you click the Thank You button

  • Author

Looks like it has been moved to AbstractClientPlayer and is field_110313_e and that is a ResourceLocation. But it is not public and hence inaccessible.

May be another way to change this, but I am not good at reading (even mildly) obfuscated code.

- Pow3rCut

If I helped you click the Thank You button

  • Author

Yes, but it seems like a simple setter and getter would be all that is needed, shame. Used to be a really nice feature

If I helped you click the Thank You button

you could replace the whole class and add a setter and getter as a cape core mod that's a API.

  • Author

Very true (to both the reflection and the overwriting), but either requires additional downloads by the player or for the mod to be installed as a coremod vs the old method where any mod could easily add capes. Perhaps a pull request in Forge, to make the field public?

 

I imagine reflection is the way to go, unless their is a simplier way that I am overlooking

If I helped you click the Thank You button

I may look at this more maybe you could copy the function and recreate it in your own class.

  • Author

net.minecraft.client.entity.AbstractClientPlayer

If I helped you click the Thank You button

  • Author

Sorry to be a pain, but where is the Cape render code located (unless it is       

ModelBiped.bipedCloak = new ModelRenderer(this, 0, 0);
        ModelBiped.bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, par1);

 

Ignore me I am an idiot, it is obviously located in RenderPlayer.renderSpecials (P.S. check out the DeadMau5 stuff)

-Pow3rCut

If I helped you click the Thank You button

  • Author

Okay so I got around half way then hit a lot of trouble with event.renderer.anything being private, any advice?

	public static void init(net.minecraftforge.client.event.RenderPlayerEvent.Specials.Post event) 
{
	if(!playerHasCape(event.entityPlayer).isEmpty())
	{

		EntityPlayer abstractClientPlayer = event.entityPlayer;
		ThreadDownloadImageData imageDownload = downloadImage(new ResourceLocation("skins/" + StringUtils.stripControlCodes(playerHasCape(event.entityPlayer))), "http://www.minecraftcapes.com/userskins/Diamond_Cape_by_John.png", new ImageBufferDownload());
		boolean flag = imageDownload.func_110557_a();
        boolean flag1 = !abstractClientPlayer.isInvisible();
        boolean flag2 = !abstractClientPlayer.getHideCape();
        float f6;
        
        if (flag && flag1 && flag2)
        {
            event.renderer.func_110776_a(new ResourceLocation("cloaks/" + StringUtils.stripControlCodes(playerHasCape(event.entityPlayer))));
            GL11.glPushMatrix();
            GL11.glTranslatef(0.0F, 0.0F, 0.125F);
            double d0 = abstractClientPlayer.field_71091_bM + (abstractClientPlayer.field_71094_bP - abstractClientPlayer.field_71091_bM) * (double)par2 - (abstractClientPlayer.prevPosX + (abstractClientPlayer.posX - abstractClientPlayer.prevPosX) * (double)event.partialTicks);
            double d1 = abstractClientPlayer.field_71096_bN + (abstractClientPlayer.field_71095_bQ - abstractClientPlayer.field_71096_bN) * (double)par2 - (abstractClientPlayer.prevPosY + (abstractClientPlayer.posY - abstractClientPlayer.prevPosY) * (double)event.partialTicks);
            double d2 = abstractClientPlayer.field_71097_bO + (abstractClientPlayer.field_71085_bR - abstractClientPlayer.field_71097_bO) * (double)par2 - (abstractClientPlayer.prevPosZ + (abstractClientPlayer.posZ - abstractClientPlayer.prevPosZ) * (double)event.partialTicks);
            f6 = abstractClientPlayer.prevRenderYawOffset + (abstractClientPlayer.renderYawOffset - abstractClientPlayer.prevRenderYawOffset) * event.partialTicks;
            double d3 = (double)MathHelper.sin(f6 * (float)Math.PI / 180.0F);
            double d4 = (double)(-MathHelper.cos(f6 * (float)Math.PI / 180.0F));
            float f7 = (float)d1 * 10.0F;

            if (f7 < -6.0F)
            {
                f7 = -6.0F;
            }

            if (f7 > 32.0F)
            {
                f7 = 32.0F;
            }

            float f8 = (float)(d0 * d3 + d2 * d4) * 100.0F;
            float f9 = (float)(d0 * d4 - d2 * d3) * 100.0F;

            if (f8 < 0.0F)
            {
                f8 = 0.0F;
            }

            float f10 = abstractClientPlayer.prevCameraYaw + (abstractClientPlayer.cameraYaw - abstractClientPlayer.prevCameraYaw) * event.partialTicks;
            f7 += MathHelper.sin((abstractClientPlayer.prevDistanceWalkedModified + (abstractClientPlayer.distanceWalkedModified - abstractClientPlayer.prevDistanceWalkedModified) * event.partialTicks) * 6.0F) * 32.0F * f10;

            if (abstractClientPlayer.isSneaking())
            {
                f7 += 25.0F;
            }

            GL11.glRotatef(6.0F + f8 / 2.0F + f7, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(f9 / 2.0F, 0.0F, 0.0F, 1.0F);
            GL11.glRotatef(-f9 / 2.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
            event.renderer.modelBipedMain.renderCloak(0.0625F);
            GL11.glPopMatrix();
        }
	}
}

private static String playerHasCape(EntityPlayer entityPlayer) {
	if(entityPlayer.username.equalsIgnoreCase("pow3rcut"))
	{
		return "Pow3rCut";
	}
	else if(entityPlayer.username.equalsIgnoreCase("sad"))
	{
		return "";
	}
	else if(entityPlayer.username.equalsIgnoreCase("dsada"))
	{
		return "";
	}

	return "";
}

    private static ThreadDownloadImageData downloadImage(ResourceLocation par0ResourceLocation, String par1Str, IImageBuffer par3IImageBuffer)
    {
        TextureManager texturemanager = Minecraft.getMinecraft().func_110434_K();
        Object object = texturemanager.func_110581_b(par0ResourceLocation);

        return (ThreadDownloadImageData)object;
    }

If I helped you click the Thank You button

  • 4 weeks later...

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.