- Kiterosma
- Registered Member
-
Member for 11 years, 10 months, and 21 days
Last active Sat, Feb, 18 2017 16:53:15
- 0 Followers
- 185 Total Posts
- 17 Thanks
-
1
lockNload147 posted a message on Modded Sounds Not WorkingIn 1.4.2 and up, the install resource type newsound and sound got replaced with sound3. Maybe that's the issue.Posted in: Modification Development -
9
SpitefulFox posted a message on How to convert your mod from ModLoader to ForgeA lot of people seem to be very intimidated by trying to jump from ModLoader to Forge. This tutorial will, hopefully, break it down and make it easier.Posted in: Tutorials
(Still under construction! )
Contents
Setting Up MCP
Universal Mods
BaseMod and Annotations
Packages
Imports
Load
Registering Things
Setting Up MCP
First, you'll need a fresh new copy of MCP, a clean, unmodified minecraft.jar file, and a clean, unmodified copy of minecraft_server.jar. Make sure they're completely unmodified without Forge or ModLoader or anything else in them. You can get a clean download of the server from minecraft.net and a clean minecraft.jar by using Force Update from the Minecraft launcher.
Then, you'll need a current copy of Forge source. You can find the latest download here. Make sure to download the Source and not the Universal download. Universal is for installing into your actual game to play Forge mods while Source is for writing mods in MCP.
Make sure your Forge, MCP, and jars are all for the same version of Minecraft. Also make sure you're using an up-to-date version of the jdk, or Java Developer Kit. Older versions of java can run into problems when trying to recompile Forge.
Now, set up your MCP like you normally do. Put your bin and resources folders and the minecraft_server.jar into MCP's jars folder. Make sure the minecraft.jar in jars/bin is the clean unmodded one.
Then, extract the forge folder form the Forge Source zip and place it in your MCP folder. Open it up and run the install script in there, which should set everything up and decompile for you. You can now begin writing your Forge mod.
Universal Mods
First thing you may notice about the Forge-ified MCP is that there is a common folder and a minecraft folder in src. This is because Minecraft 1.3 and up are "SMP Merged." Whenever you play a game in singleplayer, there is a "server" running in the background that you are logged into. So, the minecraft client and the minecraft server both share the same code, which is put into the "common" folder. Anything that is purely client-side, such as rendering, will be put into the "minecraft" folder. The nice thing about this is that you don't need to write a client-side and server-side mod if you're using Forge. Any mod written for Forge can potentially be used in either the client OR the server and work just fine, if written correctly. I'll explain this more further in.
BaseMod and Annotations
First of all, your main mod no longer needs to extend BaseMod. Instead, you'll use something called an Annotation. For example:
public class mod_ObsidianTools extends BaseMod
This is probably how your ModLoader mod looks. You can now change that to this:
@Mod(modid = "ObsidianTools", name = "Obsidian Tools", version = "0.1") public class ObsidianTools
Now, instead of having to have a class with the name mod_Blah that extends BaseMod, you can get Forge ModLoader to load your mod with any class name as long as it has that @Mod setup properly before the class declaration. Little tags like @Mod with the At sign in front are called Annotations. You may be slightly familiar with Annotations from using @Override. Forge uses many different annotations, so get ready to be more familiar with them.
In order to use the @Mod annotation in your mod, you'll need to import it by putting this at the top of your mod's file:
import cpw.mods.fml.common.Mod;
I'll explain Imports a little more later into the tutorial.
public String getVersion() { return "1.2.5"; }
Since the @Mod annotation includes your version in it and you're no longer using BaseMod, your mod's main file no longer needs to include a getVersion() method like the one above. If your mod includes something like that, you can safely remove it.
Packages
ForgeModLoader, or FML, can load any class file with the @Mod annotation regardless of what folder or package it's in, unlike regular ModLoader. This means that your mod's main file no longer has to get lost in the net.minecraft.src folder with all the vanilla Minecraft files.
To help organize your mod files and keep them separate from vanilla Minecraft files, you can put them in their own package. Create a folder in MCP's src/common/ folder. For the purpose of this example, lets call it derp. If you did it right, the folder should now contain cpw, net, org, and derp.
Assuming that none of your mod files overwrite any base classes, move them all into the derp folder. Now, your files may start with something like this:
package net.minecraft.src;
Change that in every file into this:
package derp; import net.minecraft.src.*
Now, all your files will be part of their own package in their own folder, but still have access to vanilla code.
Imports
Forge's files are organized into several packages, and in order to use them in your code, you'll need to import them. Import statements are generally located at the very top of .java files and look like this:
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
Importing something into your file allows you to use it. So, if you wanted to use EntityRegistry in your code, you'd need to import it like this:
import cpw.mods.fml.common.registry.EntityRegistry;
If you don't know what package a class is in to import it, find the source for it in MCP's forge folder and look at the top. For example, EntityRegistry has this at the top of the file:
package cpw.mods.fml.common.registry
If you've been following this tutorial, your files probably import statements at the top to import net.minecraft.src.*
This allows them to reference things in vanilla Minecraft without errors. Without imports, the compiler doesn't know what files to look at other than other classes in the same package.
Load
In ModLoader, you had to put all your mod's main stuff in something like this:
public void load()
In Forge, that's no longer the case. Forge mods have three parts, the PreInit, the Init, and the PostInit. They get ran in that order. The Init is basically what your load() was, PreInit is all the little things you want to wrap up before dealing with the main load, and PostInit is for things you want to follow up on afterwards, like hooking into other mods after they've been loaded.
So, you can change your load() method into this:
@Init public void load(FMLInitializationEvent event)
See that @Init annotation? FML will know to run that method when it loads your mod, regardless of what the method name is as long as it has that annotation and takes an FMLInitializationEvent as an argument. For example, you could have this instead:
@Init public void startMod(FMLInitializationEvent event)
Or this:
@Init public void loadDaMod(FMLInitializationEvent event)
Or even this:
@Init public void purpleStrawberryAardvarkRumpus(FMLInitializationEvent event)
It won't matter what you call the method. Just make sure you have the @Init annotation before it and have it take FMLInitializationEvent as an argument.
To make a preInit method, you would do something like this:
@PreInit public void beforeLoad(FMLPreInitializationEvent event)
This method will obviously run before your @Init method and is generally handy for things like loading your config file, which I'll touch on later in this tutorial.
And, of course, there's the PostInit method:
@PostInit public void afterLoaded(FMLPostInitializationEvent event)
This method will run after all mods have loaded, so it's useful for things that need to make sure other mods are loaded, like if your mod has recipes that only work if another mod is also there.
To use any of those methods in your mod, you'll need to import the annotations and init events like this:
import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
Registering Things
Now that you're writing for Forge and not ModLoader, it's time to clean out all the ModLoader method calls. FML includes a "phantom" ModLoader class that will take the method calls to make ML mods compatible, but if you're actually writing with Forge in mind, you're better off avoiding using those. If you leave them in, your mod won't be compatible with SMP, and there's the chance that Forge might drop such compatibility in the future.
Lets start with one you probably use a lot:
ModLoader.registerBlock(tungstenOre);
Instead of using ModLoader for that, use GameRegistry:
GameRegistry.registerBlock(tungstenOre);
Of course, to use GameRegistry, you'll need an import:
import cpw.mods.fml.common.registry.GameRegistry;
Another one you probably use a lot is ModLoader.addOverride(). Well, now that you're using Forge, you should stop it, because there's a better way. Check out this tutorial to learn how to use infinite sprite indices.
ModLoader.addName(tungstenOre, "Deific Ore of Invincibility");
Instead of using ModLoader.addName, use LanguageRegistry:
LanguageRegistry.addName(tungstenOre, "Deific Ore of Invincibility");
Which also needs to be imported:
import cpw.mods.fml.common.registry.LanguageRegistry;
Instead of using this to add smelting recipes:
ModLoader.addSmelting(plasticOre, new ItemStack(plasticIngot), 0.3F);
Use GameRegistry:
GameRegistry.addSmelting(plasticOre, new ItemStack(plasticIngot), 0.3F);
Instead of using ModLoader to add recipes:
ModLoader.addRecipe(new ItemStack(baconBrick, 4), new Object[] { "XX", "XX", Character.valueOf('X'), bacon });
Use GameRegistry:
GameRegistry.addRecipe(new ItemStack(baconBrick, 4), new Object[] { "XX", "XX", Character.valueOf('X'), bacon });
If you're ever confused on what to replace a ModLoader method with, look at the source in the forge folder of MCP. You can find the source for FML's compatibility "ModLoader" in forge/fml/client/net/minecraft/src. Look at the source and you'll see which FML methods the ModLoader methods pass their info on to. For example, ModLoader.addRecipe() looks like this:
public static void addRecipe(ItemStack output, Object... params) { GameRegistry.addRecipe(output, params); }
-
1
Seannery posted a message on McDonalds+ Mod || Complete! || Works for 1.3.2!make a big fat mob and tame it with hambugerPosted in: Minecraft Mods -
1
castlesRme posted a message on Start with moddingShouldn't this be in Mod Discussion?Posted in: WIP Mods -
1
Brandon539 posted a message on [1.4.7] Kiterosma's Herobrine Mod [v0.4]So me and my friends were bored to hell last night during a sleepover. I decided to get a mod that would creep em out a bit since we all love minecraft.Posted in: WIP Mods
So I looked up a scary minecraft mod and found this from a friend. I loved it! I was literally scared to do anything last night.
I also have a youtube channel with 350 subscribers (Youtube.com/BrandonB539) where I mostly feature minecraft videos. I used to do mod reviews and I was planning on doing a quick series with this mod.
This mod is great but I won't be able to make a video of it until next Friday July 6th since I gotta go on vacation, so when I get back I will make a video on this mod. It is truly awesome man. Don't abandon this. One thing that would make this even awesomer (its a word I swear) along with all the ideas that you already currently have I would say it would keep the player on his/her toes by adding multiple ways that herobrine can mess with the player. I mean along with things like the creepy noises, puffs of smoke, and signs I think you should make more scary distractions such as that. Makes it so much more lasting.
Good luck man!
-Brandon - To post a comment, please login.
14
I'm sure a lot of you have heard of the Herobrine Mod in which you need to construct a totem in order to summon herobrine in order to get freaked out by him. Well in this mod, you can worry about him 24/7! A single herobrine is spawned into the world, and from that point on, there are many different ways to get creeped out:
-His eyes glow, so you can spot him from very far away.
-He sneakily places redstone torches when he stalks you
-He steals from your chests if you allow him to get close enough
-He opens all types of doors
-If he's close enough, he will try to kill you with lava while you're mining an ore
-He possesses nearby spiders to be more aggressive (they gain the ability to shoot webs)
-There is a lot of coding going towards the perfection of how he stalks you (movement, teleportation, etc.)
-If you REALLY get on his nerves, he may even send you to the nether
-Thanks to the Amnesia: The Dark Descent soundtrack, there are lots of noises by which he makes himself known
There is also an item which allows you to track down Herobrine, "Herobane", which is made with this very expensive recipe:
This item can also switch to "attack mode" (default toggle is the "x" key), which allows you to shoot anti-
Herobrine projectiles... If you hit him, he will drop a good amount of experience (Bare in mind that Herobrine does not die, he is simply repelled for a period of time) and a special block, "bloodstone". With this, you can create a "blood ingot", which in turn can be crafted into "lazuli blood ingots", and finally "lazuli blood blocks". Lazuli blood blocks are the only things capable of repelling Herobrine away from your chests, so that he doesn't steal from them. Recipes below:
^Blood ingot
^Lazuli blood ingot
^Lazuli blood block
Screenshots:
Creepiness aside, this mod is still a WIP, because there are still many planned features:
IN DEVELOPMENT:
-Miscellaneous creepy behavior (as requested, work is being done on more "traditional" Herobrine behaviors in addition to the ones only seen in this mod.)
-Blood Realm (new dimension, home of Herobrine)
-Portals for Blood Realm
-Herobrine will send you to the Blood Realm if you stare at him for too long
-Bleeding blood stone
Posting screenshots, feedback, or any suggestions (including what his creepy sign messages should say) is encouraged.
PLEASE NOTE: do not expect Herobrine to be a constant annoyance. He is quite rare, so I estimate that you will encounter at least something he does about once every half hour. This is meant to be a mod that runs "in the background" of the main game, so it is by no means central to gameplay.
Here is the latest link to the mod: http://www.mediafire...uhunuktwuoyejmb- v0.4 [1.4.7]
Past versions:
http://www.mediafire...wdb3244esltbg9d - v0.3 [1.3.2]
http://www.mediafire...h0qwbe28zx7b5yo - v0.2 [1.2.5]
http://www.mediafire...bhi30wsapnb79r5 - v0.1 [1.2.5]
Installation instructions (you can also refer to the "README" file in the zip):
-Place all of the class files in minecraft.jar.
-Place the HerobrineTexture folder into minecraft.jar.
-Delete META-INF in minecraft.jar
-Go to resources/sound3/mob and place the HerobrineSound folder into the current directory
You also must have modloader installed for this to work. Here is a link:
http://www.minecraft...minary-updates/
THIS MOD IS NOT COMPATIBLE WITH FORGE!!! Compatibility might be released later on, but right now, it is strictly a Modloader mod.
If you prefer, you could watch this video for specific installation instructions. These instructions were made for 1.2.5, but the installation is the same.
If you have followed all of the above instructions and for some reason, Minecraft is crashing with this mod installed, do the following:
-Get MC Patcher. Here's where you can download it: http://www.minecraft...-hd-fix-242-02/
-Run MC Patcher.
- DO NOT PATCH. Instead, choose "Test Minecraft".
- Do whatever you did before to make the game crash.
- An error report will be displayed once it crashes again. Please copy the error report and paste it as a reply to this forum topic.
- I will do my best to help you fix the error, or possibly debug my own code.
1
1
Yeah, the more documentation the better. I'm not sure how mods work across LAN connections. Did your friend have the mod too?
1
I can safely say that the 1.2.5 version is most definitely not compatible with 1.3.1 minecraft.
Btw, since Minecraft 1.3.2 is already out, there will not be a 1.3.1 Herobrine mod (obviously). Modloader 1.3.2 is out, so the update is in progress!
1
I might as well call this the Herobrine prank mod XD
1
1
There really is no way to make a void method return something. That's just not how it works. Why are you trying to get the method to return the ItemStack object?
1
Wow, thanks for your support!
I do intend on making some sort of item/ritual for getting into the stronghold... whatever it is, I want to make it as epic as possible. As for the lava dumping, I can make that a rarer occurrence if people think that it's more annoying than I intended it to be. However, I want to keep his methods of attack indirect to make it seem as if he is toying with you, because that seems scarier than him charging at you with a weapon.
Also, I'd be glad to have you help me out with textures! Perhaps you could give me a sample of textures you've done? Or if you want you could give me an alternate Herobane item texture as a sample (assuming you've seen that item already).
1
This is the code that shears the sheep. You could take out the whole block that I labelled "useless" and replace it with "setdead();" . As for the other if statement, you could leave "itemstack!=null" and change the itemstack.itemID to the ID of your item. Of course, all of this code must be within the entity class of the mob you want to despawn. So, if you want to be able to despawn all living entities, I would suggest making a method in the EntityLiving class, and then implementing it in the onLivingUpdate() method. Hope this helps!