Jump to content

[1.7.10] Splash Screen


LordMastodonFTW

Recommended Posts

How do I display a splash screen in the event of a fingerprint error?

I already have a splash screen ready, and I am purposefully am giving it the wrong fingerprint to test this, but it will not work.

Here is a copy of my fingerprint error event code:

@EventHandler()

public void invalidFingerprint(FMLFingerprintViolationEvent e) {

if (References.FINGERPRINT.equals("FraWrk273tx9")) {

            LogHelper.info(Messages.CORRECT_FINGERPRINT_MESSAGE);

        } else {

            LogHelper.warn(Messages.INVALID_FINGERPRINT_MESSAGE);

            Minecraft.getMinecraft().displayGuiScreen(new GuiInvalidFingerprint());

        }

}

 

It displays my log, but not the screen.

I am the self-nominated Lord of the Mastodons and don't you dare deny it. ;) Also, check out my YouTube channel: https://www.youtube.com/user/DerpDerp44/

Link to comment
Share on other sites

I don't know if this is because I can't open a splash screen during preInit (where the FingerprintViolationEvent seems to be firing), or if I am doing something wrong.

 

It seems likely to me that that might be the problem -- not appropriate time for a GUI during pre-init.  Maybe you can save a boolean that represents a fingerprint violation during the pre-init phase and then test that boolean later at a more appropriate time when GUI is possible.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

I'd say you are probably right, however there seems to be no event that runs once the game starts up, and Minecraft itself does not seem to add any method that fires on startup, which would help create my own event. If anyone could post any links regarding this, I would very much appreciate it.

I am the self-nominated Lord of the Mastodons and don't you dare deny it. ;) Also, check out my YouTube channel: https://www.youtube.com/user/DerpDerp44/

Link to comment
Share on other sites

Well, even post init might work better.  But there are several more of these "FML lifecycle events" like server starting, server started, etc. that might also be appropriate.

 

In my tutorial on events about a quarter of the way down, I list out all the FML lifecycle events: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

How do I read them?

 

Okay, one of the biggest tips I can give new modders and programmers is to learn to use your IDE (Eclipse or IntelliJ) to *explore* and *investigate* the Minecraft / Forge / FML code. 

 

So if you know the name of a class, method or field, you can find it in several ways.  In Eclipse you could do a Java search, but just make sure you correctly select what you're searching for (a method if it is a method, etc.)  In this case you would search for a type of CustomModLoadingErrorDisplayException .  You should see it come up in the search results pane and you can double-click to open the class.

 

Another way is to take some class you've already got coded, type in CustomModLoadingErrorDisplayException somewhere and when Eclipse red-underlines it hover above and accept the suggested import.  Then right click on it and select Open Declaration.  That will take you right to the class.

 

Lastly, you can hunt through the reference libraries themselves.  I find this works okay if you already have a good idea where to look, but for something like this you might not be familiar enough to guess the right packages to check.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

I opened the class, and it says this:

 

If a mod throws this exception during loading, it will be called back to render

the error screen through the methods below. This error will not be cleared, and will

not allow the game to carry on, but might be useful if your mod wishes to report

a fatal configuration error in a pretty way.

 

Throw this through a proxy. It won't work on the dedicated server environment.

 

So it's telling me to run the invalidFingerprint method through the proxy, which doesn't really make too much sense to me, because from what I know, the proxy is used for registering things like TileEntities and SpecialRenderers. I'm still not too clear how to call the initGui method inside the class as well.

I am the self-nominated Lord of the Mastodons and don't you dare deny it. ;) Also, check out my YouTube channel: https://www.youtube.com/user/DerpDerp44/

Link to comment
Share on other sites

But then how do I specify which GuiScreen I want it to load? I can keep the invalidFingerprint method in my main mod class, but just instead of:

public void invalidFingerprint(FMLFingerprintViolationEvent e) I write

public void invalidFingerprint(FMLFingerprintViolationEvent e) throws CustomModLoadingErrorDisplayException

I am the self-nominated Lord of the Mastodons and don't you dare deny it. ;) Also, check out my YouTube channel: https://www.youtube.com/user/DerpDerp44/

Link to comment
Share on other sites

So why is there an initGui method even in there? Also, my GuiScreen displays important information to the user, and the average Minecrafter is not smart enough to look closely at the error log and will most likely assume that my mod is broken and will delete it from their mods folder.

I am the self-nominated Lord of the Mastodons and don't you dare deny it. ;) Also, check out my YouTube channel: https://www.youtube.com/user/DerpDerp44/

Link to comment
Share on other sites

Sorry if I seem like a real noob, I started java and modding very recently :). So I can basically copy what was in my original drawScreen for the GuiScreen into the CustomModLoadingErrorDisplayException drawScreen? Again, sorry that I'm such a noob. If it helps at all, here's what was in my original GuiScreen class:

public class GuiInvalidFingerprint extends CustomModLoadingErrorDisplayException {

 

public void initGui() {

this.buttonList.clear();

this.buttonList.add(new GuiOptionButton(0, this.width / 2 - 155 + 160, this.height / 4 + 120 + 12, I18n.format("gui.toMenu", new Object[0])));

this.buttonList.add(new GuiOptionButton(1, this.width / 2 - 155, this.height / 4 + 120 + 12, I18n.format("menu.quit", new Object [0])));

}

 

protected void actionPerformed(GuiButton gb) {

if(gb.id == 0) {

this.mc.displayGuiScreen(new GuiMainMenu());

} else if(gb.id == 1) {

this.mc.shutdown();

}

}

 

protected void keyTyped(char c, int i) {

 

}

 

public void drawScreen(int i, int j, float f) {

this.drawDefaultBackground();

this.drawCenteredString(this.fontRendererObj, "Invalid Fingerprint Error!", this.width / 2, this.height - 60 + 20, 16777215);

this.drawString(this.fontRendererObj, "Your mod " + References.MOD_NAME + " seems to have", this.width / 2 - 140, this.height - 60 + 60, 10526880);

this.drawString(this.fontRendererObj, "an invalid fingerprint. This means that", this.width / 2 - 140, this.height - 60 + 60 + 18, 10526880);

this.drawString(this.fontRendererObj, "in all likelihood, this version has been", this.width / 2 - 140, this.height - 60 + 60 + 27, 10526880);

this.drawString(this.fontRendererObj, "tampered with, and may contain a virus.", this.width / 2 - 140, this.height - 60 + 60 + 36, 10526880);

this.drawString(this.fontRendererObj, "It is suggested that you download it again", this.width / 2 - 140, this.height - 60 + 60 + 45, 1025880);

this.drawString(this.fontRendererObj, "from the official site, which can be found", this.width / 2 - 140, this.height - 60 + 60 + 54, 1025880);

this.drawString(this.fontRendererObj, "under " + References.MOD_NAME + ", in the 'Mods' page", this.width / 2 - 140, this.height - 60 + 60 + 63, 1025880);

this.drawString(this.fontRendererObj, "of your startup screen.", this.width / 2 - 140, this.height - 60 + 60 + 72, 1025880);

}

}

I am the self-nominated Lord of the Mastodons and don't you dare deny it. ;) Also, check out my YouTube channel: https://www.youtube.com/user/DerpDerp44/

Link to comment
Share on other sites

Is there something special I have to put in the initGui method? Because I am pretty sure it is throwing the exception, but the GUI is not showing up and Minecraft is not crashing.

I am the self-nominated Lord of the Mastodons and don't you dare deny it. ;) Also, check out my YouTube channel: https://www.youtube.com/user/DerpDerp44/

Link to comment
Share on other sites

Ok, I understood that part about the buttons, I already knew that, but either it's not throwing the exception even though it's printing the log, or I'm missing something completely. Here's my new code:

public class GuiInvalidFingerprint extends CustomModLoadingErrorDisplayException {

@Override
public void initGui(GuiErrorScreen errorScreen, FontRenderer fontRenderer) {
}

@Override
public void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime) {
	errorScreen.drawDefaultBackground();
	errorScreen.drawCenteredString(fontRenderer, "Invalid Fingerprint Error!", errorScreen.width / 2, errorScreen.height - 60 + 20, 16777215);
	errorScreen.drawString(fontRenderer, "Your mod 'Atomic Fusion' seems to have", errorScreen.width / 2 - 140, errorScreen.height - 60 + 60, 10526880);
	errorScreen.drawString(fontRenderer, "an invalid fingerprint. This means that", errorScreen.width / 2 - 140, errorScreen.height - 60 + 60 + 18, 10526880);
	errorScreen.drawString(fontRenderer, "in all likelihood, this version has been", errorScreen.width / 2 - 140, errorScreen.height - 60 + 60 + 27, 10526880);
	errorScreen.drawString(fontRenderer, "tampered with, and may contain a virus.", errorScreen.width / 2 - 140, errorScreen.height - 60 + 60 + 36, 10526880);
	errorScreen.drawString(fontRenderer, "It is suggested that you download it again", errorScreen.width / 2 - 140, errorScreen.height - 60 + 60 + 45, 1025880);
	errorScreen.drawString(fontRenderer, "from the official site, which can be found", errorScreen.width / 2 - 140, errorScreen.height - 60 + 60 + 54, 1025880);
	errorScreen.drawString(fontRenderer, "under 'Atomic Fusion', in the 'Mods' page", errorScreen.width / 2 - 140, errorScreen.height - 60 + 60 + 63, 1025880);
	errorScreen.drawString(fontRenderer, "of your startup screen.", errorScreen.width / 2 - 140, errorScreen.height - 60 + 60 + 72, 1025880);
}

}

 

And the invalidFingerprint method:

 

@EventHandler()
public void invalidFingerprint(FMLFingerprintViolationEvent e) throws CustomModLoadingErrorDisplayException {

	if (References.FINGERPRINT.equals("FraWrk273tx9")) {
            LogHelper.info(Messages.CORRECT_FINGERPRINT_MESSAGE);
        }
        else {
            LogHelper.warn(Messages.INVALID_FINGERPRINT_MESSAGE);
        }

}

I am the self-nominated Lord of the Mastodons and don't you dare deny it. ;) Also, check out my YouTube channel: https://www.youtube.com/user/DerpDerp44/

Link to comment
Share on other sites

The invalidFingerprint method throws the exception right after the first line, can't you see it? It specifically says, "throws CustomModLoadingErrorDisplayException". If there is any other place where I should be doing this, please let me know.

I am the self-nominated Lord of the Mastodons and don't you dare deny it. ;) Also, check out my YouTube channel: https://www.youtube.com/user/DerpDerp44/

Link to comment
Share on other sites

I know the part about exceptions. They are thrown most of the time in a try/catch statement. The are basically the boolean of try/catch statements and if the catch part of the statement happens you can use the exception to log what went wrong and things like that. Another way to describe them is the else of an if statement. However, you said specifically not to use a try/catch statement inside my invalidFingerprint method, so the only other option I could think of is throwing the exception off of the class, which doesn't make sense because the code inside of there would never be fired.

I am the self-nominated Lord of the Mastodons and don't you dare deny it. ;) Also, check out my YouTube channel: https://www.youtube.com/user/DerpDerp44/

Link to comment
Share on other sites

Then can you at least tell me what I should be doing? I will go look at a tutorial later today, as I have something I need to do now, but at least let me know how I can fix my problem.

I am the self-nominated Lord of the Mastodons and don't you dare deny it. ;) Also, check out my YouTube channel: https://www.youtube.com/user/DerpDerp44/

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

    • Hi fellow minecrafter,   We've got exciting news from the Pacific Laboratory for Artificial Intelligence (PLAI) at UBC! We're merging the worlds of Minecraft and AI research, and you're invited to join through our platform, plaicraft.ai, to aid our data collection process. It's not just playing games; it's contributing to cutting-edge AI research.   BetterStructures and more!!: We want to make the server as fun as possible for everyone so we recently added a bunch of structural plugins that adds over a hundred of new structures and sites for you to explore and challenge. We are also working on PVP, bedwars and skyblock content, which will make the server even more fun!   Here’s how you can get involved! -Register on plaicraft.ai with your email(you can fake one, as long as you can receive email from it it's fine). -Complete a consent form. -Play Minecraft and contribute to science! (all you need is a Chrome browser and a steady internet, you'll be playing on VM)   Why You Should Participate? -Support AI Research: Your gameplay directly contributes to important AI advancements.  -Free Minecraft Access: Enjoy the game without any cost. -We have shaders and a bunch of cool mods loaded on our instances  -Great Community: Our server currently has a fantastic community, with many awesome players you can meet.   Elephant in the room: Now I want to address some obvious concerns, I sure did a good job making us sound like a scam by the above content. I know that the "free Minecraft" thing has always been taboo in the Minecraft community. So how can I prove to you that this is not a scam? - The easiest way and most official way is that we are approved by the University of British Columbia ethics board, our BREB number is H23-02389. You can verify this case number yourself. - The harder way is that I'll explain the technical details of this project and why we choose to provide free Minecraft. So the goal of this project is very similar to the paper MineDojo or MineRL, we want to collect a multi-modal dataset that consists of video, audio, keyboard and mouse movement. Minecraft has been a very important simulation environment for the ML community and there are tons of papers related to it. Now we obviously don't have enough money like those big tech companies who can just pay people to play, so we have to turn to the Minecraft community. To record all the data mentioned, there needs to be a lot of setup and coding, and it's definitely impossible for us to ask people to run these recording programs on their personal computers. So we carefully configured the AWS EC2 instance to run Minecraft alongside the programs. And that's where and why we also provide you with free Minecraft licenses, of course, we are not giving the account to you, just allowing you to be able to play Minecraft on these instances. You might ask, "Why can't I log in with my account on the instances?", that's because first login with your personal Minecraft account is another privacy risk; second not all our target audiences have an account; and lastly we restricted a lot on what you can do on the instance, basically all you can do is play Minecraft and that's all the data we want, allowing you to log in will make things complicated to control.   For more information on the project and the team, visit Dr. Frank Wood’s website or follow @frankdonaldwood on Twitter. You can also learn more about PLAI lab research on our website (just search ubc plai). Join us in transforming your gaming experience into a meaningful contribution to AI research. Let’s push the boundaries of what gaming can achieve together! Happy plaiing!   Best,  The PLAI Team
    • The mod has improved a lot from yesterday just 1 last issue  Here's the crash report- https://pastebin.com/k2A1BAKn   Please help, Thanks.
    • Take Your Gaming Experience to the Next Level with These Essential Tools   If you're a Minecraft enthusiast, you've likely experienced the need to customize your world and server to make it more exciting and challenging. Fortunately, there's a perfect solution for you: https://menzatyx.xyz, the website that offers a wide selection of free and pre-configured Minecraft plugins. At https://menzatyx.xyz, you'll find a diverse range of plugins that will allow you to take your gaming experience to the next level. From server management tools to mods that add new functionalities, each of these plugins has been carefully selected and configured, so you can enjoy a more personalized and thrilling Minecraft experience. One of the primary benefits of using these pre-configured plugins is the ease of implementation. You no longer have to spend hours configuring and adjusting each individual plugin. Simply download the package that best suits your needs, and you're good to go! You'll be able to enjoy all the features and improvements without investing too much time and effort. From plugins that enhance the security of your server to mods that add new game modes, the variety offered by https://menzatyx.xyz is impressive. Moreover, as these are free plugins, you can access these tools without spending a single penny. It's the perfect opportunity to take your Minecraft experience to the next level without affecting your wallet! Whether you're a casual player or an experienced server administrator, at https://menzatyx.xyz you'll find the Minecraft plugins you need to personalize and enhance your game. Visit the website now and discover how you can transform your Minecraft world into something unique and thrilling!
    • Meaning I need to restart the server and redownload cobblemon?
    • Crash with the error: The game crashed whilst exception ticking world Error: java.util.ConcurrentModificationException pastebin crashlog the game worked for like 24h, then started to receive this error. Things I've tried: removing optifine or other performace mods. tried different versions (older) of the pack. set true to remove error entities and tiles in forge.cfg asked for help on the sevtech github, they said its fixed in the latest sevpatches mod, i updated that mod and its not. I've tried updating multiple mods with no result. tried a different pc and still crashed happened only one time on another map although i cant make it happen again on that map.
  • Topics

×
×
  • Create New...

Important Information

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