Pow3rCut Posted July 13, 2013 Posted July 13, 2013 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 Quote If I helped you click the Thank You button
Pow3rCut Posted July 14, 2013 Author Posted July 14, 2013 I was wondering this as well. It does seems strange, I'll keep looking and if I find anything I'll post it here. Quote If I helped you click the Thank You button
Pow3rCut Posted July 14, 2013 Author Posted July 14, 2013 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 Quote If I helped you click the Thank You button
endershadow Posted July 14, 2013 Posted July 14, 2013 I do know that some people are using core mods for it. Quote
Pow3rCut Posted July 14, 2013 Author Posted July 14, 2013 Yes, but it seems like a simple setter and getter would be all that is needed, shame. Used to be a really nice feature Quote If I helped you click the Thank You button
sci4me Posted July 14, 2013 Posted July 14, 2013 Well it may be possible to use reflection to change it// Quote
Chibill Posted July 14, 2013 Posted July 14, 2013 you could replace the whole class and add a setter and getter as a cape core mod that's a API. Quote
Pow3rCut Posted July 14, 2013 Author Posted July 14, 2013 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 Quote If I helped you click the Thank You button
Chibill Posted July 14, 2013 Posted July 14, 2013 I may look at this more maybe you could copy the function and recreate it in your own class. Quote
Pow3rCut Posted July 15, 2013 Author Posted July 15, 2013 net.minecraft.client.entity.AbstractClientPlayer Quote If I helped you click the Thank You button
Chibill Posted July 15, 2013 Posted July 15, 2013 how would we render and show them oh smart one? Quote
endershadow Posted July 16, 2013 Posted July 16, 2013 also helps if there was a event named that! there is... Quote
Chibill Posted July 16, 2013 Posted July 16, 2013 I check all the net.minecraftforge.event packages there was none. Quote
Chibill Posted July 16, 2013 Posted July 16, 2013 found it but it does not help us who are trying to work with capes. Quote
Pow3rCut Posted July 16, 2013 Author Posted July 16, 2013 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 Quote If I helped you click the Thank You button
Pow3rCut Posted July 16, 2013 Author Posted July 16, 2013 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; } Quote If I helped you click the Thank You button
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.