Jump to content

Recommended Posts

Posted

Basically i want to add zoom to my weapons without changing vanilla code. Unfortuantly the cameraZoom and mc is privated, is there anyway around this or does forge have a hook for it?

 

EntityRenderer:

 

 

public class Class3GunZoom extends EntityRenderer

{

 

public Class3GunZoom(Minecraft par1Minecraft)

{

super(par1Minecraft);

}

 

public static double gunZoom = 1.0D;

    public boolean zoomInKey;

    public boolean zoomOutKey;

 

    @Override

public void updateRenderer()

    {

        if (Class3.zoom && gunZoom > 1.0D)

        {

        this.cameraZoom = gunZoom;

        }

        else

        {

            this.cameraZoom = 1.0D;

        }

       

        super.updateRenderer();

    }

}

 

 

 

GuiIngame:

 

 

public class Class3GunSight extends GuiIngame

{

 

public static String gunSight = null;

 

public Class3GunSight(Minecraft par1Minecraft)

{

super(par1Minecraft);

}

 

@Override

public void renderGameOverlay(float par1, boolean par2, int par3, int par4)

{

ScaledResolution var5 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);

int var6 = var5.getScaledWidth();

        int var7 = var5.getScaledHeight();

 

if (this.mc.gameSettings.thirdPersonView == 0 && Class3.zoom)

        {

            this.renderGunSights(var6, var7);

        }

 

super.renderGameOverlay(par1, par2, par3, par4);

}

 

private void renderGunSights(int var1, int var2)

    {

        GL11.glDisable(GL11.GL_DEPTH_TEST);

        GL11.glDepthMask(false);

        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        GL11.glDisable(GL11.GL_ALPHA_TEST);

        GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("%blur%/mods/Resources/GunSights/" + gunSight + ".png"));

        Tessellator var3 = Tessellator.instance;

        var3.startDrawingQuads();

        var3.addVertexWithUV(0.0D, (double)var2, -90.0D, 0.0D, 1.0D);

        var3.addVertexWithUV((double)var1, (double)var2, -90.0D, 1.0D, 1.0D);

        var3.addVertexWithUV((double)var1, 0.0D, -90.0D, 1.0D, 0.0D);

        var3.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D);

        var3.draw();

        GL11.glDepthMask(true);

        GL11.glEnable(GL11.GL_DEPTH_TEST);

        GL11.glEnable(GL11.GL_ALPHA_TEST);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    }

 

}

 

 

Posted

ok ive fixed the this.ms but that was easy all i had to do was this:

 

 

 

private final Minecraft mc;

 

public Class3GunSight(Minecraft par1Minecraft)

{

super(par1Minecraft);

this.mc = par1Minecraft;

}

 

 

 

but ive done all the steps but is there still ment to be errors in eclipse or not?

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.