Jump to content

Help the skin package with the player in the main menu [Code][1.7.10]


Recommended Posts

Posted

Hello! Please immediately sorry for my english.

 

The problem is this: is not possible to put a player skin (such as inventory) in the main menu.

 

I tried to take a standard approach:

 public static void func_147046_a(int p_147046_0_, int p_147046_1_, int p_147046_2_, float p_147046_3_, float p_147046_4_, EntityLivingBase p_147046_5_)
    {
        GL11.glEnable(GL11.GL_COLOR_MATERIAL);
        GL11.glPushMatrix();
        GL11.glTranslatef((float)p_147046_0_, (float)p_147046_1_, 50.0F);
        GL11.glScalef((float)(-p_147046_2_), (float)p_147046_2_, (float)p_147046_2_);
        GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
        float f2 = p_147046_5_.renderYawOffset;
        float f3 = p_147046_5_.rotationYaw;
        float f4 = p_147046_5_.rotationPitch;
        float f5 = p_147046_5_.prevRotationYawHead;
        float f6 = p_147046_5_.rotationYawHead;
        GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
        RenderHelper.enableStandardItemLighting();
        GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-((float)Math.atan((double)(p_147046_4_ / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
        p_147046_5_.renderYawOffset = (float)Math.atan((double)(p_147046_3_ / 40.0F)) * 20.0F;
        p_147046_5_.rotationYaw = (float)Math.atan((double)(p_147046_3_ / 40.0F)) * 40.0F;
        p_147046_5_.rotationPitch = -((float)Math.atan((double)(p_147046_4_ / 40.0F))) * 20.0F;
        p_147046_5_.rotationYawHead = p_147046_5_.rotationYaw;
        p_147046_5_.prevRotationYawHead = p_147046_5_.rotationYaw;
        GL11.glTranslatef(0.0F, p_147046_5_.yOffset, 0.0F);
        RenderManager.instance.playerViewY = 180.0F;
        RenderManager.instance.renderEntityWithPosYaw(p_147046_5_, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
        p_147046_5_.renderYawOffset = f2;
        p_147046_5_.rotationYaw = f3;
        p_147046_5_.rotationPitch = f4;
        p_147046_5_.prevRotationYawHead = f5;
        p_147046_5_.rotationYawHead = f6;
        GL11.glPopMatrix();
        RenderHelper.disableStandardItemLighting();
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    }

 

 

And found on github:

public void drawEntityOnScreenAtRotation(int posX, int posY,
    		            float scale, float xAngle, float yAngle, EntityLivingBase ent)
    		    {		
    		        GL11.glDisable(GL11.GL_BLEND);
    		        GL11.glDepthMask(true);
    		        GL11.glEnable(GL11.GL_DEPTH_TEST);
    		        GL11.glEnable(GL11.GL_ALPHA_TEST);
    		        GL11.glPushMatrix();
    		        GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    		        GL11.glTranslatef(posX, posY, 50.0F);
    		        GL11.glScalef((-scale), scale, scale);
    		        GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    		        float f2 = ent.renderYawOffset;
    		        float f3 = ent.rotationYaw;
    		        float f4 = ent.rotationPitch;
    		        float f5 = ent.rotationYawHead;
    		        GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
    		        RenderHelper.enableStandardItemLighting();
    		        GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
    		        GL11.glRotatef(xAngle, 1.0F, 0.0F, 0.0F);
    		        GL11.glRotatef(yAngle, 0.0F, 1.0F, 0.0F);
    	            ent.renderYawOffset = (float) Math.atan(2.0F / 40.0F) * 20.0F;
    		        ent.rotationYaw = (float) Math.atan(2.0F / 40.0F) * 40.0F;
    		        ent.rotationPitch = -((float) Math.atan(2.0F / 40.0F)) * 20.0F;
    		        ent.rotationYawHead = ent.renderYawOffset;
    		        GL11.glTranslatef(0.0F, ent.yOffset, 0.0F);
    		        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    		        float viewY = RenderManager.instance.playerViewY;
    		        try
    		        {
    		            RenderManager.instance.playerViewY = 180.0F;
    		            RenderManager.instance.renderEntityWithPosYaw(ent, 0.0D, 0.0D,
    		                    0.0D, 0.0F, 1.0F);
    		        }
    		        finally
    		        {
    	            GL11.glTranslatef(0.0F, -0.22F, 0.0F);
    		            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,
    		                    255.0F * 0.8F, 255.0F * 0.8F);
    		            RenderManager.instance.playerViewY = viewY;
    		            ent.renderYawOffset = f2;
    		            ent.rotationYaw = f3;
    	            ent.rotationPitch = f4;
    		            ent.rotationYawHead = f5;
    		            GL11.glPopMatrix();
    		            RenderHelper.disableStandardItemLighting();
    		            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    		            OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    		           GL11.glDisable(GL11.GL_TEXTURE_2D);
    		           OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    		        }
    	
    		    }

 

 

But crash every time.

 

By the code (the second case) turn something like this:        drawEntityOnScreenAtRotation(99, 99, 25, 0, 0, this.mc.renderViewEntity);

 

Help me please. What is wrong here?

Posted

Hello! Please immediately sorry for my english.

 

The problem is this: is not possible to put a player skin (such as inventory) in the main menu.

 

I tried to take a standard approach:

 public static void func_147046_a(int p_147046_0_, int p_147046_1_, int p_147046_2_, float p_147046_3_, float p_147046_4_, EntityLivingBase p_147046_5_)
    {
        GL11.glEnable(GL11.GL_COLOR_MATERIAL);
        GL11.glPushMatrix();
        GL11.glTranslatef((float)p_147046_0_, (float)p_147046_1_, 50.0F);
        GL11.glScalef((float)(-p_147046_2_), (float)p_147046_2_, (float)p_147046_2_);
        GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
        float f2 = p_147046_5_.renderYawOffset;
        float f3 = p_147046_5_.rotationYaw;
        float f4 = p_147046_5_.rotationPitch;
        float f5 = p_147046_5_.prevRotationYawHead;
        float f6 = p_147046_5_.rotationYawHead;
        GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
        RenderHelper.enableStandardItemLighting();
        GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-((float)Math.atan((double)(p_147046_4_ / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
        p_147046_5_.renderYawOffset = (float)Math.atan((double)(p_147046_3_ / 40.0F)) * 20.0F;
        p_147046_5_.rotationYaw = (float)Math.atan((double)(p_147046_3_ / 40.0F)) * 40.0F;
        p_147046_5_.rotationPitch = -((float)Math.atan((double)(p_147046_4_ / 40.0F))) * 20.0F;
        p_147046_5_.rotationYawHead = p_147046_5_.rotationYaw;
        p_147046_5_.prevRotationYawHead = p_147046_5_.rotationYaw;
        GL11.glTranslatef(0.0F, p_147046_5_.yOffset, 0.0F);
        RenderManager.instance.playerViewY = 180.0F;
        RenderManager.instance.renderEntityWithPosYaw(p_147046_5_, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
        p_147046_5_.renderYawOffset = f2;
        p_147046_5_.rotationYaw = f3;
        p_147046_5_.rotationPitch = f4;
        p_147046_5_.prevRotationYawHead = f5;
        p_147046_5_.rotationYawHead = f6;
        GL11.glPopMatrix();
        RenderHelper.disableStandardItemLighting();
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    }

 

 

And found on github:

public void drawEntityOnScreenAtRotation(int posX, int posY,
    		            float scale, float xAngle, float yAngle, EntityLivingBase ent)
    		    {		
    		        GL11.glDisable(GL11.GL_BLEND);
    		        GL11.glDepthMask(true);
    		        GL11.glEnable(GL11.GL_DEPTH_TEST);
    		        GL11.glEnable(GL11.GL_ALPHA_TEST);
    		        GL11.glPushMatrix();
    		        GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    		        GL11.glTranslatef(posX, posY, 50.0F);
    		        GL11.glScalef((-scale), scale, scale);
    		        GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    		        float f2 = ent.renderYawOffset;
    		        float f3 = ent.rotationYaw;
    		        float f4 = ent.rotationPitch;
    		        float f5 = ent.rotationYawHead;
    		        GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
    		        RenderHelper.enableStandardItemLighting();
    		        GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
    		        GL11.glRotatef(xAngle, 1.0F, 0.0F, 0.0F);
    		        GL11.glRotatef(yAngle, 0.0F, 1.0F, 0.0F);
    	            ent.renderYawOffset = (float) Math.atan(2.0F / 40.0F) * 20.0F;
    		        ent.rotationYaw = (float) Math.atan(2.0F / 40.0F) * 40.0F;
    		        ent.rotationPitch = -((float) Math.atan(2.0F / 40.0F)) * 20.0F;
    		        ent.rotationYawHead = ent.renderYawOffset;
    		        GL11.glTranslatef(0.0F, ent.yOffset, 0.0F);
    		        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    		        float viewY = RenderManager.instance.playerViewY;
    		        try
    		        {
    		            RenderManager.instance.playerViewY = 180.0F;
    		            RenderManager.instance.renderEntityWithPosYaw(ent, 0.0D, 0.0D,
    		                    0.0D, 0.0F, 1.0F);
    		        }
    		        finally
    		        {
    	            GL11.glTranslatef(0.0F, -0.22F, 0.0F);
    		            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,
    		                    255.0F * 0.8F, 255.0F * 0.8F);
    		            RenderManager.instance.playerViewY = viewY;
    		            ent.renderYawOffset = f2;
    		            ent.rotationYaw = f3;
    	            ent.rotationPitch = f4;
    		            ent.rotationYawHead = f5;
    		            GL11.glPopMatrix();
    		            RenderHelper.disableStandardItemLighting();
    		            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    		            OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    		           GL11.glDisable(GL11.GL_TEXTURE_2D);
    		           OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    		        }
    	
    		    }

 

 

But crash every time.

 

By the code (the second case) turn something like this:        drawEntityOnScreenAtRotation(99, 99, 25, 0, 0, this.mc.renderViewEntity);

 

Help me please. What is wrong here?

Two things 1.7.10 is not supported here you may update then come back with the code. And if it crashes we need the crash report.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

alas, I need it for 1.7.10 ... And where can help?

 

Just this is unlikely Forge kernel bug. Rather, the very structure of Minecraft is sort of ...

Posted

alas, I need it for 1.7.10 ... And where can help?

 

Just this is unlikely Forge kernel bug. Rather, the very structure of Minecraft is sort of ...

Anywhere else that offers it. Tutorials, any existing thread, etc.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

drawEntityOnScreenAtRotation(99, 99, 25, 0, 0, this.mc.renderViewEntity);

 

this.mc.renderViewEntity is used by Minecraft to draw the actual world. You can't use it in the main menu because there is no reference world (which is why you were crashing, I'm assuming you got a NullPointerException). So you're going to have to draw the player model (ModelPlayer) manually, which also means you have to manually bind the player skin as well.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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