Jump to content

Help
Latest News Article

[V1.1] [MOAPI] ModOptionsAPI [8]


387 replies to this topic

#1

    Clintonio

    Lapis Lazuli Collector

  • Members
  • 1075 posts
  • Location: UK
  • Minecraft: Clintonxa

Posted 04 March 2011 - 03:47 AM

Simple Options Menus For Mods


Does your mod need simple, configurable options? Do you not want to edit core Minecraft files to do this? Or did the mod you just download tell you to come here? If so, you're in the right place.

Regular users please go to the Installation section
Developers please go to the Developers section

Screenshots

Options | Example | Ingame | Menu | Global Options

Installation

Download URL: Download Here

1) Find your minecraft.jar (check note below)*

2) Open the minecraft.jar file in WinRAR or 7zip (do not extract it)

3) Extract the contents of the ModOptionsAPI ZIP file

4) Copy the files into your minecraft.jar

Note: Select the files AND folder "moapi" and drop them in, do not open the folder "moapi" and copy those files separately, it will make minecraft crash.

5) Delete META-INF folder IF it exists in the minecraft.jar

6) Run Minecraft

Requirements

Please download and install Risugami's ModLoader

Compatibility

GUIAPI Patch: GuiAPI Patch

Known issues: Requires GUIAPI patch to run with GUIAPI

* Windows: <your user folder>/AppData/Roaming/.minecraft/bin/
* Mac: Home -> Library -> Application Support -> Minecraft -> bin
* Linux: ~/.minecraft/bin/


Usage

Global Options

These options affect every world/ server you are on (depending on how the mod is designed) and can be overridden by local options.

Local Options (server/ world)

These options affect ONLY the world you are on, or the server. If they are set to GLOBAL they will use the value set in the global options. Otherwise, they override the global values.

If the option is not available in singleplayer, or multiplayer, the mod creator has choosen to disable it locally.

Finally, to put a value back to GLOBAL, right click it.

Mods Using This API


Developers

Developer Version: Download Here
Github: Here

ModOptionsAPI Walkthrough for Developers

This download includes full commented de-obfuscated source code, obfuscated class files, javadoc and an example java file. Please read the readme which has more information.

Support is available in-thread.

API Features

  • Boolean/Toggle options
  • List/MultiValue options
  • Text options
  • Key binding options
  • Slider options (int/float based)
  • Sub-option menus for more complex menus
  • A more complex OO API for those who dislike the simpler addToggleOption/getOptionValue/setOptionValue API
  • Full included JavaDoc, source and a fully working example mod in the download
  • Simple API for modifying the GUI settings
  • Well designed and consistent API
  • World and server specific values
  • Super simple API using a new ModOptions file format!

Version History and API Changes

1.1 Versions

Download MOAPI 8 here GuiAPI Patch (Developer Version) - 20/01/2012

- Updated for Minecraft 1.1

Download MOAPI 7 here GuiAPI Patch (Developer Version) - 01/01/2012

- Updated for Minecraft 1.0

Older ersions are now 100% unsupported as of Minecraft full release.

Planned Changes

- Add constructor to all options to allow for "ID" values for each option.
- Super secret idea.
- Restructure mod, improve API. 0.8 will not be backwards compatible.

Register or log in to remove.

#2

Posted 04 March 2011 - 07:44 AM

Simplistic and neat is always awesome. :iapprove:

I support this mod.
Posted ImagePosted Image

#3

    Clintonio

    Lapis Lazuli Collector

  • Members
  • 1075 posts
  • Location: UK
  • Minecraft: Clintonxa

Posted 04 March 2011 - 12:33 PM

8BitGinno said:

Simplistic and neat is always awesome. :)

I support this mod.

Thank you! My style always aims to be as simple as physically possible without detracting from value.

#4

Posted 04 March 2011 - 01:49 PM

You've got to get the big boys like Mo' Creatures to jump ship from GUI API mod to this mod before most smaller mods will use this, because the smaller mods are going to want to be compatible with the big boys.

My problem with GUI API right now is that there's no guide on the basics of using it. I don't like learning by example and trial and error very much either. I like structured learning. And reversing it to figure it out is pretty time-consuming, when he could just give a quick "The Basics" guide.

#5

    Clintonio

    Lapis Lazuli Collector

  • Members
  • 1075 posts
  • Location: UK
  • Minecraft: Clintonxa

Posted 04 March 2011 - 02:10 PM

Pulseczar said:

You've got to get the big boys like Mo' Creatures to jump ship from GUI API mod to this mod before most smaller mods will use this, because the smaller mods are going to want to be compatible with the big boys.

My problem with GUI API right now is that there's no guide on the basics of using it. I don't like learning by example and trial and error very much either. I like structured learning. And reversing it to figure it out is pretty time-consuming, when he could just give a quick "The Basics" guide.
Honestly, that was my justification too.

Do you think I should include more "help"? The comments in my example.java, I thought, were helpful.

But I can run through a more powerful tutorial if needbe.

#6

  • Location: Oregon. Usa. North America. Earth. Sol System. Milky Way

Posted 04 March 2011 - 07:25 PM

Quote

Compatibility

Compatible with modloader
Incompatible with GUI API (If needed, can be made compatible)

I would LOVE to use this mod so I could use Autoforest, but I really need the GUI API for a couple of my "must have" mods.
So may I please a compatibly patch so I can have it all?

Thanks in advance

View PostNytmre, on 17 May 2012 - 03:00 PM, said:

You start Minecraft by punching a tree. Realism got thrown out the window the moment you start playing.

#7

    Clintonio

    Lapis Lazuli Collector

  • Members
  • 1075 posts
  • Location: UK
  • Minecraft: Clintonxa

Posted 04 March 2011 - 09:09 PM

savagehart said:

Quote

Compatibility

Compatible with modloader
Incompatible with GUI API (If needed, can be made compatible)

I would LOVE to use this mod so I could use Autoforest, but I really need the GUI API for a couple of my "must have" mods.
So may I please a compatibly patch so I can have it all?

Thanks in advance

I've re-uploaded version 0.1 with a "guiapi compatible files" folder in the rar. Simply install the mod with those files instead. You MUST have guiapi installed first, not after. I will aim to maintain compatibility.

Please report any problems, I didn't test very well due to it being dinner. On that note, I'm hungry.

Devnote: Man I love learning new things. This is probably the first time I've done a manual decompile/patch/recompile combo.

#8

Posted 04 March 2011 - 09:12 PM

Clintonxa said:

Pulseczar said:

You've got to get the big boys like Mo' Creatures to jump ship from GUI API mod to this mod before most smaller mods will use this, because the smaller mods are going to want to be compatible with the big boys.

My problem with GUI API right now is that there's no guide on the basics of using it. I don't like learning by example and trial and error very much either. I like structured learning. And reversing it to figure it out is pretty time-consuming, when he could just give a quick "The Basics" guide.
Honestly, that was my justification too.

Do you think I should include more "help"? The comments in my example.java, I thought, were helpful.

But I can run through a more powerful tutorial if needbe.
If you give an example mod of accomplishing some of the basic operations with your API, and you give a reference that lists each of the functions, and any data structures intended to be used by modders, with an explanation of what the functions/structures do and any pertinent information like parameters and return values, then I think you've given enough information.

#9

    Clintonio

    Lapis Lazuli Collector

  • Members
  • 1075 posts
  • Location: UK
  • Minecraft: Clintonxa

Posted 04 March 2011 - 09:37 PM

Pulseczar said:

Clintonxa said:

Pulseczar said:

You've got to get the big boys like Mo' Creatures to jump ship from GUI API mod to this mod before most smaller mods will use this, because the smaller mods are going to want to be compatible with the big boys.

My problem with GUI API right now is that there's no guide on the basics of using it. I don't like learning by example and trial and error very much either. I like structured learning. And reversing it to figure it out is pretty time-consuming, when he could just give a quick "The Basics" guide.
Honestly, that was my justification too.

Do you think I should include more "help"? The comments in my example.java, I thought, were helpful.

But I can run through a more powerful tutorial if needbe.
If you give an example mod of accomplishing some of the basic operations with your API, and you give a reference that lists each of the functions, and any data structures intended to be used by modders, with an explanation of what the functions/structures do and any pertinent information like parameters and return values, then I think you've given enough information.

The class/method reference is in the /doc/ folder. Criticisms welcome, it's my first Javadoc that I've made public.

As for an example mod, there is an example .java file included. Alternatively, there is the mod AutoForest, which also is open source, and uses this mod. It is linked in the first post. The files containing references to the API are BlockLeaves.java and EntityItem.java if you wish to peruse them.

I'm not sure if you checked the .rar or not, but it contains: Class files for the JAR, De-obfuscated Java source, JavaDoc and an example .java source. I can improve each as necessary :3

Did I not make it obvious enough that the .rar I linked has all of the doc, source and class files? ;-;

#10

Posted 04 March 2011 - 10:04 PM

I didn't look at any of your files. I was just saying if you have the components I listed, then you should be good, documentation-wise.

#11

    Clintonio

    Lapis Lazuli Collector

  • Members
  • 1075 posts
  • Location: UK
  • Minecraft: Clintonxa

Posted 04 March 2011 - 11:35 PM

Pulseczar said:

I didn't look at any of your files. I was just saying if you have the components I listed, then you should be good, documentation-wise.

Ah! I was assuming you hadn't too.

I'll also expand the examples file soon, it's not exactly overwhelmingly brilliant.

#12

  • Location: Oregon. Usa. North America. Earth. Sol System. Milky Way

Posted 05 March 2011 - 01:30 AM

Clintonxa said:

savagehart said:

Quote

Compatibility

Compatible with modloader
Incompatible with GUI API (If needed, can be made compatible)

I would LOVE to use this mod so I could use Autoforest, but I really need the GUI API for a couple of my "must have" mods.
So may I please a compatibly patch so I can have it all?

Thanks in advance

I've re-uploaded version 0.1 with a "guiapi compatible files" folder in the rar. Simply install the mod with those files instead. You MUST have guiapi installed first, not after. I will aim to maintain compatibility.

Please report any problems, I didn't test very well due to it being dinner. On that note, I'm hungry.

Devnote: Man I love learning new things. This is probably the first time I've done a manual decompile/patch/recompile combo.

Well, I installed everything and no black screen, I was able to access the api menus (all of them) and nothing went poof. So I'm hopeful B) Thanks!

View PostNytmre, on 17 May 2012 - 03:00 PM, said:

You start Minecraft by punching a tree. Realism got thrown out the window the moment you start playing.

#13

Posted 05 March 2011 - 01:52 AM

Sigh, I can't seem to run any mods at all... I followed the instructions and, if run from Terminal (I use Ubuntu Linux 10.04 with Sun Java) I can get the preloader but it blacks out after that and I get this error:

Exception in thread "Thread-5" java.lang.NoClassDefFoundError: om
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at rb.(SourceFile:14)
at net.minecraft.client.Minecraft.(SourceFile:201)
at k.(SourceFile:34)
at net.minecraft.client.MinecraftApplet.init(SourceFile:34)
at net.minecraft.Launcher.replace(Launcher.java:143)
at net.minecraft.Launcher$1.run(Launcher.java:87)
Caused by: java.lang.ClassNotFoundException: om
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 19 more

I have no clue what I'm doing wrong. I'm just trying to run two mods, this and AutoForest. That's it.

#14

    Clintonio

    Lapis Lazuli Collector

  • Members
  • 1075 posts
  • Location: UK
  • Minecraft: Clintonxa

Posted 05 March 2011 - 02:30 AM

Byozuma said:

Sigh, I can't seem to run any mods at all... I followed the instructions and, if run from Terminal (I use Ubuntu Linux 10.04 with Sun Java) I can get the preloader but it blacks out after that and I get this error:

Exception in thread "Thread-5" java.lang.NoClassDefFoundError: om
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at rb.(SourceFile:14)
at net.minecraft.client.Minecraft.(SourceFile:201)
at k.(SourceFile:34)
at net.minecraft.client.MinecraftApplet.init(SourceFile:34)
at net.minecraft.Launcher.replace(Launcher.java:143)
at net.minecraft.Launcher$1.run(Launcher.java:87)
Caused by: java.lang.ClassNotFoundException: om
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 19 more

I have no clue what I'm doing wrong. I'm just trying to run two mods, this and AutoForest. That's it.

Did you delete the META-INF folder in the JAR root? If not, it's necessary. I see "security" warnings, which usually stem from there.

#15

    Clintonio

    Lapis Lazuli Collector

  • Members
  • 1075 posts
  • Location: UK
  • Minecraft: Clintonxa

Posted 05 March 2011 - 02:32 AM

Also, I'm soon to release 0.2 of this API. It will have one minor change in the API spec which I will document thoroughly.

I will also change the example file to a working example.

I have also found some bugs and am correcting them. One small new feature will be added.

#16

Posted 05 March 2011 - 03:14 AM

Clintonxa said:

Byozuma said:

Sigh, I can't seem to run any mods at all... I followed the instructions and, if run from Terminal (I use Ubuntu Linux 10.04 with Sun Java) I can get the preloader but it blacks out after that and I get this error:

..snip..

I have no clue what I'm doing wrong. I'm just trying to run two mods, this and AutoForest. That's it.

Did you delete the META-INF folder in the JAR root? If not, it's necessary. I see "security" warnings, which usually stem from there.
I compile it from an extracted minecraft.jar so I'm pretty sure there's no Meta-INF folder.

#17

    Clintonio

    Lapis Lazuli Collector

  • Members
  • 1075 posts
  • Location: UK
  • Minecraft: Clintonxa

Posted 05 March 2011 - 03:16 AM

New Release - Version 0.2

This is a developer release but is recommended for regular users too.

New Version Here (also in first post)

Changes

    [*:3osace6d] Changed getOptionValue return type from Object to String for easier parsing
    [*:3osace6d] Added new constructor for ModBooleanOption of: (String name, String OnVal, String OffVal)
    [*:3osace6d] Bug fixes
      [*:3osace6d] Improved saving - no null values stored when constructing a new ModSliderOption with a high/low value
      [*:3osace6d] Fixed subMenus not actually displaying due to an incorrect id check.
    [*:3osace6d] Added a full mod that uses all major functionality in the examples file. Read file for more information.


#18

Posted 05 March 2011 - 03:53 PM

Byozuma said:

Clintonxa said:

Byozuma said:

Sigh, I can't seem to run any mods at all... I followed the instructions and, if run from Terminal (I use Ubuntu Linux 10.04 with Sun Java) I can get the preloader but it blacks out after that and I get this error:

..snip..

I have no clue what I'm doing wrong. I'm just trying to run two mods, this and AutoForest. That's it.

Did you delete the META-INF folder in the JAR root? If not, it's necessary. I see "security" warnings, which usually stem from there.
I compile it from an extracted minecraft.jar so I'm pretty sure there's no Meta-INF folder.
What version of Java are you running?

#19

    Clintonio

    Lapis Lazuli Collector

  • Members
  • 1075 posts
  • Location: UK
  • Minecraft: Clintonxa

Posted 06 March 2011 - 03:28 AM

Byozuma said:

Clintonxa said:

Byozuma said:

Sigh, I can't seem to run any mods at all... I followed the instructions and, if run from Terminal (I use Ubuntu Linux 10.04 with Sun Java) I can get the preloader but it blacks out after that and I get this error:

..snip..

I have no clue what I'm doing wrong. I'm just trying to run two mods, this and AutoForest. That's it.

Did you delete the META-INF folder in the JAR root? If not, it's necessary. I see "security" warnings, which usually stem from there.
I compile it from an extracted minecraft.jar so I'm pretty sure there's no Meta-INF folder.

This is interesting, since I also wrote AutoForest.

So in your minecraft root folder, you pasted the files bq.class, at.class, fs.class and the folder called modoptionsapi into your minecraft.jar? (This includes the files from AutoForest).

I can imagine this happening if you don't put the modoptionsapi folder in the right place in particular.

#20

Posted 07 March 2011 - 03:25 AM

I looked at your API, and it seems too limited for my purposes. I'm trying to a make a GUI for Daylight Savings that gets along with other mods that have a GUI, but I don't think I can make the DS GUI with your API. I would lose too much of what makes my mod nice. Correct me if I'm wrong.