Everything posted by LordMastodonFTW
-
[1.7.10] Get localized name by unlocalized name or find Item by name
Here's some methods to get the name translated to what Minecraft reads it as: @Override public String getUnlocalizedName() { return String.format("item.%s%s", Textures.BLOCK_ITEM_TEXTURE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override public String getUnlocalizedName(ItemStack is) { return String.format("item.%s%s", Textures.BLOCK_ITEM_TEXTURE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } public String getUnwrappedUnlocalizedName(String unlocalizedName) { return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); } The name basically ends up like this: tile.modid:block/item name.name To get a nicer name from that, you could do something like this: String nicerName = "nicernamehere"; This would be code-only, and not what the user sees. Getting a nicer name without using the lang method is impossible, as there is the only place Minecraft reads the names from. Getting Minecraft to read names from somewhere else in addition to lang files would be hard, time-consuming, and editing the base files. The only real way to do this without lang would be to use the LanguageRegistry, something that is not recommended for 1.7 and will be removed in 1.8. All in all, either just make a string with the nicer name, or simply use the lang method. They are both simple enough for a first-time user of Eclipse and are there for a reason.
-
[1.7.10] Issues with Pipe connections (mechanical)
Also, I think that something you should try to do is integrate the visual code and the mechanical code, so that automatically when it creates a visual connection it creates a mechanical connection. This is what many big name mod authors do, and it seems to work great, so maybe try it out instead of hardcoding every single possibility of connection, try that. Some pseudo code: Your render class: public void visualConnection() { //Your connection code here } public void onVisualConnection() { if(visualConnection == true) { mechanicalConnection(); } } public void mechanicalConnection() { //Your mechanical connection code here } This way, whenever you make a visual connection, a mechanical connection automatically gets created. I probably did not make that realistic, but then again it's pseudo code from a dev.
-
[1.7.10] Issues with Pipe connections (mechanical)
In my opinion I think you would be better off hardcoding it in GL, because this way you don't have to create a new model in Techne for every option. You can simply use GL.rotatef(params here) and only have to create the basic pipe and the pipe connection. Also, ForgeDirection is an Enum which pairs a number to every compass point you can be looking at and UP and DOWN. So, for instance, 0 is South, and 1 is North, and things like that. You can use these to determine on which compass point/UP or DOWN the pipe is at and create a visual connection. As to your mechanical problem, I'm not entirely sure of the solution, as I have never really done something like it, but I'm sure someone else will present the solution.
-
[1.7.10] Splash Screen
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.
-
[1.7.10] Splash Screen
Again, sorry if I seem like a real noob.
-
[1.7.10] Splash Screen
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); } }
-
[1.7.10] Splash Screen
Ok, so first of all, how do I access THAT method? What is the difference between a GuiErrorScreen and a GuiScreen? Do I make them the same way?
-
[1.7.10] Splash Screen
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.
-
[1.7.10] Splash Screen
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
-
[1.7.10] Splash Screen
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.
-
[1.7.10] Splash Screen
How do I read them?
-
[1.7.10] Splash Screen
But then how do I get it to display the splash screen? Sorry if it seems like I'm a bit of a noob, I just don't have too much experience in either java or modding.
-
[1.7.10] Splash Screen
Oh, now I understand. I throw CustomModLoadingErrorDisplayException from the invalidFingerprint method, right?
-
NEED HELP!! Mod Ore Loading error in Eclipse and I don't know why!
You probably forgot a semi-colon or squiggly bracket somewhere. In addition, telling us it didn't load in Eclipse means nothing, as Eclipse, IDEA, and all the other Java editors run off Java, so if you are getting an error in Eclipse you should also be getting one in IDEA. What tutorial did you follow? Are you sure it isn't for 1.6.4? Like diesieben said, What did you do to fix it? If the answer is nothing, that is a problem by itself. Are you sure you followed the tutorial to the letter? At the very least provide an error report if you would like your problem to get fixed. Saying "I HAVE A PROBLEM FIX MY PROBLEM MAGICALLY WITH YOUR CODE SKILLZ" does not help.
-
[1.7.10] Splash Screen
In a try/catch statement?
-
[1.7.10] Splash Screen
Thank you so much Lex and diesieben, this helps a lot. My only question is how do I call it? I know that it says call it through a proxy, but I don't know how to do that.
-
[1.7.10] Splash Screen
Is that an event, or an error log?
-
[1.7.10] Splash Screen
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.
-
[1.7.10] Splash Screen
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.
-
[1.7.10] Splash Screen
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.
-
[SOLVED] Forge setupDecompWorkspace error
I apparently had an exclamation mark in the name of the mod that was hindering me. Wow. Jeez. I did not expect that to take 5 hours to solve.
IPS spam blocked by CleanTalk.