Jump to content

1.12.2 FadeGui Not working!


FireIsH0t

Recommended Posts

package net.arsenalnetwork.arsenalmod.client.gui;

import net.arsenalnetwork.arsenalmod.ArsenalMod;
import net.arsenalnetwork.arsenalmod.util.ArsenalUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;

public class ArsenalFadeGui extends GuiScreen {

    private float fade = 0.0F;
    private int timer = 60;

    public void drawScreen(int x, int y, float ticks)
    {
        if(timer >= 0)
        {
            timer--;
            if (this.fade < 1.0F) {
                this.fade += 0.03F;
            }
        } else {
            this.mc.displayGuiScreen(new ArsenalMainMenu());
        }
        ArsenalUtils.drawBackground(0,0,new ResourceLocation(ArsenalMod.MODID, "textures/gui/fade/FadeBackground.png"),this.width,this.height);
        drawTexturedModalRect(this.width / 2 - 125, this.height / 2 - 75, 250.0D, 150.0D, "arsenal:textures/gui/fade/ArsenalLogo.png");

        super.drawScreen(x, y, y);
    }

    public void drawTexturedModalRect(double x, double y, double width, double height, String location)
    {
        GL11.glPushMatrix();
        GL11.glEnable(3042);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, this.fade);
        Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(location));
        final Tessellator tessellator = Tessellator.getInstance();
        GlStateManager.enableBlend();
        final BufferBuilder buffer = tessellator.getBuffer();
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos(x, y + height, 0.0).tex(0.0, 1.0).color(255, 255, 255, 255).endVertex();
        buffer.pos(x + width, y + height, 0.0).tex(1.0, 1.0).color(255, 255, 255, 255).endVertex();
        buffer.pos(x + width, y, 0.0).tex(1.0, 0.0).color(255, 255, 255, 255).endVertex();
        buffer.pos(x, y, 0.0).tex(0.0, 0.0).color(255, 255, 255, 255).endVertex();
        tessellator.draw();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
    }

}

 

Hello, I am trying to get my fade gui to work but it isnt. What is this fade gui? When your client loads up before it goes to the main menu gui it shows a image of the logo and then fades to the main menu

Link to comment
Share on other sites

29 minutes ago, FireIsH0t said:

public void drawScreen(int x, int y, float ticks)

Uh, the naming of the last parameter is wrong. It's partialTicks, not ticks. There is a huge difference. 

 

if(timer >= 0)
        {
            timer--;
            if (this.fade < 1.0F) {
                this.fade += 0.03F;
            }
        } else {
            this.mc.displayGuiScreen(new ArsenalMainMenu());
        }

You can't do this in the drawScreen method because it happens each frame, not each tick. If you want your animation to stay consistent with the framerate you need to use GuiScreen#updateScreen to update your counters, that happens each tick, not each frame.

 

29 minutes ago, FireIsH0t said:

super.drawScreen(x, y, y);

Why are you passing y as partialTicks?

 

29 minutes ago, FireIsH0t said:

ArsenalUtils.drawBackground(0,0,new ResourceLocation(ArsenalMod.MODID, "textures/gui/fade/FadeBackground.png"),this.width,this.height);

All resources must be lower-case(as far as I am aware anyway, feel free to correct me). Same with the line directly after.

 

29 minutes ago, FireIsH0t said:

ArsenalUtils.drawBackground

And what does this method do? Or rather what is the code of this method?

 

29 minutes ago, FireIsH0t said:

GL11.glPushMatrix();

There is no need to push/pop matrix here as you are not changing the matrix at all.

 

29 minutes ago, FireIsH0t said:

GL11.glEnable(3042);

Do you have any idea what this does? What does 3042 magic number mean? Please don't just blindly copy deobfuscated code and call it good, actually understand what's going on. Also don't use GL11, use GlStateManager. And if you are enabling blend you need to specify the blend function too since you don't know what it was specified to beforehand(3042 is GL_BLEND in case you were wondering)

 

29 minutes ago, FireIsH0t said:

GlStateManager.enableBlend();

You just enabled it. 3 lines above in fact. Oh and while I am at it if you are changing the GL state take care to restore it after you are done your drawing. Don't just leak GL state. 

 

Apart from all these glaring issues I immediately see - yeah, what @diesieben07 said. You need to clarify your issue a bit more and show a bit more code.

Link to comment
Share on other sites

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I've been having a huge lag issue and discovered my server has a tendency to climb in ram usage, as pictured here. I've tested all mods individually on a copy of the server, with the world reset and at 1GB of ram for testing, and it happens regardless of the mod used. Here is a zip file of mods I'm using if you need it. I can provide any other info needed. I'm not doing anything special to recreate it but it does get worse when people connect to the server.
    • The Risks of Online Crypto Investment: A Cautionary Tale EMAIL: rap iddigitalreco ve ry @ exe cs. com. WHAT SAPP: + 1 41 4 80 7 14 85 Online crypto investment can seem like a promising opportunity, but it’s crucial to recognize that there are no guarantees. My own experience serves as a stark reminder of this reality. I was drawn in by the allure of high returns and the persuasive marketing tactics employed by various brokers on platforms like Instagram. Their polished presentations and testimonials made it seem easy to profit from cryptocurrency trading. Everything appeared to be legitimate. I received enticing messages about the potential for substantial gains, and the brokers seemed knowledgeable and professional. Driven by excitement and the fear of missing out, I invested a significant amount of my savings. The promise of quick profits overshadowed the red flags I should have noticed. I trusted these brokers without conducting proper research, which was a major mistake. As time went on, I realized that the promised returns were nothing but illusions. My attempts to withdraw funds were met with endless excuses and delays. It became painfully clear that I had fallen victim to a scam. The reality hit hard: my hard-earned money was gone, and I was left feeling foolish and defeated. In my desperation, I sought help from a company called Rapid Digital Recovery. They specialize in helping individuals recover funds lost to online scams. Their expertise and guidance have been invaluable during this difficult time. While I remain cautious and skeptical, I’m hopeful that they can assist me in retrieving my funds. This has taught me an important lesson: if something seems too good to be true, it probably is. I urge anyone considering online crypto investments to be extremely cautious. Do your research, scrutinize the brokers, and avoid rushing into decisions driven by hype or pressure. The world of cryptocurrency can be volatile and unregulated, making it a breeding ground for scams. while online investments can be appealing, they come with significant risks. Protect yourself by staying informed and skeptical. Learn from my experience and prioritize due diligence over quick gains. Stay away from unverified platforms and be wary of offers that sound too good to be true. Your financial security is worth the effort to ensure you’re making safe and informed decisions.
    • This is the log for Prism launcher after I added it https://mclo.gs/uXywaR5 As for AT launcher i'm not sure where to change the JVM arguments.  
    • Please help me out! Here is the report: pastebin.com/uiJMSG5Y
    • Hello,   I am playing the Modified Cobblemon modpack and I am able to join the server, the server is also hosted on my pc, but yet no one else is able to join the server, they get an error code of fieldSize is too long yet I have triple checked to be sure that all of the mods are the same outside of the client side mods. The specific code is Internal Exception: io.netty.handler.codec.DecoderException: io.netty.handler.codec.EncoderException: Java.io.EOFException: fieldSize is too long! Length is 1638, but maximum is 38. The first number changes at random but it is always a fairly large number and I have tried looking and logs and it says that there are mismatched mods between the server and client yet they are both present so I am not sure what is creating an issue for players joining. Client Log https://pastebin.com/UxpcCXr6 https://pastebin.com/aWuHaN57 I had to split the client log because it was too large for a single pastebin, I have had all three friends try to join the server and they all get this message but the client logs provided are from the person joining from LAN. Forge version is 47.3.11. Any help or insight on what is causing the issue would be greatly appreciated.
  • Topics

×
×
  • Create New...

Important Information

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