Jump to content

jabelar

Members
  • Posts

    3266
  • Joined

  • Last visited

  • Days Won

    39

Everything posted by jabelar

  1. It is the arguments for the Run Configuration in Eclipse. For 1.7.10 I'm currently using the following arguments: --version 1.7 --tweakClass cpw.mods.fml.common.launcher.FMLTweaker --accessToken accessToken --userProperties={} --assetIndex 1.7.10 --assetsDir C:/Users/<your username>/.gradle/caches/minecraft/assets (where you replace C:/Users/<your username> with your computer's user directory)
  2. Using either diesieben07's tutorial or similar implementation with CatDany, I keep getting the same error in Eclipse where it doesn't recognize that the onMessage() method is proper @Override. It keeps saying I need to add unimplemented methods for the IMessageHandler or else make it abstract, and also complains that I should remove the @Override. public static class Handler implements IMessageHandler<MyMessage, IMessage> { @Override public IMessage onMessage(MyMessage message, MessageContext ctx) { System.out.println(String.format("Received %s from %s", message.text, ctx.getServerHandler().playerEntity.getDisplayName())); return null; // no response in this case } I know I'm missing something fundamental...I don't think making it abstract is the answer because it is suggesting that due to not recognizing the override which seems to be a full implementation.
  3. The MCP project is the "official" project. I've heard that they're concentrating on 1.8 not, but you can submit to them. At one point I think someone had created another wiki to help people understand those methods that MCP hadn't handled, but I don't know if that is still active.
  4. The getSubBlocks() method should return a list of the variations on the block.
  5. Also, why are you using @Mod.EventHandler instead of simply @EventHandler? Maybe the former works, but I've always used the latter.
  6. http://25.media.tumblr.com/tumblr_m50ptiqZd31ro54pzo1_500.jpg[/img] Wow, this thread has 53 posts covering "core modding", events, packet handling (or not), and most members of the forum trying to help at some point.
  7. While I haven't tested yet, I was also worried about it, and an answer on StackOverflow (http://stackoverflow.com/questions/20389255/java-reading-a-resource-file-from-within-jar) said the following: Rather than trying to address the resource as a File just ask the ClassLoader to return an InputStream for the resource instead via getResourceAsStream: InputStream in = getClass().getResourceAsStream("/file.txt")); BufferredReader reader = new BufferedReader(new InputStreamReader(in)); As long as the file.txt resource is available on the classpath then this approach will work the same way regardless of whether the file.txt resource is in a classes/ directory or inside a jar.
  8. The fuse field in EntityTNTPrimed is public, so you can check to see how much more time is left (when time runs out it is explosion). I can't find an obvious event, but you can use a tick event (or onUpdate if you have a custom tile entity that is acting like the Botania flower you mentioned) in which you can look for any EntityTNT around and then check the fuse value.
  9. Are you talking about the Mantle mod stuff here: https://github.com/SlimeKnights/Mantle In that code they do it in a way that might be a bit complex for novice programmer. They created their own custom event called ManualOpen. Then they post that event to the event bus when certain items are right clicked, and they create the document from XML resource files using document builder tools that they post into custom GUI. Sounds really cool, but again it depends on your coding level. The simplest way is to actually create the document in some other tool (like Word or Google Docs) and then print the pages to images (need PNG format). Then you can make a custom GUI where it shows the pages (you can even show two pages like a real book) and then all you have to do is write code to flip the pages when the user clicks or presses arrow keys. I think that is simplest way to make a complicated document appear in your program.
  10. Well, it may not be that you need to learn Java but rather you have to learn to understand what Eclipse is telling you. When it "turns red" if you hover over it Eclipse should pop up with an explanation, and often suggests some fixes (but don't just accept these without understanding why). So what errors specifically are you getting when it turns red? The most important things (after learning Java itself) is to learn to use your IDE to help you and second to learn to look through crash logs to understand what the problem is. With your IDE, especially when modding, you can follow code back to its declaration, you can quickly find all methods by checking type hierachy, you can understand the use of something by checking the call hierarchy, etc. Furthermore, with some settings like updating @Override annotations and imports on save can save you a lot of typing. Anyway, be more specific about the errors and then we can help.
  11. No problem. I had to read it a couple times myself to see it.
  12. Your methods are private when they should be public.
  13. You can get answers to buses and other aspects of using events at my tutorial here: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html Based on the package it is in (net.minecraftforge.event.entity.living) it is on the MinecraftForge.EVENT_BUS. You can confirm that by checking the call hierarchy which confirms it -- the post to the bus happens in the canEntitySpawn() method in the ForgeEventFactory class.
  14. Is there any console errors complaining about not finding the sound asset? Or other errors?
  15. CheckSpawn is the event that fires, although it doesn't look like it has any "reason" field. Just the entity and position basically.
  16. Okay, I got it working using getResourceAsStream(). Basically you need to put it into an InputStream, put that into an InputStreamReader and put that into a BufferedReader. The resource as stream can find files within your JAR assets folder and getting it into BufferedReader allows you to use readLine() and read() functions. For example: readIn = new BufferedReader(new InputStreamReader(getClass().getClassLoader() .getResourceAsStream("assets/mymodid/mycustomassets/"+parName+".txt"), "UTF-8")); Thanks to a post by MultiMote on another thread for giving me confidence to pursue the getResourceAsStream().
  17. Any methods that need to behave differently on server versus client side, usually because they invoke Minecraft code that is "side only". You can't just check for isRemote because the side only classes and methods aren't even loaded so the Java will fail if it sees code (even code paths that won't ever run) that contain classes that aren't loaded. For example, renderer classes are side only. But in many mods you need to register renderers. In that case you might create a method called registerRenderers() and in the CommonProxy that method would not do anything, but in the ClientProxy you would @Override that class and actually register the renderers. Again, in summary, you create two versions of methods with the client only stuff in the client version.
  18. I think I could solve the problem if I could get the absolute path of any other asset in the game. At some point the Java must have that info, but when I tried to follow the code I got a little lost. I guess I need to revert to more Java standard stuff, which I'm not that confident with (in terms of the JAR file navigation). It seems that the classLoader getResourceAsStream() is intended for this sort of thing. Need to see if I can adapt my working file based code to that...
  19. Yes it does. There is code in there, I think the SchematicPrinter class which goes through the file and turns it into blocks. That code explains how the schematic file is interpreted.
  20. What about the EntityInteractEvent? Then I think you could pick them up by right clicking on them (I think, just a suggestion.
  21. Not sure what you mean by "moved" it to the laptop. But for example if your desktop was 64-bit or something maybe it would be a problem. Anyway, try installing Forge fresh and just moving the project (ideally using something like github, but worst case start a new project on your laptop and import all the .java files. If you're regularly working on multiple computers, I strongly suggest using github. I have a tutorial on setting up SourceTree with github for easy version control: http://jabelarminecraft.blogspot.com/p/minecraft-forge-publishing-to-github.html
  22. This kind of error though is common when, like TGG mentions, you pass null to the seed constructor. I notice that your Blocks tomato plant actually references the item (in the set info), so maybe that is mucking things up (since that would be uninitialized at that point). Otherwise, maybe put in some System.out.println() statement to confirm whether the block in your seed is actually null and work backwards until you understand why.
  23. Maybe the animals want some privacy! ;-P Anyway, there is an int field in all EntityAnimal subclasses called breeding. It is a counter that indicates the progress of the breeding -- by default it increments whenever it is in love and has a target and then has baby when the breeding counter reaches 60. So whenever breeding > 0 it should mean it is breeding. However, breeding is a private field and I don't think there is any public getter method. So I think you need to use Java reflection to access the field. Reflection is actually pretty easy, so you should try it. Anyway, the idea would be that every tick (like in world tick event) you would could check if an entity is an instanceof EntityAnimal and if it is you could use reflection to check the breeding counter.
  24. It is supplied by me (the mod maker). It is not a config file -- it is a large byte stream. I would not consider it a user option. It is not expected for users to edit although I would not prevent them from doing it.
  25. That won't work for the regular chat. That would only work for your own GUI. If you make your own GUI you can of course detect key presses (since the point of a GUI is to interact with the user).
×
×
  • Create New...

Important Information

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