Modding: Smelting Recipes
This is what you will need to add a smelting recipe.
package Tutorial.common;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
@Mod(modid = "YourName_ModName", name = "ModName", version = "Version number")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Tutorial
{
@Init
public void load(FMLInitializationEvent event)
{
}
}
To add a smelting recipe you should add this to your load() method.
GameRegistry.addSmelting(Block.cobblestone.blockID, new ItemStack(Block.stone), 0.1F);
Block.cobblestone.blockID is the block that you want to smelt. This could also be an item.
Block.stone is the block you get back. The 2 numbers that you can see behind the itemstack in the crafting recipes works exactly the same here. The result could also be an item.
The 0.1F is the ammount of XP dropped. 0,1F is the ammount you get from smelting cobblestone into stone, 1F is what you get for smelting diamond ore or gold ore. The higher the number the more xp you get.
The file should now look like this.
package Tutorial.common;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = "YourName_ModName", name = "ModName", version = "Version number")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Tutorial
{
@Init
public void load(FMLInitializationEvent event)
{
GameRegistry.addSmelting(Block.cobblestone.blockID, new ItemStack(Block.stone), 0.1F);
}
}
When you are done you should go back to the tutorials list here.
Geen opmerkingen:
Een reactie posten