Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

yoshiquest

Members
  • Joined

  • Last visited

Everything posted by yoshiquest

  1. I'm just kinda confused as to how this thing works now. I've tried implementing it, but while it doesn't crash, there's a TON of problems. EDIT: Nvm, I just googled it . I should be able to understand it now. Maybe.
  2. Ok, related question, what's the difference between getUniqueID and getPersistentID on entities?
  3. So I'm about to implement the ability to add extended entity properties, and I'd like to know if there is a common ID I can use to get the player. The reason I'm asking is because the data for all instances in forge-clj (my library for Clojure, see signature) are stored together in one place. I then grab data for an individual instance by using a unique key (for example, I use the x, y, and z values to get the correct data for a Tile Entity). As such, I'm wondering if there is a common ID I can use to get the correct data. Would a UUID work for this? Or is it different between client and server?
  4. Scala tries to be the end-all-be-all solution, which presents a lot of problems, especially since functional programming is more or less tacked on at the end. Honestly? The weirdness is worth it. It's an EXTREMELY powerful language when you get used to it. If you want an example of how powerful it can be if used properly, just look at Walmart's implementation of Clojure for their website, database, etc. And see it get through without a scratch. If you (or anyone else reading this) decides to try learning Clojure, my main piece of advice is to FORGET Java. It uses a completely different (and in my opinion, superior) mindset. As such, forget about Objects, Interfaces, and Methods while reading about Clojure (at least until you need to do inter-op). And I'd also recommend Clojure for the Brave and True, it has a nice sense of humor and yet also explains things quite well (and you can ignore the section on Emacs, there's a lot of options for coding environments). Anyways, on the topic at hand, I think I've just implemented the network system, I just need to test it now. Thanks for the help. EDIT: Just thought I'd say that I did it. You can now create a simple network and such, with only about 5 lines of code.
  5. I'm using Clojure. If you wanna know how inter-op/clojure data in general works, just check out this road map (mainly used for inter-op exclusively). Clojure is actually a beautiful language, it's just that things become a bit messy once you get into inter-op with java. Because Clojure is a functional programming language (focusing on function operations and immutability), and Java is an Object Oriented Language, inter-op becomes really difficult due to the differences in styles. Luckily, Clojure provides everything you need to make a library in this case (macros, aka clojure code that returns clojure code at compile time, letting you change the syntax, do things at compile time, etc). forge-clj is actually coming along pretty well though! You can view the project in the Mods section here, or just go straight to the github via the link in my signiture. I've managed to compress many complicated processes into simple and clean clojure code so far, so it's nice.
  6. But if you're not using an inner class, but just implementing both interfaces (and being careful with the passed arguments), then it's fine, right? If I can get this thing to work.... I might be able to make the simplest implementation of a network yet. EDIT: I just realized some other problems with my setup, so nevermind. I'll just make a class for each using the darn messy gen-class instead.
  7. Do the implemented methods from IMessageHandler need to be static? I saw in your example you used an internal static class, which is why I'm wonder if it needs to be static to work.
  8. Is it alright to use one class as both the Packet and the Handler (aka have it implement both IMessage and IMessageHandler)? It might seem like bad practice in java, but I'm not using java, and just want to know if it's viable.
  9. Ok, after a lot of reading I... think I get it now. Let me try to summarize how I think it works to see if I'm understanding this. Packets themselves are basically wrappers that implement IMessage. They wrap around a message, providing a way to convert to and from bytes. The Handler takes care of what happens when a message is received. I'm guessing an example would be detecting who received the message, then calling a function on them with the message as an argument. For each mod, a new Channel needs to be created, which these packets are sent along, via the NetworkRegistry, and stored in a field of type SimpleNetworkWrapper. For each type of message you make, the class needs to be registered via your network's registerMessage method. It takes the handler CLASS for it first, which is called upon receiving a message. Then it takes the message wrapper's CLASS (aka packet or implementation of IMessage). And after that it takes a unique ID and the side (client or server) that receives it. These now-registered packets can then be sent by calling the network's .sendTo/.sentToServer/etc. method, with an INSTANCE of the message. Ok, so in order to do what I wish to do, I have to create a new class for the wrapper (packet), of which in my case will only take the nbt data, and convert back and forth between that and bytes. I'd also have to create a new class for the handler in order to tell it what to do, which in my case will call a function of the user's choice. Finally I'd have to create a public static field to store the network itself in. Did I get that right? The reason I'm making this is because I'm creating an API to support another programming language (Clojure), and I needed to know how to do this in order to wrap around it in a Clojure-friendly way.
  10. For the next step of my library, I need to be able to implement a Packet Handler. To make things simple, I'd like to simply make it send NBT data exclusively back and forth (I already have a converter for NBT data that makes it easier to deal with). The main question is: What do I need to do to create a Packet Handler (classes involved, etc.)? Why are Packet Handlers used in the first place? I know there's some tutorials out there, but the tutorial I usually use involved using another library to accomplish this (and a library using another library just gets annoying). And I've looked at some of the other ones, but they're kinda more general than I'd like, and also kinda gave me a headache. I just need an example of a simple Packet Handler that sends NBT data back and forth. I have a feeling this is going to be my hardest challenge yet.
  11. Updated to Version 0.2.2. This version adds support for Tile Entities and NBT data. The interesting thing with NBT data, is that I made a way to convert the NBT data into a Clojure map, as well as the other way around. It works rather well too, so go check it out!
  12. Ah, thanks. That's exactly what I needed to know. Sorry for asking so many questions, I'm good at coding, but still relatively new to Minecraft Forge and how it works.
  13. For a lot of my mod, I've been able to get by merely creating anonymous instances of a class (e.g. creating an anonymous instance of a Block rather than creating a new class TestBlock). I'm not sure what would happen with tile entities though. If I didn't register a tile entity, and yet still returned a new anonymous instance of one, would minecraft break? If so, how? Is there possibly a way around this? The reason I'm asking is that with my forge-clj library (mod that adds support for the Clojure programming language), it's definitely easier and cleaner to create an anonymous instance rather than flat out generating a new class. So any advice on this?
  14. Updated to Version 0.2.1. It's basically just refactoring, but if you're curious all that I changed is on the github. I'll be working on some advanced features next. If anyone has a suggestion as to what forge feature I should add next, feel free to say so.
  15. UPDATE: TUTORIAL AVAILABLE HERE After months of work, asking questions on this forum, and other such things, I have finally created the first usable version of forge-clj, which adds support for the Clojure programming language to Minecraft. Now, you're probably asking, what the heck is Clojure, and why should I care? Well, Clojure is a modern Lisp language. It runs on the JVM like java, but it has a much more fluent and readable syntax (in my opinion), as well as other things, such as the ability to extend the language itself with macros. It also isn't like java, where you have to make a template/file/whatever of literally EVERYTHING. Say goodbye to having to copy and paste the same mod file format, the same block class declaration, and other such things with this (NOTE: Things might get messy if I haven't added something yet). You can read more about the technical details of Clojure itself here, and if you want a good tutorial you could always try Clojure for the Brave and True. As for forge-clj itself, I'm REALLY proud of how this thing is turning out. I used BedrockMiner's Minecraft modding tutorials in order to figure out what I needed to add and how. I'm proud to say that everything covered in the basic modding tutorials there can be done in forge-clj, without excessive Clojure-Java inter-op and such. Most of these tutorials have been implemented in the test-mod that I use to test the mod, and explain how modding with it will work. If you're a Minecraft Modder and want to help, tell me what I need to add to make things better. I've covered some basic things already, and have some plans to cover some advanced things, but if there's something convenient from forge that I've overlooked, tell me so that I can wrap around that too. Checking that the test-mod works in your minecraft installation helps too, as well as making sure everything works (blocks, items, worldgen, etc). Even the average modded minecraft player can help me test this. Anyways, go check them out now (download links/changelog/etc are on the github pages): - forge-clj github link - test-mod github link
  16. Oh, thank you! This is really useful! (I should be able to actually release a usable version of this thing soon, I'll make a post in the mods section when I do.)
  17. I was honestly hoping that there would be a way to merge the jars automatically using forge gradle.... Thanks anyways I guess. EDIT: I think I found an answer on stack overflow here, I'll give it a shot.
  18. Yeah, that probably won't work, since Clojure itself is pretty much written in raw bytecode rather than java from what I understand (so decompiling it won't work well), but thanks anyways.
  19. I feel bad for asking another question so soon, but I need help here (also gradle is confusing for me). Anyways, I think I'm almost ready to start distributing my library, but I want to take care of something first. While everything does run, it still requires the user to have a copy of Clojure.jar (the Clojure compiler) in the mods folder, on top of forge-clj (the library/wrapper I made) and the mod they want to run. So what I'm asking is: is there a way to include a jar file (or its contents) inside the mod jar? Clojure is freely redistributable, so the only problem here is actually including it.
  20. Ah, thanks! This should help me clean things up a bit.
  21. Well, thanks anyways. At least I know it's possible now.
  22. As some of you might know, I've been working on a library to add support for the Clojure programming language to Minecraft. It's going pretty well, in that I've added quite a few basic features to it. And it does work right now, but.... The code is messy as heck. I'm having worries that at this rate it'll either become a pain to maintain, or cause other problems later. The main problem I've run into involves minecraft forge's obfuscator/deobfuscator. Mainly if I simply reference a field in the library, and then try to access it from the mod implementing it, it tries to get the obfuscated version and fails to build. While I was able to get around this with a try/catch block, this seems way messier than it probably really is. So the real question is: how do other people create libraries/apis? Mainly, is there a separate version for developers? If so, how do you create a jar like that (that uses deobfuscated code rather than obfuscated code) using forge gradle?
  23. Ok, let me give an update on the situation. I think I've found a way to do what I want to do without having to use the ClojureAdapter at all. As such, assuming the fixes needed would require a change to Forge, I'll work on that implementation instead. If they don't and there's a way to add the jar to the classpath, I then I might use that, but over all I think the new method I've come up with will be best. Thanks for the support.
  24. Ah, I figured as much. Thanks for the help.
  25. Nope. Same problem. New crash report if ya want it (it's pretty much the same problem, except now it crashes in the dev environment too): But yeah, I didn't think that was it. Underneath, I'm setting the ILanguageAdapter to the ClojureAdapter class via the @Mod annotation. I noticed that the string obtained from there is used by FMLModContainer, and it loads the class via Class.forName() (which takes a package name, not a path). From what I've researched, Class.forName() only fails if either the name is wrong, or the file isn't on the classpath. Maybe the issue has to do with the latter?

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.