- Jadar
- Curse Premium
-
Member for 11 years, 3 months, and 11 days
Last active Tue, Jan, 13 2015 23:54:07
- 0 Followers
- 181 Total Posts
- 16 Thanks
-
1
tankerkiller125 posted a message on [1.7.x][Library][Forge] Developer Capes - HD Cape Support!Thanks for the great lib I really love it plan too write a Custom Donation PHP script to give donors a cool CapePosted in: Minecraft Mods -
69
SoBiohazardous posted a message on [1.7.2]SoBiohazardous's Forge Keybinding TutorialHello all,Posted in: Mapping and Modding Tutorials
So I know these tutorials are a bit poop at the moment. However, I am trying to getting around to update them a bit, make them more clear. Just give me some, I have been super busy lately. I'll update them when I can.
Today we're going to learn how to make a custom key bind that shows up in the options menu, which you can change in the options menu, and use for any boolean in your code.
*Note that these are currently for 1.6.4. If you would like to have this for 1.7.2, scroll down, some of the old concepts can be used with the 1.7.2 update tutorial, if you do it right.
Normal Keybind:
Lets start in our main mod file.
In our @Init method, we declare our button like so:
KeyBinding[] key = {new KeyBinding("Name of Button", Keyboard.KEY_G)}; boolean[] repeat = {false}; KeyBindingRegistry.registerKeyBinding(new TutorialKeyBind(key, repeat));
Note that the parameters can be changed to your liking.
Now we are going to create our TutorialKeyBind class. Its set up like a ticking class:
package package.name import java.util.EnumSet; import java.util.Iterator; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler; import cpw.mods.fml.common.TickType; class TutorialKeyBind extends KeyHandler { private EnumSet tickTypes = EnumSet.of(TickType.CLIENT); public TutorialKeyBind(KeyBinding[] keyBindings, boolean[] repeatings) { super(keyBindings, repeatings); } @Override public String getLabel() { return "TutorialKey"; } @Override public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) { //what to do when key is pressed/down } @Override public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) { //What to do when key is released/up } @Override public EnumSet<TickType> ticks() { return tickTypes; } }
And that's all! Simply change the comments for what you want your keybind to toggle. Sometimes, I'll create a boolean elsewhere, such as an item class, and call check for it in my tick class.
Applying to gui's
Ok, so i'm assuming you have a working gui, and you want a block/item to open it. You also need a working keybind (look above)
Head over to your keybind class and declare a variable:
public static boolean keyPressed = false;
Now add this to your keyDown method:
keyPressed = true;
and then this to your keyUp method:
keyPressed = false;
This is simple logic to check if your key is pressed or not. Now, simply check in your classes for it.
Applying to Items:
Add this to your item class:
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { EntityPlayer player = (EntityPlayer)par3Entity; if(KeyBindSE.keyPressed) { // code for opening gui. //if your not sure, use player.openGui(MAINMODCLASS.instance, YOURGUIID, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); }
Applying to Block:
Add this method in block class:
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { if(keyPressed) { //Gui opening code } }
Simply add your gui opening code in the if statement.
If your having trouble opening gui's, consult the gui tutorials all over the web.
Doing various things to player when key is pressed (basically just getting EntityPlayer object)
First, make a working keybind like the one used in the GUI tutorial.
Then, your going to need a PlayerTickHandler class:
package monkeys.bananas; import java.util.EnumSet; import sobiohazardous.crazyfoods.TutorialKeyBind; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; public class PlayerTickHandler implements ITickHandler { private final EnumSet<TickType> ticksToGet; /* * This Tick Handler will fire for whatever TickType's you construct and register it with. */ public PlayerTickHandler(EnumSet<TickType> ticksToGet) { this.ticksToGet = ticksToGet; } /* * I suggest putting all your tick Logic in EITHER of these, but staying in one */ @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { playerTick((EntityPlayer)tickData[0]); } @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { } @Override public EnumSet<TickType> ticks() { return ticksToGet; } @Override public String getLabel() { return "TutorialPlayerTick"; } public static void playerTick(EntityPlayer player) { if(TutorialKeyBind.keyPressed) { //Code for when the key is pressed. Notice how you have the player parameter } } }
Don't forget to register it like so in your @Init method:
TickRegistry.registerTickHandler(new PlayerTickHandler(EnumSet.of(TickType.PLAYER)), Side.SERVER);
And there you go! Notice the comment in the PlayerTickHandler class, that is how you have access to the player object.
Making it so the key must be "tapped" and not just held down (Thanks to Thobro)
Basically, this is for something like switching modes of an item, ect.
Please read the previous sections, as some of the code is missing in this section.
First, you need to modify your keyDown(*) and keyUp(*) method so it looks similar to this in your keybind class:
public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) { keyHasBeenPressed = true; } @Override public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) { if (keyHasBeenPressed) { keyHasBeenPressed = false; keyPressed = true; }
Now from previous sections of this tutorial, you can call
if (KeyBind.keyPressed) { KeyBind.keyPressed = false; //Insert other code }
Now the code should only happen once when the key is pressed and held down.
If you're getting any problems, view the other sections. This correlates heavily with the above sections.
Updating to 1.7.2
So forge has changed a lot in 1.7.2, if you hadn't noticed, so they have completely removed the keybinding class, it just uses key handler now.
Make a new class, I called mine KeyHandlerTutorial.
public class KeyHandlerTutorial // note that before we extended KeyHandler, but that class no longer exists { /** Key index for easy handling */ public static final int CUSTOM_INV = 0; /** Key descriptions; use a language file to localize the description later */ private static final String[] desc = {"key.tut_inventory.desc"}; /** Default key values */ private static final int[] keyValues = {Keyboard.KEY_P}; private final KeyBinding[] keys; public KeyHandler() { keys = new KeyBinding[desc.length]; for (int i = 0; i < desc.length; ++i) { keys[i] = new KeyBinding(desc[i], keyValues[i], "key.tutorial.category"); ClientRegistry.registerKeyBinding(keys[i]); } } /** * KeyInputEvent is in the FML package, so we must register to the FML event bus */ @SubscribeEvent public void onKeyInput(KeyInputEvent event) { // FMLClientHandler.instance().getClient().inGameHasFocus if (!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) { if (keys[CUSTOM_INV].isPressed()) { TutorialMain.packetPipeline.sendToServer(new OpenGuiPacket(TutorialMain.GUI_CUSTOM_INV)); } } } }
The comments along the way should help you figure it out.
Be sure to register the class as an event!
FMLCommonHandler.instance().bus().register(new KeyHandlerTutorial())
Carry over and then delete your old keybinding code. You should be good to go.
Special thanks to coolAlias
Tips
Need the world object?
World world = Minecraft.getMinecraft().theWorld;
That is a variable of the type World that should help you if you are in a pinch.
Also, here is some examples of various keybind things by coolAlias.
Leave reply's if help is needed.
Leave a If this helped you! -
1
986523714 posted a message on [1.5.2] Code Lyoko Mod 0.4.3 - Minecraft ForumPosted in: Minecraft ModsQuote from 4everLink
any update on the mods progress? it hasn't been dropped has it? afraid it's a bit hard not to start thinking so when there has been no mention of it or post within the thread for like 2 months/. I pray it isn't over though.
What Jadar said. We're mainly working on some fine tuning before the next release. Also forge has not updated to 1.7 either, and it will supposedly be another big change. -
9
986523714 posted a message on [1.5.2] Code Lyoko Mod 0.4.3 - Minecraft ForumI'm sorry to announce that I'm no longer actively working on this mod due to lack of time. The source code is available on github and anyone that wants to continue this mod can. I might come back to this in the future, but it's extremely unlikely.Posted in: Minecraft Mods
UPDATE: While I'm no longer actively working on the mod, Jadar is still working on it. I'll update this post again with a link to the new mod location soon.
I know many people love the tv show code lyoko and were excited for season 5 when it came out on February 28th, 2013, and because of that, I'm proud to bring you the Code Lyoko mod!!!! also please check out my other mods which will be linked here.*******SUPER IMPORTANT UPDATE THAT YOU NEED TO READ*******If you have played on minecraft version 1.5.1 or prior and are installing on minecraft 1.5.2 +, you will need to delete your config file or errors will occur. Thank you for waiting for the 1.5.2 update********************************************************The 0.4.3 version of this mod is now out. Fixed a bunch of bugs and balanced out the recipes and such.here's some of my other mods.http://www.minecraft...od-100-for-151/ (my latest mod)http://www.minecraft...-money-mod-100/I am partnering with Wolfspirit1st, Jadar, and catchaser9620 for the mod.*note: the planet minecraft version may not be up to date right away. this page will always be the most up to date versionPlanet Minecraft http://www.planetmin...code-lyoko-mod/Here's our GitHub: https://github.com/C...ng/CodeLyokoModDESCRIPTIONIn this mod I made all the blocks that will be used for the lyoko sectors. I also added the weapons from all the characters. I plan on adding a dimension for each sector and adding XANA's monsters. there is also a config file to prevent block, item, and dimension ID clashes.Mod SpotlightsMod Spotlight on version 0.4.3 of the mod by NujumKeyMod Spotlight on version 0.4.3 of the mod by Wolfspirit1stMod Spotlight on version 0.4.3 of the mod by JadarMod Spotlight on version 0.4.3 of the mod by meMod Spotlight on Version 0.4.0 of the mod by me *if you haven't seen the updated one, click the link in the video*Next UpdateMod Spotlight on version 0.3.0 of the mod by Wolfspirit1stThe next update for this mod will be the "Lyoko Update".The new features in the update include:-scanners (added and completed)-super computer console (added and completed)-super computer (completed)-cable for connecting the super computer to the scanners and super computer console (completed)-removal of crafting recipe for portal blocks-way to get to the sectors complete (mostly?)-quantum ore is more common-recipes added and modified for blocks and items-life points have been added for when the player is in lyoko-xana's monsters only damage lifepoints instead of health in lyoko and vice versaDownloadsCode Lyoko Mod Universal 0.4.3 for 1.5.2 http://www.mediafire...nxieznk6sk4juzmThe Installation Instructions and requirements are in the readme file which is included in the downloadOld DownloadsCode Lyoko Mod Universal 0.4.2 for 1.5.1 http://www.mediafire...jweghcy914lc91pCode Lyoko Mod Universal 0.4.1 for 1.5.1 http://www.mediafire...u4rmll3a3wi30t5Code Lyoko Mod Universal 0.3.1 for 1.4.7 http://www.mediafire...ma4libd9rnt9yc9Code Lyoko Mod Universal 0.3.0 for 1.4.7 http://www.mediafire...1ew8r2osl0nu8cfCode Lyoko Mod Universal 0.2.0 for 1.4.2 http://www.mediafire...bphy6t8odx0am1tCode Lyoko Mod Client 0.1.1b http://www.mediafire...e5xi3wy2c3zq532Code Lyoko Mod Client 0.1.1a http://www.mediafire...o3pqaf0256xcec3Code Lyoko Mod Client 0.1.0 http://www.mediafire...n65o8cv86q5z8n5The Installation Instructions and requirements are in the readme file which is included in the downloadVersion HistoryVersion 0.4.3-lyoko weapons disappear if you are not wearing the correct armor -if you are in creative with no armor on you can have all the weapons in your inventory-armor recipes have been modified-super computer has a cheaper recipe-lyoko ore and the lyoko ingot have been renamed-removed weapon fragments-blocks used for the tower have been added-added debug/infinite battery item-fixed MANY bugs that caused the game to crash on the server and clientVersion 0.4.2-fixed missing texture bugs-fixed dungeon loot not spawningVersion 0.4.1-fixed a bug that caused the game to crash if the Code Lyoko mod was installed-added some vehicles (don't work yet and are partially glitchy)-added some textures for the armor when it's in the player's inventory (not being worn)-removed crafting recipes for weapons (you get them when you wear the armor if you have room in your inventory)-capes added for developers/contributers (see the list of usernames here https://dl.dropbox.c.../lyokocapes.txt) - we're using Jadar's cape Library (found here http://www.minecraft...oper-capes-api/)-Super Computer has a new GUIVersion 0.4.0-Super Computer as a multi-block-Virtual Block (different texture based on lyoko dimension)-Special abilities added to armor -Aelita's Armor: No fall damage, infinite virtual blocks (like her creativity power), can fly -Odd's Armor: No fall damage, can Jump high -Ulrich's Armor: No fall damage, super sprint (faster sprinting) -Yumi's Armor: No fall damage, never get hungry -William's Armor: No fall damage, super smoke (faster sprinting and invisible while sprinting)-new/modified crafting recipes-armor has an item texture (says missing texture for now)-redone digital sea-added new fuel -uranium (uses ore dictionary so most mods that add uranium should be compatible) -added to worldgen-Beta ReleaseVersion 0.3.1-fixed missing texture glitchVersion 0.3.0-added lead to WorldGen-added lead cells for fuel in the Super Computer-added cells-added armor *not accessible unless you have a program such as NEI or you find it in a dungeon* NOTICE: The armor doesn't have an item texture, but it does have a texture if you wear it. William's armor and Odd's armor don't have completed textures yet, but use Aelita's armor texture for now.-added Super Computer block with a TileEntity and GUI *the buttons don't work and the block texture is a black cube for now*-added recipes for many items *use NEI to view the recipes*Version 0.2.0-THERE WILL BE BUGS IN THIS VERSION-Added many features-1.4.2 releaseVersion 0.1.1b-Removed an "extra" file from download (you can compare the two downloads to see what it was if you want).Version 0.1.1a-Changed the Digital Sea so it doesn't kill people that are in creative mode (falling in the digital sea while in creative may cause an inability to move until the block is broken and you re-log into the map or server).Version 0.1.0-Alpha Release of the "Code Lyoko Mod" - To post a comment, please login.
1
The features we have implemented thus far are as follows:
• Scanner
• Super Computer
• Super Computer Console
• Weapons
• Sectors, with Desert Sector worldgen completed
• Existing vehicles (though you can't drive them)
• Armor
• XANA creatures (AI and Models are awful, that's on the TODO)
• Tower world gen
There is still a lot to do. We need more more help as there is only one active developer at this time. See below to see how you can help.
Be sure to follow me on Twitter and Twitch to get progress updates and dev streams!
Downloads
Download from GitHub
Screenshots
License
Code Lyoko Mod is licensed under the MIT License. That means you can use this on your mod pack with no worries!
Installation
To install the mod, simply install Minecraft Forge first, launch the game at least once, and drag the jar into the mods/ folder.
Contributing
Right now we need some more developers and/or texture artists. If you feel you can help on either of these, you can do one of two things depending on how you want to help.
Texture artists: You can make and post textures here. I can't guarentee that I will use them, so maybe bounce ideas off this thread and also post progress screenshots.
Mod developers: If you feel you can contribute code, please don't hesitate to submit a pull request. To contribute code, first fork the GitHub repository, then make your changes, and submit a pull request. Due note that unnessary refactors, bad code, and such will not be merged. We want this to be a good experience for our users. Please make sure your changes work.
Help
If require assistance please post here or open an issue on GitHub.
Getting Started
First you're going to want to get a Super Computer, some cables, and a Scanner. I recommend to use creative mode, because we haven't really thought out recipes fully yet. Stack the Scanner 5 blocks high. After you are finished it should look like this.
Next you want to add a few cables to the back.
Next add a super computer. The super computer is a multi-block structure that goes like this.
Don't forget to cool it! If you don't it will overheat and blow up!
Finish off the cable job
Add a console!
Add some power to the Super Computer
I know this is a really lacking "Getting Started" but I have tons to do so I hope you can figure some of it out on your own. Have fun!
1
1
On another note, with this upcoming major release, I'm thinking of moving to a JSON based cape config system. An example can be found here. What I want to know is how other people feel about that change and any suggestions you may have.
1
Ya you didn't change the fields in AbstractClientPlayer to public.
1
Looks like you don't have the correct txt and cape image links. Test them in your browser. They go to a site that wraps the files with a Dropbox wrapper. You need a direct link to the media. Right click the file, in the public folder, and click "Copy Public Link" or go to that site you had before, right click Download->Direct Download and copy the link. Paste it to whatever and trim off everything after the '?dl=1' part. Then use that URL in the txt and code.
1
It's pretty cool, a growing number of mods are using it.
1
1
9
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.
1