Results 1 to 8 of 8
  1. #1
    I'M GONNA HAVE TO EAT EVERY F--KING CHICKEN
    MPGH Member
    Chris's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    1,086
    Reputation
    29
    Thanks
    2,780
    My Mood
    Psychedelic

    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)
    Last edited by Chris; 08-28-2013 at 04:20 AM.
    Vouch Thread
    Thank or +rep me if I helped you ★


  2. #2
    LordPankake's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    1,010
    Reputation
    260
    Thanks
    2,466
    My Mood
    Angry
    Your sure you modified the right jar? If so try looking into those functions and seeing what needs to be changed.

  3. #3
    Threadstarter
    I'M GONNA HAVE TO EAT EVERY F--KING CHICKEN
    MPGH Member
    Chris's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    1,086
    Reputation
    29
    Thanks
    2,780
    My Mood
    Psychedelic
    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
    Vouch Thread
    Thank or +rep me if I helped you ★


  4. #4
    Threadstarter
    I'M GONNA HAVE TO EAT EVERY F--KING CHICKEN
    MPGH Member
    Chris's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    1,086
    Reputation
    29
    Thanks
    2,780
    My Mood
    Psychedelic
    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;
        }
    }
    Vouch Thread
    Thank or +rep me if I helped you ★


  5. #5
    LordPankake's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    1,010
    Reputation
    260
    Thanks
    2,466
    My Mood
    Angry
    Quote Originally Posted by darkwrath505 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.

  6. #6
    Threadstarter
    I'M GONNA HAVE TO EAT EVERY F--KING CHICKEN
    MPGH Member
    Chris's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    1,086
    Reputation
    29
    Thanks
    2,780
    My Mood
    Psychedelic
    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
    Last edited by Chris; 08-30-2013 at 02:43 PM.
    Vouch Thread
    Thank or +rep me if I helped you ★


  7. #7
    LordPankake's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    1,010
    Reputation
    260
    Thanks
    2,466
    My Mood
    Angry
    Quote Originally Posted by darkwrath505 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.

  8. #8
    Threadstarter
    I'M GONNA HAVE TO EAT EVERY F--KING CHICKEN
    MPGH Member
    Chris's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    1,086
    Reputation
    29
    Thanks
    2,780
    My Mood
    Psychedelic
    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.
    Vouch Thread
    Thank or +rep me if I helped you ★


Similar Threads

  1. Java Tutorial Chapter 2 - All hail JAVA!
    By Takari in forum Programming Tutorials
    Replies: 3
    Last Post: 10-20-2011, 04:58 PM
  2. JAVA IDE
    By topblast in forum Java
    Replies: 8
    Last Post: 03-31-2011, 09:35 PM
  3. JAVA
    By Mister 1337 in forum General
    Replies: 43
    Last Post: 01-17-2011, 06:15 PM
  4. java
    By matthewwhite in forum Java
    Replies: 3
    Last Post: 01-28-2010, 04:20 PM
  5. psp java emu
    By pjown in forum Java
    Replies: 7
    Last Post: 09-10-2009, 07:15 PM