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

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);

    }

 

}

 

 

  • Author

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

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.