Jump to content

Player rendering textures not working


PlanetTeamSpeak

Recommended Posts

I am rendering a player with a method I made myself, but the texture is really messed up. Any ideas on why and how to fix it?

PlayerRenderer.java:

package com.ptsmods.morecommands.miscellaneous;

import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class PlayerRenderer {

	private final Minecraft mc;
	private final ModelPlayer model = new ModelPlayer(0.0625F, false);
	private final ModelPlayer main;
	private final RenderPlayer renderer;

	public PlayerRenderer(ModelPlayer main, RenderPlayer renderer) {
		mc = Minecraft.getMinecraft();
		this.main = main;
		this.renderer = renderer;
	}

	public void renderPlayer(EntityPlayer player, ResourceLocation skin) {
		float base = 0.0625F;
		GlStateManager.pushMatrix();
		GlStateManager.rotate(180F, 0F, 0F, 0F);
		GlStateManager.color(255, 255, 255);
		GlStateManager.translate(mc.player.posX-player.posX, mc.player.posY-player.posY-1.5D, mc.player.posZ-player.posZ);
		renderer.bindTexture(skin);
		model.bipedHead = main.bipedHead;
		model.bipedHeadwear = main.bipedHeadwear;
		model.bipedHead.rotateAngleZ = 0;
		model.bipedBody = main.bipedBody;
		model.bipedBodyWear = main.bipedBodyWear;
		model.bipedRightArm = main.bipedRightArm;
		model.bipedRightArmwear = main.bipedRightArmwear;
		model.bipedLeftArm = main.bipedLeftArm;
		model.bipedLeftArmwear = main.bipedLeftArmwear;
		model.bipedRightLeg = main.bipedRightLeg;
		model.bipedRightLegwear = main.bipedRightLegwear;
		model.bipedLeftLeg = main.bipedLeftLeg;
		model.bipedLeftLegwear = main.bipedLeftLegwear;

		model.bipedHead.render(base);
		model.bipedHeadwear.render(base);
		model.bipedBody.render(base);
		model.bipedBodyWear.render(base);
		model.bipedRightArm.render(base);
		model.bipedRightArmwear.render(base);
		model.bipedLeftArm.render(base);
		model.bipedLeftArmwear.render(base);
		model.bipedRightLeg.render(base);
		model.bipedRightLegwear.render(base);
		model.bipedLeftLeg.render(base);
		model.bipedLeftLegwear.render(base);
		player.setInvisible(true);
		main.setVisible(false);
		GlStateManager.popMatrix();
	}

}

Where it's being called:

@SubscribeEvent
public void onPlayerRender(RenderPlayerEvent.Post event) {
	for (EntityPlayerMP player : Reference.fakePlayers)
		if (player.getName().equals(event.getEntityPlayer().getName()))
			new PlayerRenderer(event.getRenderer().getMainModel(), event.getRenderer()).renderPlayer(event.getEntityPlayer(), new ResourceLocation("morecommands:textures/entity/planetteamspeak.png"));
}

Texture:

hzh0wzgE4p.png

Result:

NFrJssI1ex.png

Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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