Minecraft Blogs / Tutorial

How to make a custom flint and steel! MCFORGE

  • 1,894 views, 3 today
  • 1
  • 0
angelx9060's Avatar angelx9060
Level 14 : Journeyman Modder
4
You will need: Modding stuffs, base mod classes, a bit of modding knowledge!
Step 1: Create the Item, I am going to call it CoalAndSteel so:
Under @instance I am going to type: public static Item coalandsteel = new CoalAndSteel(5000).setUnlocalizedName("coalandsteel").func_111206_d("pics:coalandsteel");
If you didn't know .func_111206_d is the texture file.

Step 2:
Now we need to create the CoalAndSteel class so hover over CoalAndSteel and create a class!

Step 3: Place this in CoalAndSteel class:http://pastebin.ca/2432277

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class CoalAndSteel extends Item
{
public CoalAndSteel(int par1)
{
super(par1);
this.maxStackSize = 1;
this.setMaxDamage(64);
this.setCreativeTab(CreativeTabs.tabTools);

public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par7 == 0)
{
--par5;
}

if (par7 == 1)
{
++par5;
}

if (par7 == 2)
{
--par6;
}

if (par7 == 3)
{
++par6;
}

if (par7 == 4)
{
--par4;
}

if (par7 == 5)
{
++par4;
}

if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
{
return false;
}
else
{
if (par3World.isAirBlock(par4, par5, par6))
{
par3World.playSoundEffect((double)par4 + 0.5D, (double)par5 + 0.5D, (double)par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
par3World.setBlock(par4, par5, par6, Block.fire.blockID);
}

par1ItemStack.damageItem(1, par2EntityPlayer);
return true;
}
}}

And then you are basically done!
Tags

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome