HelpNeed Java help, again!

Posts 18 of 8 · Page 1 of 1
Need Java help, again!
The modpack client I have been making is finished and I managed to recompile and reobfuscate without and errors. The problem occurs once I have added the .class files into the modpack.jar and attempt to run it, it black screens and crashes. I managed to get this from the MinecraftLog.txt, something about a non-static method not being there or something, not really sure but here it is. Any help would be greatly appreciated as this is the only thing holding me back from releasing it.
Code:
2013-08-27 12:19:05 [INFO] [STDERR] Exception in thread "Minecraft main thread" java.lang.IncompatibleClassChangeError: Expecting non-static method net.minecraft.client.gui.ScaledResolution.func_78326_a()I
2013-08-27 12:19:05 [INFO] [STDERR]     at net.minecraft.client.Minecraft.func_71357_I(Minecraft.java:513)
2013-08-27 12:19:05 [INFO] [STDERR]     at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:407)
2013-08-27 12:19:05 [INFO] [STDERR]     at net.minecraft.client.MinecraftAppletImpl.func_71384_a(SourceFile:56)
2013-08-27 12:19:05 [INFO] [STDERR]     at net.minecraft.client.Minecraft.run(Minecraft.java:733)
2013-08-27 12:19:05 [INFO] [STDERR]     at java.lang.Thread.run(Unknown Source)
Your sure you modified the right jar? If so try looking into those functions and seeing what needs to be changed.
Quote Originally Posted by LordPankake View Post
Your sure you modified the right jar? If so try looking into those functions and seeing what needs to be changed.
Yeah i'm 100% sure I used the right jar. I'll have a look later on in the week though, very busy thanks for the help though
Quote Originally Posted by LordPankake View Post
Your sure you modified the right jar? If so try looking into those functions and seeing what needs to be changed.
I'm at a loss with this, I honestly don't know what to do. Here is the code in the Scaled Resolution class, your help will be greatly appreciated!
Code:
package net.minecraft.client.gui;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.util.MathHelper;

 @SideOnly(Side.CLIENT)
public class ScaledResolution
{
    private static int scaledWidth;
    private static int scaledHeight;
    private double scaledWidthD;
    private double scaledHeightD;
    private int scaleFactor;


    public ScaledResolution(GameSettings par1GameSettings, int par2, int par3)
    {
        this.scaledWidth = par2;
        this.scaledHeight = par3;
        this.scaleFactor = 1;
        int k = par1GameSettings.guiScale;


        if (k == 0)
        {
            k = 1000;
        }


        while (this.scaleFactor < k && this.scaledWidth / (this.scaleFactor + 1) >= 320 && this.scaledHeight / (this.scaleFactor + 1) >= 240)
        {
            ++this.scaleFactor;
        }


        this.scaledWidthD = (double)this.scaledWidth / (double)this.scaleFactor;
        this.scaledHeightD = (double)this.scaledHeight / (double)this.scaleFactor;
        this.scaledWidth = MathHelper.ceiling_double_int(this.scaledWidthD);
        this.scaledHeight = MathHelper.ceiling_double_int(this.scaledHeightD);
    }


    public static int getScaledWidth()
    {
        return scaledWidth;
    }


    public static int getScaledHeight()
    {
        return scaledHeight;
    }


    public double getScaledWidth_double()
    {
        return this.scaledWidthD;
    }


    public double getScaledHeight_double()
    {
        return this.scaledHeightD;
    }


    public int getScaleFactor()
    {
        return this.scaleFactor;
    }
}
Quote Originally Posted by Chris View Post


I'm at a loss with this, I honestly don't know what to do. Here is the code in the Scaled Resolution class, your help will be greatly appreciated!
Code:
package net.minecraft.client.gui;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.util.MathHelper;

 @SideOnly(Side.CLIENT)
public class ScaledResolution
{
    private static int scaledWidth;
    private static int scaledHeight;
    private double scaledWidthD;
    private double scaledHeightD;
    private int scaleFactor;


    public ScaledResolution(GameSettings par1GameSettings, int par2, int par3)
    {
        this.scaledWidth = par2;
        this.scaledHeight = par3;
        this.scaleFactor = 1;
        int k = par1GameSettings.guiScale;


        if (k == 0)
        {
            k = 1000;
        }


        while (this.scaleFactor < k && this.scaledWidth / (this.scaleFactor + 1) >= 320 && this.scaledHeight / (this.scaleFactor + 1) >= 240)
        {
            ++this.scaleFactor;
        }


        this.scaledWidthD = (double)this.scaledWidth / (double)this.scaleFactor;
        this.scaledHeightD = (double)this.scaledHeight / (double)this.scaleFactor;
        this.scaledWidth = MathHelper.ceiling_double_int(this.scaledWidthD);
        this.scaledHeight = MathHelper.ceiling_double_int(this.scaledHeightD);
    }


    public static int getScaledWidth()
    {
        return scaledWidth;
    }


    public static int getScaledHeight()
    {
        return scaledHeight;
    }


    public double getScaledWidth_double()
    {
        return this.scaledWidthD;
    }


    public double getScaledHeight_double()
    {
        return this.scaledHeightD;
    }


    public int getScaleFactor()
    {
        return this.scaleFactor;
    }
}
Code:
non-static method net.minecraft.client.gui.ScaledResolution.func_78326_a()I
That's the problem. Find what that func is and use remove the static modifier. Make sure to use it in a non-static way.
Quote Originally Posted by LordPankake View Post
Code:
non-static method net.minecraft.client.gui.ScaledResolution.func_78326_a()I
That's the problem. Find what that func is and use remove the static modifier. Make sure to use it in a non-static way.
I think I have the got it.
Code:
public static int getScaledWidth()    {
        return scaledWidth;
    }


    public static int getScaledHeight()
    {
        return scaledHeight;
    }

However once I have removed the 'static' modifier I get errors to make them static again as I used them in my client to position things e.g.
Code:
int line = 10;
int line2 = 2;
int width1 = ScaledResolution.getScaledWidth();
int height1 = ScaledResolution.getScaledHeight();
fontrenderer.drawStringWithShadow("Revolt v1.0", ScaledResolution.getScaledWidth() - fontrenderer.getStringWidth("Revolt v1.0") - 13, line2, 0xFF00FFFF);line2 += line;
I'm confused and don't know what to do
Quote Originally Posted by Chris View Post


I think I have the got it.
Code:
public static int getScaledWidth()    {
        return scaledWidth;
    }


    public static int getScaledHeight()
    {
        return scaledHeight;
    }

However once I have removed the 'static' modifier I get errors to make them static again as I used them in my client to position things e.g.
Code:
int line = 10;
int line2 = 2;
int width1 = ScaledResolution.getScaledWidth();
int height1 = ScaledResolution.getScaledHeight();
fontrenderer.drawStringWithShadow("Revolt v1.0", ScaledResolution.getScaledWidth() - fontrenderer.getStringWidth("Revolt v1.0") - 13, line2, 0xFF00FFFF);line2 += line;
I'm confused and don't know what to do
Make sure you can call the class in a non static manner so you can reference the variables in a non static way.

Code:
private ScaledResolution scaledResolution;
//in your class's constructor place this line of code
this.scaledResolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
//then you can use 
scaledResolution.getScaledHeight();//and anything else like that in the class.
Quote Originally Posted by LordPankake View Post
Make sure you can call the class in a non static manner so you can reference the variables in a non static way.

Code:
private ScaledResolution scaledResolution;
//in your class's constructor place this line of code
this.scaledResolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
//then you can use 
scaledResolution.getScaledHeight();//and anything else like that in the class.
Thanks for all your help, it is working now! I will be releasing the client (hopefully) later on today Thanks again.
Posts 18 of 8 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?