Developer Capes is used to add developer/tester only capes to your mod!
Notice: Usage changed in version 3. Please refer below to see how to set up DevCapes now.
Note: Previously called DeveloperCapesAPI, DeveloperCapes was renamed because Jadar realized he was stupid. And that this is a library.
It does all the work of adding capes while trying to minimize conflict between mods. It works by reading a JSON file that is hosted somewhere on the internet, i.e Dropbox, that contains the URL of the cape image and all the players to get that cape. Players are stored in groups and groups are given a cape. You can have as many groups as you want.
A star on the GitHub page would be appreciated if this helps you! Also, if your mod uses this library, leave a post below saying so and I'll add it up here.
Getting Started
To start using Developer Capes, see "Set Up" below. See "Usage" below to find out how to implement the library in your mod.
Setting Up the Development Environment
1. Download source code as a zip by clicking "Download Zip" on the right.
2. Unzip to a tempory directory. You can delete this once the source is copied.
3. Copy everything in src/main/java/ to the root of your mod source code.
Usage
Once Developer Capes is in your classpath somehow, you are going to want to add this to your mod when it initialized.
*Note: The note that was previously that said DevCapes didn't have to go in a client proxy has been redacted. You need to put it in the client proxy again
$CAPES_JSON is the URL (in Object or String form,) InputStream, or File to a text file hosted on a server, Dropbox, or GitHub, that has all the data Developer Capes needs to add your capes formatted in JSON.$IDENTIFIER is a unique mod identifier so DevCapes can keep one mod's groups separate from the other.
The JSON for the config looks like this:
"$CAPES_TXT_URL" is the URL to a text file hosted on a server, Dropbox, or GitHub that has all the players, groups, and capes in it. The layout looks like this:
You are going to want to make sure there is a comma after every element in the array, or string, etc, -except- when it is the last one in it's scope. If you do the logs will make this very clear.
Images
The cape image files are 22x17, and should be of the PNG format. Additionally, Developer Capes supports high definition capes. Those must be of the size that is divisible by 16. The height must be half of the width. So 1024x512, 2048x1024, and so on. Host them on a server, Dropbox, or GitHub.
Standalone Mod
* Download mod JAR. Open the jar in a ZIP viewer like 7-Zip.
* Create a config file called anything you want. Guide here. Host it as plain text on the internet.
* Extract the "capesInfo.json" file from the JAR you downloaded. Open in in a text editor.
* Change the value for key "capeConfigUrl" to the URL for your config file.
* Put the file back into the JAR. Save the JAR.
* Distribute the JAR.
Building and Packaging your Mod
When you build and package your mod, you're going to want to make sure you build with the Developer Capes classes.
Thats it! If you have any trouble, make a post here in the Minecraft Forums post or make an issue on GitHub.
Example
In the end, your mod will look like this.
// Init method in main mod class
@Init
public void preInit(FMLPreInitializationEvent event) {
proxy.initCapes();
}
CommonProxy
public void initCapes()
{
}
ClientProxy
@Override
public void initCapes()
{
DevCapes.getInstance().registerConfig("html://www.example.com/cape.txt", "ExampleMod")
}
HD Capes
Thanks to MinebookUK we now have HD Cape support! To use it, just make an HD Cape. It needs to be the size of the resolution it is in. For example, the basic cape is normally 64x32, but it only uses the top left 22x17 for the cape. Increasing the total size of the image will make it work properly. So 512x256, 1024x512, 2048x1028, and so on. Here are some templates for different sizes (courtesy of MinebookUK.)
512x256.
* Put the file back into the JAR. Save the JAR.
* Distribute the JAR.
2. I'm getting a NullPointerException when starting a dedicated server:
You're calling a @SideOnly(Side.CLIENT) class on a server. STOP IT. Put it in a ClientProxy.
3. I'm getting a NoClassDefFoundError and/or a RuntimeExcption (related to an invalid side) on a dedicated server:
See answer to question 2.
4. Do I have permission to use DeveloperCapes Standalone in my modpack?:
Of course! That's what DevCapes Standalone was made for. Plus DevCapes is licensed on the MIT License, which is an open source license. As long as you don't remove the license, you may do whatever you want with DevCapes Standalone.
Licence/Permissions
DeveloperCapes is licensed under the MIT License.
You may re-distribute this content but only in your mod
You may change the source code of this library.
You may re-use code found in this project.
You may not hold me liable for any damages
You must include the license and copyright with all copies of code whether compiled or not.
As cool as this may look, the code is horrible. It puts a lot of unnecessary strain on the Client CPU and has some very weird and badly done code.
The only way to do this properly is to become a FML Coremod, sorry.
As cool as this may look, the code is horrible. It puts a lot of unnecessary strain on the Client CPU and has some very weird and badly done code.
The only way to do this properly is to become a FML Coremod, sorry.
Yes, that would be more efficient. But this is an API for regular Forge mods. So it doesn't make a whole lot of sense to do it that way.
Yes, that would be more efficient. But this is an API for regular Forge mods.
You misunderstand the word API. An API means: An additional thing that needs to be installed (e.g. NEI is the API for the NEI plugins, the NEI Plugins don't include NEI, but depend on it.)
An API for regular mods can be a coremod. And even without a coremod this can be done more efficently.
And your code style is weird, too. For example:
You have a Singleton pattern in your main class, but still all the methods are static, WTF?
Any IOExceptions during download are simply ignored. Not even a Warning message that something went wrong. Not a good thing.
Also you use ConcurrentHashMaps for no reason. You don't have mutliple threads.
Also you loop through every single player every tick. Why? It's enough to change the Cape URL once.
You misunderstand the word API. An API means: An additional thing that needs to be installed (e.g. NEI is the API for the NEI plugins, the NEI Plugins don't include NEI, but depend on it.)
An API for regular mods can be a coremod. And even without a coremod this can be done more efficently.
And your code style is weird, too. For example:
You have a Singleton pattern in your main class, but still all the methods are static, WTF?
Any IOExceptions during download are simply ignored. Not even a Warning message that something went wrong. Not a good thing.
Also you use ConcurrentHashMaps for no reason. You don't have mutliple threads.
Also you loop through every single player every tick. Why? It's enough to change the Cape URL once.
Okay, thanks for showing me my problems. It helps to have some one who knows his stuff to tell you whats wrong so you don't do it next time and learn. I loop through the players because I can't change all the URLs of the players in one swoop. So thats what is up there. The concurrent hash map was an oversight.. Another mod I maintain uses it so I didn't know if I should use it or not. What should I call it if its not technically an API? I wanted to make it so it was compiled with the mod it is serving so that people did not have to download it separately. As for the Singleton pattern, I should read up on that... Take a look now?
Hmm maybe you could make it so that when a player connects the server goes hey player a has joined Ill send a message to players b, c, d and e a message to tell them that that player a has a cape
but wait player b, c, d and e have a cape to ok lets send player a a message so he knows what's going on as well
I think this would be a better approach that to iterate over every player every tick
Hmm, maybe I could do it over a player join event.. I will say I've been playing with it this way and it hasn't shown it self to be a big lag problem..
it will still cause overhead if its running once a tick why wouldn't the on server join way work?
It doesn't fire when your client joins. Your user won't have a cape for you. If I used the ticks as an iterator then every tick it would focus one user instead of all of them.
What happens if 2 mods that you have both have different capes for the same user?
Can you make more groups?
While it is unlikely 2 mods with this will be installed at once, its first come first serve, so the first mod that sets the cape, gets to keep that cape on that player. With different groups, yes you can. Just change the prefix of the line. So it would look like this:
group1=URL
group1=User
group2=URL
group2=User
I would suggest coming up with at unique name, because if two mods have the same group ID I'm not thinking that will go too well..
Notice: Usage changed in version 3. Please refer below to see how to set up DevCapes now.
Note: Previously called DeveloperCapesAPI, DeveloperCapes was renamed because Jadar realized he was stupid. And that this is a library.
It does all the work of adding capes while trying to minimize conflict between mods. It works by reading a JSON file that is hosted somewhere on the internet, i.e Dropbox, that contains the URL of the cape image and all the players to get that cape. Players are stored in groups and groups are given a cape. You can have as many groups as you want.
Current Version
A star on the GitHub page would be appreciated if this helps you! Also, if your mod uses this library, leave a post below saying so and I'll add it up here.
Getting Started
To start using Developer Capes, see "Set Up" below. See "Usage" below to find out how to implement the library in your mod.
Setting Up the Development Environment
1. Download source code as a zip by clicking "Download Zip" on the right.
2. Unzip to a tempory directory. You can delete this once the source is copied.
3. Copy everything in src/main/java/ to the root of your mod source code.
Usage
Once Developer Capes is in your classpath somehow, you are going to want to add this to your mod when it initialized.
*Note: The note that was previously that said DevCapes didn't have to go in a client proxy has been redacted. You need to put it in the client proxy again
$CAPES_JSON is the URL (in Object or String form,) InputStream, or File to a text file hosted on a server, Dropbox, or GitHub, that has all the data Developer Capes needs to add your capes formatted in JSON.$IDENTIFIER is a unique mod identifier so DevCapes can keep one mod's groups separate from the other.
The JSON for the config looks like this:
"$CAPES_TXT_URL" is the URL to a text file hosted on a server, Dropbox, or GitHub that has all the players, groups, and capes in it. The layout looks like this:
You are going to want to make sure there is a comma after every element in the array, or string, etc, -except- when it is the last one in it's scope. If you do the logs will make this very clear.
Images
The cape image files are 22x17, and should be of the PNG format. Additionally, Developer Capes supports high definition capes. Those must be of the size that is divisible by 16. The height must be half of the width. So 1024x512, 2048x1024, and so on. Host them on a server, Dropbox, or GitHub.
Standalone Mod
* Download mod JAR. Open the jar in a ZIP viewer like 7-Zip.
* Create a config file called anything you want. Guide here. Host it as plain text on the internet.
* Extract the "capesInfo.json" file from the JAR you downloaded. Open in in a text editor.
* Change the value for key "capeConfigUrl" to the URL for your config file.
* Put the file back into the JAR. Save the JAR.
* Distribute the JAR.
Building and Packaging your Mod
When you build and package your mod, you're going to want to make sure you build with the Developer Capes classes.
Thats it! If you have any trouble, make a post here in the Minecraft Forums post or make an issue on GitHub.
Example
In the end, your mod will look like this.
CommonProxy
ClientProxy
HD Capes
Thanks to MinebookUK we now have HD Cape support! To use it, just make an HD Cape. It needs to be the size of the resolution it is in. For example, the basic cape is normally 64x32, but it only uses the top left 22x17 for the cape. Increasing the total size of the image will make it work properly. So 512x256, 1024x512, 2048x1028, and so on. Here are some templates for different sizes (courtesy of MinebookUK.)
512x256.
* Put the file back into the JAR. Save the JAR.
* Distribute the JAR.
FAQ
1. How do I get a Dropbox public folder?
Create one here. https://www.dropbox....e_public_folder
2. I'm getting a NullPointerException when starting a dedicated server:
You're calling a @SideOnly(Side.CLIENT) class on a server. STOP IT. Put it in a ClientProxy.
3. I'm getting a NoClassDefFoundError and/or a RuntimeExcption (related to an invalid side) on a dedicated server:
See answer to question 2.
4. Do I have permission to use DeveloperCapes Standalone in my modpack?:
Of course! That's what DevCapes Standalone was made for. Plus DevCapes is licensed on the MIT License, which is an open source license. As long as you don't remove the license, you may do whatever you want with DevCapes Standalone.
Licence/Permissions
DeveloperCapes is licensed under the MIT License.
You may re-distribute this content but only in your mod
You may change the source code of this library.
You may re-use code found in this project.
You may not hold me liable for any damages
You must include the license and copyright with all copies of code whether compiled or not.
the only change that i'll make(maybe) is to change the package declarations
Yep Technically you don't need to change them.
btw check it out on github and contribute maybe
http://www.github.com/Astorian/ExtraneousCraft
The only way to do this properly is to become a FML Coremod, sorry.
Yes, that would be more efficient. But this is an API for regular Forge mods. So it doesn't make a whole lot of sense to do it that way.
An API for regular mods can be a coremod. And even without a coremod this can be done more efficently.
And your code style is weird, too. For example:
You have a Singleton pattern in your main class, but still all the methods are static, WTF?
Any IOExceptions during download are simply ignored. Not even a Warning message that something went wrong. Not a good thing.
Also you use ConcurrentHashMaps for no reason. You don't have mutliple threads.
Also you loop through every single player every tick. Why? It's enough to change the Cape URL once.
Okay, thanks for showing me my problems. It helps to have some one who knows his stuff to tell you whats wrong so you don't do it next time and learn. I loop through the players because I can't change all the URLs of the players in one swoop. So thats what is up there. The concurrent hash map was an oversight.. Another mod I maintain uses it so I didn't know if I should use it or not. What should I call it if its not technically an API? I wanted to make it so it was compiled with the mod it is serving so that people did not have to download it separately. As for the Singleton pattern, I should read up on that... Take a look now?
Hmm, maybe I could do it over a player join event.. I will say I've been playing with it this way and it hasn't shown it self to be a big lag problem..
It doesn't fire when your client joins. Your user won't have a cape for you. If I used the ticks as an iterator then every tick it would focus one user instead of all of them.
While it is unlikely 2 mods with this will be installed at once, its first come first serve, so the first mod that sets the cape, gets to keep that cape on that player. With different groups, yes you can. Just change the prefix of the line. So it would look like this:
I would suggest coming up with at unique name, because if two mods have the same group ID I'm not thinking that will go too well..