Everything posted by Raekye
-
How to dynamically edit and save a Forge mod configuration file?
I'm wondering if it's possible to change config file settings on the go - say, set a value when the user runs a command? I see load, get, and save methods in the Configuration object, but no "set"
-
How to dynamically edit and save a Forge mod configuration file?
I'm wondering if it's possible to change config file settings on the go - say, set a value when the user runs a command? I see load, get, and save methods in the Configuration object, but no "set"
-
what are the other parameters?
If you click on the method (so that the cursor is in the method name) in Eclipse and do control+H it'll bring you to a search - you can find all occurrences or references/calls etc. to a method or field. So you can look at the other places it's used and perhaps deduce what they are. Doesn't answer the question directly but useful in general because a lot of things are still undocumented
-
How to add global command that all players can use?
Oh my god just like last time (also a command question) and all the time... after spending over an hour searching fruitlessly, I immediately find the solution after posting my question on a forum. Anyways... for anyone looking for the solution, also override the public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender) method in CommandBase
-
How to add global command that all players can use?
Hi, I'm trying to register a new command that all players can use (like help). I registered under the server starting event, overrided getRequiredPermissionLevel from command base to be 0 (just like help), but non-ops are still getting "you do not have permissions to use this command". I looked into it; strangely, it seems the "regular available commands" (help, seed, tell, and me) are hard coded. Anyone know a way around it?
-
Data watchers - when should they be used?
I'm reading up and it seems data watchers are thread safe (auto lock/unlock) and also automatically synchronize between the client and the server. I'm wondering when I should use them and when I should use regular class fields? Also, there is a health field in Entity but in the Wolf code it also tracks this.getHealth() on entity init? Could someone explain exactly what are data watches are used for?
-
KeyHandler - what's the use of tickEnd true/false?
I noticed that the KeyHandler's onKeyDown/keyUp methods are always called twice - once on tick begin (presumably) and on tick end. What's the use of having these two? Are there any situations where we need to pay attention to which one we use?
-
How to detect when player equips/unequips armor?
I looked around, and couldn't find much in the source (no methods automatically called). Don't know of any mods that have this exact sort of behavior. I found this pull request https://github.com/MinecraftForge/MinecraftForge/pull/211 with ItemUnequipEvent but it seems it wasn't added Should I look at the code and port it so it's compatible with Forge 7 (I don't want my mod to edit base files)? How quick is it to get a pull request in? Or, are there any other ways I can do this? Currently, I just want to prevent players from unequipping their armor. But I can see how ItemEquipEvents would be useful too.
-
Output text to the chat window?
I was looking for this one, it sends a global chat message MinecraftServer.getServer().getConfigurationManager().sendChatMsg("your message") Take a look at the net.minecraft.command.CommandServerSay class Good luck!
-
ModLoader.addCommand throws exception - how to register new commands? [solved]
Wow as always, after spending tons of time (anywhere from 30 minutes to days) trying to solve a problem, I find the solution immediately after asking in the forum. Well at least this can help future users. The solution is to add a @ServerStarting method in your main mod file: @ServerStarting public void serverStarting(FMLServerStartingEvent event) { // Commands event.registerServerCommand(new MyCommand()); // Commands extend CommandBase }
-
ModLoader.addCommand throws exception - how to register new commands? [solved]
I am trying to register my own commands. I've searched and found a couple threads, pointing to ModLoader.addCommand(new MyCommand()). However, I get this error: cpw.mods.fml.common.FMLModContainer cannot be cast to cpw.mods.fml.common.modloader.ModLoaderModContainer at cpw.mods.fml.common.modloader.ModLoaderHelper.addCommand(ModLoaderHelper.java:213) I am on forge 1.5.1. I'm sure the dependencies are being downloaded properly (I've seen them being downloaded and I haven't done anything complicated and other stuff works). Is there a new way to do this? I know I could do checks every time in the Forge CommandEvent, but that seems kludgy... surely, there must be a way to directly register commands?
-
Minecraft decompile "common" folder empty?
Hi, I noticed that the "common" folder (in the eclipse project) is now empty (1.5.1)? Is this a bug - or the way it is now? I liked it when client-server shared files were grouped together - I looked around but didn't find anything about it (quite localized google query). Just wanted to check if it was my problem - and if not what was the reasoning behind this change?
- Unable to debug from Server
-
Unable to debug from Server
The code seems to execute on the server (when I relog in the changes by my mod are still there; I know it's not just the client that has the mod) but any System.out.printlns don't work. Well, if I System.out.println() in the main mod file it shows up. But if I try logging in any of the class files (which are being loaded) it doesn't show up. While I'm at it, any tips for coding client + server mods? It's annoying when everything executes twice and I have to check for worldObj.isRemote
-
How to make zombies attack each other?
Alright the change was to add AIAttackOnCollide. Not sure how that fixed it (zombies weren't even moving to each other) but that's alright now
-
How to make zombies attack each other?
Didn't work for me. Besides, the documentation said it has no use as of 1.1
-
How to make zombies attack each other?
The point of mods is to do other stuff... I'm asking if I'm missing anything to get zombies to attack each other in the AI (see original post for what I've tried)
-
How to make zombies attack each other?
I'm making a mod with teams so some zombies should attack each other. I've been shifting through AI and entity code for hours without luck; setTarget is working and I've overridden canAttackClass to return true, any help? Thanks in advance. PS: Skeletons with the same AI code works (they'll attack each other). I can't for my life figure out the difference
-
How do I make a launcher?
I get this error in 1.4.5 Client asked for parameter: server Exception in thread "Minecraft main thread" java.lang.NoClassDefFoundError: org/ lwjgl/opengl/Display at net.minecraft.client.Minecraft.a(SourceFile:205) at net.minecraft.client.Minecraft.run(SourceFile:515) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.lwjgl.opengl.Display at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 3 more Caused by: java.util.zip.ZipException: ZipFile closed at java.util.zip.ZipFile.ensureOpenOrZipException(Unknown Source) at java.util.zip.ZipFile.access$1300(Unknown Source) at java.util.zip.ZipFile$ZipFileInputStream.read(Unknown Source) at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(Unknown Source) at java.util.zip.InflaterInputStream.read(Unknown Source) at java.util.jar.JarVerifier$VerifierStream.read(Unknown Source) at sun.misc.Resource.getBytes(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) ... 9 more
-
How do I make a launcher?
Thanks, I'll check it out.
-
How do I make a launcher?
Hi, I'm trying to make my own Minecraft launcher. I've looked at resources like Magic Launcher, MultiMC, Sk's launcher, http://www.minecraftforge.net/forum/index.php/topic,1282.0.html, and http://www.minecraftforge.net/forum/index.php/topic,1464.0.html, etc. I really have no idea where to start. 1. What should my starting class be? A subclass of applet? From one of the posts it seems like something is happening in FML->relaunchApplet? If I set system property "minecraft.applet.WrapperClass" to my class, it craps out other classes? And in the other forum I (like the OP) don't get what the other members says by "Use minecraft.main"? 2. What's the proper way to "launch" the game? Like how should I call it so it doesn't mess up relaunchApplet? I've been stuck on this for a week now, and finally decided to ask for help. There hasn't been much documentation as I expect, regular mods are much different than launchers. If you must know what I'm making: Thanks for any advice. Cheers, Raekye
-
Register listener to player/entity
Ah yes, that makes sense. Thank you!
-
Register listener to player/entity
I'm making a mod that needs to listen to user events. Instead of checking all events to see if its entity property is X player (I assume it'd be costly), is there a way to add listeners to specific players?
IPS spam blocked by CleanTalk.