Right the tutorial shows how to add basic blocks. one of them being the same as dirt, and the other an ore. I have the ore one setup and working. it can be mined using a picaxe etc. like i wanted. I have smelting and crafting recipes working and items added in. But the "genericDirt" example doesn't work. It is there, has the right name etc. but i can not mine it with a shovel or any other tool. it acts as if the block is not there atall.
I know none of that will make sense so here's my code. I will cut it down to the bits you will want
Generic.java
package tutorial.generic;
// This Import list will grow longer with each additional tutorial.
// It's not pruned between full class postings, unlike other tutorial code.
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.item.crafting.FurnaceRecipes;
@Mod(modid="GenericModID", name="Generic", version="0.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class Generic
{
public static Block genericDirt;
@Instance(value="generic")
public static Generic instance;
@SidedProxy(clientSide="tutorial.generic.client.ClientProxy", serverSide="tutorial.generic.CommonProxy")
public static CommonProxy proxy;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
genericDirt = new GenericBlock(503, Material.ground, 0.5F, Block.soundStoneFootstep, CreativeTabs.tabBlock, "genericDirt");
LanguageRegistry.addName(genericDirt, "Generic Dirt");
MinecraftForge.setBlockHarvestLevel(genericDirt, "shovel", 0);
GameRegistry.registerBlock(genericDirt, "genericDirt");
proxy.registerRenderers();
}
}
genericBlock.java
package tutorial.generic;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.block.material.Material;
import net.minecraft.block.StepSound;
public class GenericBlock extends Block
{
public GenericBlock(int id, Material material, float hardness, StepSound sound, CreativeTabs tab, String name)
{
super(id, material);
setHardness(hardness);
setStepSound(sound);
setUnlocalizedName(name);
setCreativeTab(tab);
}
}
code would have been up sooner but was having trouble loading up the website. I am not using this code for a mod i would just rather know whats wrong with it to earn