• 0

    posted a message on Nerdboy's Adventures in creating a Forge based mod in Clojure

    The Adventure (What is this?)

    I intend to write this post a little like a blogpost, where I will try the next step required and report back findings and tips for those interested. The mod idea is a mod update checker, yes this has been done before (once by me) however Clojure is very good at this sort of problem1.I want the main output of this to be the learnings rather than the mod itself.
    I also want to be very clear, that this may not even work out. Even if that is the case then I guess we have still learned about minecraft and Clojure.
    Note1: If anyone has another mod idea please suggest it, however think more data processing rather than adding blocks.

    Why Clojure?

    Clojure is a functional programming language that runs on the jvm (so has access to all Java libraries). The syntax of Clojure is a derivative of Lisp and in my opinion this coupled with it using a "pure functional" paradime makes it's syntax very clean. Furthermore unlike Java functions are "first class citizens" and the concept of Objects do not exist2. I find that this also makes programs both more concise and easier to understand. I guess what it comes down to for me is that I like Clojure and I am interested to see how a minecraft mod will work. Note2: Due to the fact that all Java code can be called in Clojure this is not strictly true, it is however not the "normal" way clojure is used.

    Part 1: Set-Up & Libraries

    The first hurdle I had was setting up a minecraft/clojure environment. Luckily a gradle plugin exists which will allow gradle to compile Clojure code called clojuresque. So I had to add this as a dependancy to my build.gradle
    dependencies {
    classpath 'clojuresque:clojuresque:1.7.0'
    classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
    }
    Add clojars as a repository
    maven {
    name = "clojars"
    url = "https://clojars.org/repo"
    }
    As well as enable the plugin
    apply plugin: 'clojure'
    
    

    The second problem I ran into is by default Minecraft download's its dependencies and Forge adds a few more, some of which are scala specific ones. To run Clojure at least one more library is required (core.clojure). I really had 3 options that I could think of:
    1. Ask the Minecraft Forge developers to download clojure libraries by default as well as the ones it requires.
    2. Package the clojure libraries I require inside my mod.
    3. Create a "Coremod" that will download the required libraries and add them to the classpath after minecraft is started but before mods are loaded.
    I doubt Minecraft Forge will agree to 1 at this early stage (with any luck down the track once we have a working prototype this might work). Option 2, although probably being the easiest will result in relatively large mods that will have to be re-downloaded each time a new version of this mod comes out. Furthermore, it doesn't scale well when (of course by when I mean if) multiple people develop Clojure mods. So I went with number 3. Luckily I do know my way around Coremods quite well. And although Clojure is my new favourite programming language, I have tones of experience in Java. Basically these are the steps required.
      1. Given a list of libraries with their maven details
      2. Loop through each required library
        • If library has previously been downloaded do nothing
        • If not, download the library and put it in a known location
        • Load library using filename from above into classpath

    For a minimum viable solution I am not worring too much about error handling or dependancies of libraries, the former of which I will do when this becomes more stable, the later I can manually do. Because I want this to be more about my Clojure adventures and less about the boring library stuff I will skip ahead and give the TLDR version. This worked without too much trouble. This should allow any potential users to keep a cached version of the required libraries for my mod rather than having to re-download them.
    For those who are interested, here is a link to the github tag with the finished library downloader.
    Stay tuned for the next step of the adventure, trying to make Minecraft Forge load a Clojure mod.
    Posted in: Mapping and Modding Tutorials
  • 1

    posted a message on Mod Update Detector [WIP]
    I had a bit of time where I couldn't use my main computer, so I knocked up a small app to download the snapshot builds here.

    I wouldn't bother downloading anything yet as the mod will not do anything, but you will see a new build pop up about 2 minutes after I push the latest code to github

    Also for those interested, here is the build tool in action

    Posted in: WIP Mods
  • 2

    posted a message on Mod Update Detector [WIP]

    M.U.D.


    Mod Update Detector

    Introduction

    M.U.D. or Mod Update Detector is a "new" mod that I am currently (re)developing*. The basic Idea of the mod is that it will search through your currently installed compatible mods and notify you when a new version is ready to download. Not only will it notify you, but it will also give you the ability to download the new version of the mod in game.

    Furthermore I plan for this mod to be a little bit of a proof of concept for a process for bringing continuous integration to the minecraft modding community. The plan is to set up a process where after a single push to github, a open source tool will build the mod and deploy each snapshot. Optionally a release can also be deployed. This process coupled with itself MUD should automate the entire process of building, deploying, releasing and downloading mods.

    * I have actually had a similar system used in Mine & Blade Battlegear for quite a while.

    About the Mod (what I plan for it at least)

    For mod users
    MUD will run in the background and check for updates of all compatible mods. If out of date mods are found, MUD will notify the player. At this point the player will be able to bring up the MUD display, read the changelog of the mod and download the new release. After minecraft has been restarted the new version of the mod will be loaded.

    For mod developers
    After vyou have made some changes to the source code of your mod and pushed a commit, the following process should occur

    1. A CI tool (such as Snap CI) will detect the new commit
    2. The CI tool will then automatically run the Forge build scripts, creating a new jar
    3. The CI tool will deploy the newly built mod to a hosting site (likely dropbox or CurseForge)
    4. The CI tool will run a script (which I will provide) which will notify a server that a new mod is ready, its version and it's download url
    5. Any user using your mod will then be notified the next time they run minecraft
    The idea is to make deployment as easy as possible after the process has been set up.

    RoadMap

    1. Build a mod on Snap CI as a proof of concept [done]
    2. Deploy the built artifact to dropbox using a simple shell script [done]
    3. Create a "Minimum Viable Release" that will ONLY notify players of an outdated mod via a mod update file hosted by the modder (eg on github)
    4. Add changelog viewing functionality (both for the server and mod)
    5. Add download functionality
    6. Find some modders who would like to be geneia pigs
    Further down the track


    • Create the server that will allow users to notify when new versions have been released and deploy it to heroku
    • Migrate scripts to gradle
    • Migrate server to AWS (If it is well received and more server power is required)
    Finally here are a couple of images of the current MUD in battlegear to give you an idea of what I am going for






    Posted in: WIP Mods
  • 1

    posted a message on Is it possible to have a mod that checks mods for updates?
    Quote from Blazerider11

    It is possible the code would have to go and search the website the mod was downloaded from but most mods have an automatic update checker and the battle gear mod has something called MUD which will detect the update of any mod.


    MUD will only check for updates in mods that are registered to it by the modder who created the mod, as far as I know Battlegear is the only one that takes advantage of it, but we haven't really advertised it.

    source: I wrote it ;)
    Posted in: Mods Discussion
  • 0

    posted a message on [1.4.7] Mine & Blade: Commander - alpha 7
    Quote from EpickSmileyN00bs

    Are you going to still update the mod? Is it just delayed? I see this mod going long ways into minecraft.


    Its basically on hold until someone else updates it or I re-gain interest/time
    Posted in: WIP Mods
  • 0

    posted a message on [1.4.7] Mine & Blade: Commander - alpha 7
    The idea was always to add enemy soldiers evetually, hell I already had the basics of some goblins coded up a very long time ago (see spoiler), texture provided by some people in the community. Problem is I simply do not currently have time time now (which is why others are updating as we speak)

    NPC soldiers that are stronger would be highly unbalanced unless there were enemies of even higher strength.



    Posted in: WIP Mods
  • 0

    posted a message on [1.6.2] Custom Flags - 1.3.1 [ModJam]
    Quote from ATG

    Wow this looks really nice. Its amazing how this was put together in such a short time. Going to try it out on my server later.

    Regarding SMP - are the other players able to see custom flags? Are the flags sent to all of the clients so they are able to see them? Just curious how this works.

    Great job!


    Thanks mate, keep in mind there is quite a bit I added after the Jam (couple of new tools, vertical flags, different flag poles etc) but the base system was all working.

    And yeah the image on the flag is transmitted to the client. The image is converted to 16bit ARGB colour space (so it does have less colours than normal pictures) to save packet space. The packet itself is just a byte array (so 2 bytes = 1 pixel). If you are more interested in the internal working feel free to poke around the source
    Posted in: Minecraft Mods
  • 1

    posted a message on (REQUEST) Dual Wielding Mod for Minecraft 1.5.2
    Quote from Xeius

    If no one would do it then I guess I'll have to do it.. Thanks btw, where can I find the source of the mod?


    Link is in the description, just be warned, it will be a very big task as it uses a lot of function in mcForge/minecraft that were not around in 1.5.2. It would be far easier just to update minecraft (and would be next to impossible t do anyway)
    Posted in: Requests / Ideas For Mods
  • 0

    posted a message on (REQUEST) Dual Wielding Mod for Minecraft 1.5.2
    Quote from tarik00555

    Battlegear 2 will have dual wielding just be patient.


    Battlegear 2 already has dual wielding, but it is written for 1.6.2 not 1.5.2.

    source: I wrote it ;)



    I am not going to downgrade, but you could always download the source and try to downgrade yourself
    Posted in: Requests / Ideas For Mods
  • 1

    posted a message on Longer Weapons?
    Here is my spear renderer IItemRenderer class if you need it for refrence

    It will produce something like this

    So you may have to play around by translating it a bit
    Posted in: Mods Discussion
  • 0

    posted a message on [1.6.2] Custom Flags - 1.3.1 [ModJam]
    Quote from PulverizedElf

    Crash with latest forge:
    ----snip----


    Hmm strange error. I have no idea what could be causing it (for some reason one of the arrays is too large). I could easily fix it by doing better error checking, but that is not really addressing the real issue of the array being too big in the first place and may cause other oddities.

    Have you tried it on the "Recommended" forge (.804)? I cannot really see why there would be a difference between forge versions in this case. Personally I suspect it could be caused by corrupt packet data transmitting a packet of the incorrect size.
    Posted in: Minecraft Mods
  • 0

    posted a message on The Modders' Union - Partners with the TAU!
    Kovu, out of curiosity, any chance you could provide the code you used? Might be helpful for MUD as the "resource location" method depends on there geing a FML @Mod class which I have avoided in MUD
    Posted in: Mods Discussion
  • 0

    posted a message on The Modders' Union - Partners with the TAU!
    Quote from Kovu



    I'd be interested / would use it.
    Quick question, appearantly image loading changed drastically in 1.6.2, mc.renderengine.bindTexture doesn't exist anymore. Could you provide a link to some code that renders an image to the screen?


    Good to know. I might make a seperate git repo and make a topic for it. Not 100% sure what section it should go in though. Possibly Mods? (it is kinda an API)

    the equivilant to binding textures in 1.6.x is
    mc.renderEngine.func_110577_a(resource);


    Where "resource" is a resource location instance.
    Posted in: Mods Discussion
  • 0

    posted a message on The Modders' Union - Partners with the TAU!
    Over the last weekend I have been knocking up my own little solution for a Mod Update Detector (I call it M.U.D). The main aim was to make an update manager that was easy to use and update that would be general enough for other modders to use. Below is a quick overview and images of the system
    • Check if an update is available for your version of minecaft (ie will not notify you if you are on 1.5.2 and there is an update for 1.6.2)
    • Allow you to view the changelog (see 1st image)
    • Allow you to download the most recent version (the old one is deleted)
    • All controlled through a server hosted xml and url file.
    • Exposed it as more of an API, so should in theory allow other modders to take advantage.








    other than releasing it with my mod I have not released it any further. I was wondering if any of you guys would be interested?
    Posted in: Mods Discussion
  • 0

    posted a message on The Modders' Union - Partners with the TAU!
    What do you need Kovu?
    Posted in: Mods Discussion
  • To post a comment, please .