can someone help me. I just added a block to my mod and followed syns steps, but now whenever I try and test it by launching it, I get NullPointerException
was this the first block that youve made? or have you made more? because i may have to really look into this and it may not be a minor mistake if more than one person is getting this error
hmm you may want to just watch the other episode, but is it only crashing after you put the block in or before that to?
Nah, I could put in my new item, even with the texture, and it was working, but now I put in the ore and, poof. I get a nullpointexception error, and it crashes
do either of you have twitter? because I could tweet you a lot easier, but again, is it crashing after you make the block or just in general? and did you get the recommended build for forge or the latest?
Nah, I could put in my new item, even with the texture, and it was working, but now I put in the ore and, poof. I get a nullpointexception error, and it crashes
hmm well show me your new code that you added, like paste it here. Also make sure you but it in the right area, and follow me on twitter so we can have a convo about this XD ^-^ itll be easier
do either of you have twitter? because I could tweet you a lot easier, but again, is it crashing after you make the block or just in general? and did you get the recommended build for forge or the latest?
hmm well show me your new code that you added, like paste it here. Also make sure you but it in the right area, and follow me on twitter so we can have a convo about this XD ^-^ itll be easier
was this the first block that youve made? or have you made more? because i may have to really look into this and it may not be a minor mistake if more than one person is getting this error
refined_obsidian_bricks(int par1, String texture) { super
(par1, Material.rock); setCreativeTab(CreativeTabs. tabBlock); //place in creative tabs }
//drops when broken with pickaxe public
int idDropped(int par1, Random par2Random, int par3) { return
Morandomness.refined_obsidian_bricks.blockID; } public
int quantityDropped(Random random) { return
1; }
public
void registerIcons(IconRegister reg) { // Make sure to import IconRegister! this
.blockIcon = reg.registerIcon("refined_obsidian_bricks"); // You can also replace blockID and blockIcon with itemID and itemIcon
}}
its this but moreorganised but soething happened and it spaced out
K here dude I can't read a thing of that, so when you are makin your post there should be a little button that looks kinda like this < > and it's called "code" I want you to copy your code as it is and paste it into that, it'll be a lot easier, thanks ^-^
K here dude I can't read a thing of that, so when you are makin your post there should be a little button that looks kinda like this < > and it's called "code" I want you to copy your code as it is and paste it into that, it'll be a lot easier, thanks ^-^
package Syn;
import java.util.Random;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
public class refined_obsidian_bricks extends Block {
public refined_obsidian_bricks(int par1, String texture) {
super(par1, Material.rock);
setCreativeTab(CreativeTabs.tabBlock); //place in creative tabs
}
//drops when broken with pickaxe
public int idDropped(int par1, Random par2Random, int par3)
{
return Morandomness.refined_obsidian_bricks.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
public void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
this.blockIcon = reg.registerIcon("refined_obsidian_bricks"); // You can also replace blockID and blockIcon with itemID and itemIcon
}}
package Syn;
import java.util.Random;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
public class refined_obsidian_bricks extends Block {
public refined_obsidian_bricks(int par1, String texture) {
super(par1, Material.rock);
setCreativeTab(CreativeTabs.tabBlock); //place in creative tabs
}
//drops when broken with pickaxe
public int idDropped(int par1, Random par2Random, int par3)
{
return Morandomness.refined_obsidian_bricks.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
public void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
this.blockIcon = reg.registerIcon("refined_obsidian_bricks"); // You can also replace blockID and blockIcon with itemID and itemIcon
}}
Ok so I think what your problem is, is that it is just called "Syn;" as the package, it should be "Syn.Tutorial;" depending on what you named your other folder, check you "morandomness" class and see what it is called on the top, if it's called "Syn.Tutorial;" them that what this one should be to! So try that
Ok so I think what your problem is, is that it is just called "Syn;" as the package, it should be "Syn.Tutorial;" depending on what you named your other folder, check you "morandomness" class and see what it is called on the top, if it's called "Syn.Tutorial;" them that what this one should be to! So try that
package Sin.Tutorial; //Package directory
/*
* Basic importing
*/
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.EnumHelper;
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;
import cpw.mods.fml.common.registry.LanguageRegistry;
/*
* Basic needed forge stuff
*/
@Mod(modid="Amethyst",name="Amethyst Mod",version="v1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class ModTutorial {
/*
* ToolMaterial
*/
public static EnumToolMaterial AmethystTool = EnumHelper.addToolMaterial("AmethystTool", 3, 1600, 9.0F, 3.0F, 10);
//Telling forge that we are creating these
//items
public static Item amethyst;
public static Item amethysthalf;
public static Item amethysthalvestack;
public static Item amethystingot;
public static Item amethystaxe;
public static Item amethystshovel;
public static Item amethystpickaxe;
public static Item amethysthoe;
public static Item amethystsword;
public static Item amethysttabicon;
//blocks
public static Block amethystblock;
public static Block amethystore;
//tools
//creative tabs
public static CreativeTabs amethysttab;
//Declaring Init
@Init
public void load(FMLInitializationEvent event){
//World Gen
GameRegistry.registerWorldGenerator(new WorldGeneratorSin());
//define creative tabs
amethysttab = new Tabamethyst(CreativeTabs.getNextID(), "amethysttab");
// define items
amethysttabicon = new Synitems(1999).setUnlocalizedName("amethyst_tab_icon");
amethyst = new Synitems(2000).setUnlocalizedName("amethyst");
amethysthalf = new Synitems(2003).setUnlocalizedName("amethysthalf");
amethysthalvestack = new Synitems(2004).setUnlocalizedName("amethysthalvestack");
amethystingot = new Synitems(2005).setUnlocalizedName("amethystingot");
amethystaxe = new SynAxe(2006, AmethystTool).setUnlocalizedName("amethytst_axe");
amethystshovel = new SynShovel(2007, AmethystTool).setUnlocalizedName("amethyst_shovel");
amethystpickaxe = new SynPickaxe(2008, AmethystTool).setUnlocalizedName("amethyst_pickaxe");
amethysthoe = new SynHoe(2009, AmethystTool).setUnlocalizedName("amethyst_hoe");
amethystsword = new SynSword(2010, AmethystTool).setUnlocalizedName("amethyst_sword");
// define blocks
amethystblock = new AmethystBlock(2001, "amethystblock").setUnlocalizedName("amethyst_block").setHardness(5.0F).setStepSound(Block.soundMetalFootstep).setResistance(3.0F);
GameRegistry.registerBlock(amethystblock, "amethystblock");
amethystore = new AmethystOre(2002, "amethystore").setUnlocalizedName("amethyst_ore").setHardness(5.0F).setStepSound(Block.soundStoneFootstep).setResistance(3.0F);
GameRegistry.registerBlock(amethystore, "amethystore");
//adding names
//CreativeTabs
LanguageRegistry.instance().addStringLocalization("Itemgroup.amethysttab", "en_US", "Amethyst Tab");
//items
LanguageRegistry.addName(amethyst, "§dAmethyst");
LanguageRegistry.addName(amethysthalf, "§dAmethyst Half");
LanguageRegistry.addName(amethysthalvestack, "§dStacked Amethyst Halves");
LanguageRegistry.addName(amethystingot, "§dAmethyst Ingot");
LanguageRegistry.addName(amethystaxe, "§dAmethyst Axe");
LanguageRegistry.addName(amethystshovel, "§dAmethyst Shovel");
LanguageRegistry.addName(amethystpickaxe, "§dAmethyst Pickaxe");
LanguageRegistry.addName(amethystsword, "§dAmethyst Sword");
LanguageRegistry.addName(amethysthoe, "§dAmethyst Hoe");
//blocks
LanguageRegistry.addName(amethystblock, "§dAmethyst Block");
LanguageRegistry.addName(amethystore, "§dAmethyst Ore");
//crafting
GameRegistry.addRecipe(new ItemStack(amethystblock,1), new Object[]{
"TTT","TTT","TTT",'T',amethyst,
});
GameRegistry.addShapelessRecipe(new ItemStack(amethyst,9), new Object[]{
amethystblock});
GameRegistry.addShapelessRecipe(new ItemStack(amethysthalvestack), new Object[]{
amethysthalf,amethysthalf});
GameRegistry.addRecipe(new ItemStack(amethystpickaxe,1), new Object[]{
"TTT"," Y "," Y ",'T',amethystingot,'Y',Item.stick});
GameRegistry.addRecipe(new ItemStack(amethystsword,1), new Object[]{
" T "," T "," Y ",'T',amethystingot,'Y',Item.stick});
GameRegistry.addRecipe(new ItemStack(amethystaxe,1), new Object[]{
"TT ","TY "," Y ",'T',amethystingot,'Y',Item.stick});
GameRegistry.addRecipe(new ItemStack(amethysthoe,1), new Object[]{
"TT "," Y "," Y ",'T',amethystingot,'Y',Item.stick});
GameRegistry.addRecipe(new ItemStack(amethystshovel,1), new Object[]{
" T "," Y "," Y ",'T',amethystingot,'Y',Item.stick});
//smelting
GameRegistry.addSmelting(ModTutorial.amethyst.itemID, new ItemStack(amethysthalf, 1), 5F);
GameRegistry.addSmelting(ModTutorial.amethysthalvestack.itemID, new ItemStack(amethystingot, 1), 5F);
}
}
SynItems
package Sin.Tutorial;
import net.minecraft.item.Item;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
public class Synitems extends Item {
public Synitems(int par1) {
super(par1); //Returns super constructor: par1 is ID
setCreativeTab(ModTutorial.amethysttab); }//Tells the game what creative mode tab it goes in
public void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
if (itemID == ModTutorial.amethyst.itemID) {
this.itemIcon = reg.registerIcon("amethyst"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
if (itemID == ModTutorial.amethysthalf.itemID) {
this.itemIcon = reg.registerIcon("amethyst_halve"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
if (itemID == ModTutorial.amethysthalvestack.itemID) {
this.itemIcon = reg.registerIcon("amethyst_halvestack"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
if (itemID == ModTutorial.amethystingot.itemID) {
this.itemIcon = reg.registerIcon("amethyst_ingot"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
if (itemID == ModTutorial.amethysttabicon.itemID) {
this.itemIcon = reg.registerIcon("amethyst_tab_icon"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
}
}
Tabamethyst
package Sin.Tutorial;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
public class Tabamethyst extends CreativeTabs {
Tabamethyst(int par1, String par2Str)
{
super(par1, par2Str);
}
@SideOnly(Side.CLIENT)
public ItemStack geticonItemStack()
{
return new ItemStack(ModTutorial.amethysttabicon.itemID, 1999, 0);
}
public String getTranslatedTabLabel()
{
return "Amethyst";
}
}
as far as i've seen nothing is different in this from the code used by others that the creative tab code I used was acquired from except for my custom tab being in the main class with the items coding in their classes, whereas the only tutorials i found the coding on had their items coded in their main class, can you notice anything I've done wrong so far? as i said on twitter the items work with them in other creative tabs such as the blocks tab but not in the custom tab i made of Amethyst
Ok so I think what your problem is, is that it is just called "Syn;" as the package, it should be "Syn.Tutorial;" depending on what you named your other folder, check you "morandomness" class and see what it is called on the top, if it's called "Syn.Tutorial;" them that what this one should be to! So try that
ok I cant really see a problem from that so if you could send me the code for your main class files to, ill take a look at it
package Sin.Tutorial; //Package directory
/*
* Basic importing
*/
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.EnumHelper;
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;
import cpw.mods.fml.common.registry.LanguageRegistry;
/*
* Basic needed forge stuff
*/
@Mod(modid="Amethyst",name="Amethyst Mod",version="v1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class ModTutorial {
/*
* ToolMaterial
*/
public static EnumToolMaterial AmethystTool = EnumHelper.addToolMaterial("AmethystTool", 3, 1600, 9.0F, 3.0F, 10);
//Telling forge that we are creating these
//items
public static Item amethyst;
public static Item amethysthalf;
public static Item amethysthalvestack;
public static Item amethystingot;
public static Item amethystaxe;
public static Item amethystshovel;
public static Item amethystpickaxe;
public static Item amethysthoe;
public static Item amethystsword;
public static Item amethysttabicon;
//blocks
public static Block amethystblock;
public static Block amethystore;
//tools
//creative tabs
public static CreativeTabs amethysttab;
//Declaring Init
@Init
public void load(FMLInitializationEvent event){
//World Gen
GameRegistry.registerWorldGenerator(new WorldGeneratorSin());
//define creative tabs
amethysttab = new Tabamethyst(CreativeTabs.getNextID(), "amethysttab");
// define items
amethysttabicon = new Synitems(1999).setUnlocalizedName("amethyst_tab_icon");
amethyst = new Synitems(2000).setUnlocalizedName("amethyst");
amethysthalf = new Synitems(2003).setUnlocalizedName("amethysthalf");
amethysthalvestack = new Synitems(2004).setUnlocalizedName("amethysthalvestack");
amethystingot = new Synitems(2005).setUnlocalizedName("amethystingot");
amethystaxe = new SynAxe(2006, AmethystTool).setUnlocalizedName("amethytst_axe");
amethystshovel = new SynShovel(2007, AmethystTool).setUnlocalizedName("amethyst_shovel");
amethystpickaxe = new SynPickaxe(2008, AmethystTool).setUnlocalizedName("amethyst_pickaxe");
amethysthoe = new SynHoe(2009, AmethystTool).setUnlocalizedName("amethyst_hoe");
amethystsword = new SynSword(2010, AmethystTool).setUnlocalizedName("amethyst_sword");
// define blocks
amethystblock = new AmethystBlock(2001, "amethystblock").setUnlocalizedName("amethyst_block").setHardness(5.0F).setStepSound(Block.soundMetalFootstep).setResistance(3.0F);
GameRegistry.registerBlock(amethystblock, "amethystblock");
amethystore = new AmethystOre(2002, "amethystore").setUnlocalizedName("amethyst_ore").setHardness(5.0F).setStepSound(Block.soundStoneFootstep).setResistance(3.0F);
GameRegistry.registerBlock(amethystore, "amethystore");
//adding names
//CreativeTabs
LanguageRegistry.instance().addStringLocalization("Itemgroup.amethysttab", "en_US", "Amethyst Tab");
//items
LanguageRegistry.addName(amethyst, "§dAmethyst");
LanguageRegistry.addName(amethysthalf, "§dAmethyst Half");
LanguageRegistry.addName(amethysthalvestack, "§dStacked Amethyst Halves");
LanguageRegistry.addName(amethystingot, "§dAmethyst Ingot");
LanguageRegistry.addName(amethystaxe, "§dAmethyst Axe");
LanguageRegistry.addName(amethystshovel, "§dAmethyst Shovel");
LanguageRegistry.addName(amethystpickaxe, "§dAmethyst Pickaxe");
LanguageRegistry.addName(amethystsword, "§dAmethyst Sword");
LanguageRegistry.addName(amethysthoe, "§dAmethyst Hoe");
//blocks
LanguageRegistry.addName(amethystblock, "§dAmethyst Block");
LanguageRegistry.addName(amethystore, "§dAmethyst Ore");
//crafting
GameRegistry.addRecipe(new ItemStack(amethystblock,1), new Object[]{
"TTT","TTT","TTT",'T',amethyst,
});
GameRegistry.addShapelessRecipe(new ItemStack(amethyst,9), new Object[]{
amethystblock});
GameRegistry.addShapelessRecipe(new ItemStack(amethysthalvestack), new Object[]{
amethysthalf,amethysthalf});
GameRegistry.addRecipe(new ItemStack(amethystpickaxe,1), new Object[]{
"TTT"," Y "," Y ",'T',amethystingot,'Y',Item.stick});
GameRegistry.addRecipe(new ItemStack(amethystsword,1), new Object[]{
" T "," T "," Y ",'T',amethystingot,'Y',Item.stick});
GameRegistry.addRecipe(new ItemStack(amethystaxe,1), new Object[]{
"TT ","TY "," Y ",'T',amethystingot,'Y',Item.stick});
GameRegistry.addRecipe(new ItemStack(amethysthoe,1), new Object[]{
"TT "," Y "," Y ",'T',amethystingot,'Y',Item.stick});
GameRegistry.addRecipe(new ItemStack(amethystshovel,1), new Object[]{
" T "," Y "," Y ",'T',amethystingot,'Y',Item.stick});
//smelting
GameRegistry.addSmelting(ModTutorial.amethyst.itemID, new ItemStack(amethysthalf, 1), 5F);
GameRegistry.addSmelting(ModTutorial.amethysthalvestack.itemID, new ItemStack(amethystingot, 1), 5F);
}
}
SynItems
package Sin.Tutorial;
import net.minecraft.item.Item;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
public class Synitems extends Item {
public Synitems(int par1) {
super(par1); //Returns super constructor: par1 is ID
setCreativeTab(ModTutorial.amethysttab); }//Tells the game what creative mode tab it goes in
public void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
if (itemID == ModTutorial.amethyst.itemID) {
this.itemIcon = reg.registerIcon("amethyst"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
if (itemID == ModTutorial.amethysthalf.itemID) {
this.itemIcon = reg.registerIcon("amethyst_halve"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
if (itemID == ModTutorial.amethysthalvestack.itemID) {
this.itemIcon = reg.registerIcon("amethyst_halvestack"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
if (itemID == ModTutorial.amethystingot.itemID) {
this.itemIcon = reg.registerIcon("amethyst_ingot"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
if (itemID == ModTutorial.amethysttabicon.itemID) {
this.itemIcon = reg.registerIcon("amethyst_tab_icon"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
}
}
Tabamethyst
package Sin.Tutorial;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
public class Tabamethyst extends CreativeTabs {
Tabamethyst(int par1, String par2Str)
{
super(par1, par2Str);
}
@SideOnly(Side.CLIENT)
public ItemStack geticonItemStack()
{
return new ItemStack(ModTutorial.amethysttabicon.itemID, 1999, 0);
}
public String getTranslatedTabLabel()
{
return "Amethyst";
}
}
as far as i've seen nothing is different in this from the code used by others that the creative tab code I used was acquired from except for my custom tab being in the main class with the items coding in their classes, whereas the only tutorials i found the coding on had their items coded in their main class, can you notice anything I've done wrong so far? as i said on twitter the items work with them in other creative tabs such as the blocks tab but not in the custom tab i made of Amethyst
The video on creative tabs will be out soon, i am editing the tools one right now and then about to record the creative tabs one creative tabs should be out by early Saturday latest
package test.first;
import net.minecraft.block.Block;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.EnumHelper;
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;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.item.EnumToolMaterial;
import net.minecraftforge.common.EnumHelper;
@Mod(modid="ModTutorial",name="Mod Tutorial",version="v2")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class testMain {
/*
* ToolMaterial
*/
//Telling forge that we are creating these
//items
public static Item berillium;
public static Item refinedBerillium;
//tools
public static EnumToolMaterial berilliumTool = EnumHelper.addToolMaterial("berilliumTool", 2, 250, 6.0F, 2.0F, 14); {
berilliumAxe = new berilliumAxe(6000, berilliumTool).setUnlocalizedName("berillium_axe");
berilliumShovel = new berilliumShovel(6001, berilliumTool).setUnlocalizedName("berillium_shovel");
berilliumPickaxe = new berilliumPickaxe(6002, berilliumTool).setUnlocalizedName("berillium_pickaxe");
berilliumHoe = new berilliumHoe(6003, berilliumTool).setUnlocalizedName("berillium_hoe");
berilliumSword = new berilliumSword(6004, berilliumTool).setUnlocalizedName("berillium_sword");
}
//blocks
public static Block berilliumblock;
public static Block berilliumOre;
public static Object berilliumAxe;
public static Object berilliumShovel;
public static Object berilliumPickaxe;
public static Object berilliumHoe;
public static Object berilliumSword;
//Declaring Init
@Init
public void load (FMLInitializationEvent event) {
// define items
berillium = new testBerillium(6556).setUnlocalizedName("berillium");
refinedBerillium = new testBerillium(7000).setUnlocalizedName("Refined Berillium");
// define blocks
berilliumblock = new berilliumblock(3608, "berilliumblock").setUnlocalizedName("berillium_block").setHardness(5.0F).setStepSound(Block.soundMetalFootstep).setResistance(10.0F);
GameRegistry.registerBlock(berilliumblock, "berilliumblock");
berilliumOre = new berilliumOre(4000, "berilliumOre").setUnlocalizedName("berillium_ore").setHardness(5.0F).setStepSound(Block.soundMetalFootstep).setResistance(10.0F);
GameRegistry.registerBlock(berilliumOre, "berilliumOre");
//adding names
//items
LanguageRegistry.addName(berillium, "Berillium");
LanguageRegistry.addName(refinedBerillium, "Refined Berillium");
LanguageRegistry.addName(berilliumPickaxe, "Berillium Pickaxe");
//blocks
LanguageRegistry.addName(berilliumblock, "Berillium Block");
LanguageRegistry.addName(berilliumOre, "Berillium Ore");
//crafting
//to use dye (new.ItemStack(Item.dyePowder,1 ,4)
//Blocks
GameRegistry.addRecipe(new ItemStack(berilliumblock,1), new Object[]{
"TTT","TTT","TTT",'T',berillium,
});
//smellting
GameRegistry.addSmelting(testMain.berillium.itemID, new ItemStack(refinedBerillium, 1), 5F);
//World Gen
GameRegistry.registerWorldGenerator(new BerilliumOreGen());
}
}
This is my pickaxe class
package test.first;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemSword;
import net.minecraftforge.common.EnumHelper;
public class berilliumPickaxe extends ItemPickaxe
{
public berilliumPickaxe(int ItemID, EnumToolMaterial material)
{
super(ItemID, material);
setCreativeTab(CreativeTabs.tabTools);
}//Tells the game what creative mode tab it goes in
public void registerIcons(IconRegister reg)
{ // Make sure to import IconRegister!
if (itemID == testMain.berilliumPickaxe.itemID)
{
this.itemIcon = reg.registerIcon("berillium_pickaxe"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
}
}
In the pickaxe one if (itemID == testMain.berilliumPickaxe.itemID) the last .itemID says its an error.
package test.first;
import net.minecraft.block.Block;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.EnumHelper;
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;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.item.EnumToolMaterial;
import net.minecraftforge.common.EnumHelper;
@Mod(modid="ModTutorial",name="Mod Tutorial",version="v2")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class testMain {
/*
* ToolMaterial
*/
//Telling forge that we are creating these
//items
public static Item berillium;
public static Item refinedBerillium;
//tools
public static EnumToolMaterial berilliumTool = EnumHelper.addToolMaterial("berilliumTool", 2, 250, 6.0F, 2.0F, 14); {
berilliumAxe = new berilliumAxe(6000, berilliumTool).setUnlocalizedName("berillium_axe");
berilliumShovel = new berilliumShovel(6001, berilliumTool).setUnlocalizedName("berillium_shovel");
berilliumPickaxe = new berilliumPickaxe(6002, berilliumTool).setUnlocalizedName("berillium_pickaxe");
berilliumHoe = new berilliumHoe(6003, berilliumTool).setUnlocalizedName("berillium_hoe");
berilliumSword = new berilliumSword(6004, berilliumTool).setUnlocalizedName("berillium_sword");
}
//blocks
public static Block berilliumblock;
public static Block berilliumOre;
public static Object berilliumAxe;
public static Object berilliumShovel;
public static Object berilliumPickaxe;
public static Object berilliumHoe;
public static Object berilliumSword;
//Declaring Init
@Init
public void load (FMLInitializationEvent event) {
// define items
berillium = new testBerillium(6556).setUnlocalizedName("berillium");
refinedBerillium = new testBerillium(7000).setUnlocalizedName("Refined Berillium");
// define blocks
berilliumblock = new berilliumblock(3608, "berilliumblock").setUnlocalizedName("berillium_block").setHardness(5.0F).setStepSound(Block.soundMetalFootstep).setResistance(10.0F);
GameRegistry.registerBlock(berilliumblock, "berilliumblock");
berilliumOre = new berilliumOre(4000, "berilliumOre").setUnlocalizedName("berillium_ore").setHardness(5.0F).setStepSound(Block.soundMetalFootstep).setResistance(10.0F);
GameRegistry.registerBlock(berilliumOre, "berilliumOre");
//adding names
//items
LanguageRegistry.addName(berillium, "Berillium");
LanguageRegistry.addName(refinedBerillium, "Refined Berillium");
LanguageRegistry.addName(berilliumPickaxe, "Berillium Pickaxe");
//blocks
LanguageRegistry.addName(berilliumblock, "Berillium Block");
LanguageRegistry.addName(berilliumOre, "Berillium Ore");
//crafting
//to use dye (new.ItemStack(Item.dyePowder,1 ,4)
//Blocks
GameRegistry.addRecipe(new ItemStack(berilliumblock,1), new Object[]{
"TTT","TTT","TTT",'T',berillium,
});
//smellting
GameRegistry.addSmelting(testMain.berillium.itemID, new ItemStack(refinedBerillium, 1), 5F);
//World Gen
GameRegistry.registerWorldGenerator(new BerilliumOreGen());
}
}
This is my pickaxe class
package test.first;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemSword;
import net.minecraftforge.common.EnumHelper;
public class berilliumPickaxe extends ItemPickaxe
{
public berilliumPickaxe(int ItemID, EnumToolMaterial material)
{
super(ItemID, material);
setCreativeTab(CreativeTabs.tabTools);
}//Tells the game what creative mode tab it goes in
public void registerIcons(IconRegister reg)
{ // Make sure to import IconRegister!
if (itemID == testMain.berilliumPickaxe.itemID)
{
this.itemIcon = reg.registerIcon("berillium_pickaxe"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
}
}
In the pickaxe one if (itemID == testMain.berilliumPickaxe.itemID) the last .itemID says its an error.
It is because you have
"Public static OBJECT" you are supposed to have
Public static Item
was this the first block that youve made? or have you made more? because i may have to really look into this and it may not be a minor mistake if more than one person is getting this error
Nah, I could put in my new item, even with the texture, and it was working, but now I put in the ore and, poof. I get a nullpointexception error, and it crashes
do either of you have twitter? because I could tweet you a lot easier, but again, is it crashing after you make the block or just in general? and did you get the recommended build for forge or the latest?
hmm well show me your new code that you added, like paste it here. Also make sure you but it in the right area, and follow me on twitter so we can have a convo about this XD ^-^ itll be easier
What's your twitter?
Lol it's @thesynasonic it's easier to use twitter cause I'm on my phone right now a d the forums are not mobile friendly XD
Was everything else working before this? Or did items not work either?
Can you show me your code you added and where you added it?
how should I go of this. do I post it on the forum or something?
well heres my code. its in its own tab thing (p.s.) I don't know how to do the hide things I also followed you on twitter
package
Syn;
import
java.util.Random;
import
cpw.mods.fml.common.Mod.
Init;import
cpw.mods.fml.common.event.FMLInitializationEvent;
import
cpw.mods.fml.common.registry.LanguageRegistry;
import
net.minecraft.block.Block;
import
net.minecraft.block.material.Material;
import
net.minecraft.client.renderer.texture.IconRegister;
import
net.minecraft.creativetab.CreativeTabs;
public
class refined_obsidian_bricks extends Block {
public
refined_obsidian_bricks(int par1, String texture) {
super
(par1, Material.rock);
setCreativeTab(CreativeTabs.
tabBlock); //place in creative tabs
}
//drops when broken with pickaxe
public
int idDropped(int par1, Random par2Random, int par3)
{
return
Morandomness.refined_obsidian_bricks.blockID;
}
public
int quantityDropped(Random random)
{
return
1;
}
public
void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
this
.blockIcon = reg.registerIcon("refined_obsidian_bricks"); // You can also replace blockID and blockIcon with itemID and itemIcon
}}
package
Syn;
import
java.util.Random;
import
cpw.mods.fml.common.Mod.
Init;import
cpw.mods.fml.common.event.FMLInitializationEvent;
import
cpw.mods.fml.common.registry.LanguageRegistry;
import
net.minecraft.block.Block;
import
net.minecraft.block.material.Material;
import
net.minecraft.client.renderer.texture.IconRegister;
import
net.minecraft.creativetab.CreativeTabs;
public
class refined_obsidian_bricks extends Block {
public
refined_obsidian_bricks(int par1, String texture) {
super
(par1, Material.rock);
setCreativeTab(CreativeTabs.
tabBlock); //place in creative tabs
}
//drops when broken with pickaxe
public
int idDropped(int par1, Random par2Random, int par3)
{
return
Morandomness.refined_obsidian_bricks.blockID;
}
public
int quantityDropped(Random random)
{
return
1;
}
public
void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
this
.blockIcon = reg.registerIcon("refined_obsidian_bricks"); // You can also replace blockID and blockIcon with itemID and itemIcon
}}
its this but moreorganised but soething happened and it spaced out
K here dude I can't read a thing of that, so when you are makin your post there should be a little button that looks kinda like this < > and it's called "code" I want you to copy your code as it is and paste it into that, it'll be a lot easier, thanks ^-^
Ok so I think what your problem is, is that it is just called "Syn;" as the package, it should be "Syn.Tutorial;" depending on what you named your other folder, check you "morandomness" class and see what it is called on the top, if it's called "Syn.Tutorial;" them that what this one should be to! So try that
SynItems
Tabamethyst
as far as i've seen nothing is different in this from the code used by others that the creative tab code I used was acquired from except for my custom tab being in the main class with the items coding in their classes, whereas the only tutorials i found the coding on had their items coded in their main class, can you notice anything I've done wrong so far? as i said on twitter the items work with them in other creative tabs such as the blocks tab but not in the custom tab i made of Amethyst
ok I cant really see a problem from that so if you could send me the code for your main class files to, ill take a look at it
The video on creative tabs will be out soon, i am editing the tools one right now and then about to record the creative tabs one creative tabs should be out by early Saturday latest
In the pickaxe one if (itemID == testMain.berilliumPickaxe.itemID) the last .itemID says its an error.
It is because you have
"Public static OBJECT" you are supposed to have
Public static Item