Remove the languageRegistry.addName then test the game, don't delete them just put // in front of them and test the game and post what happens
I believe language registry is needed though, isn't it? Its for adding the actual name of the Item into the game(pretty sure you already know that though :P)
I believe language registry is needed though, isn't it? Its for adding the actual name of the Item into the game(pretty sure you already know that though )
It's what makes it display the proper item name. But it's not needed for it to work
Just doing step 1A will help you a lot, I promise!
@Scoutdrago3:
The same to you mate, it would be really awesome if you learn this stuff really good because you seem to be a nice, friendly and helpful person! The community would benefit from having you hang around armed with some more knowledge
Just doing step 1A will help you a lot, I promise!
@Scoutdrago3:
The same to you mate, it would be really awesome if you learn this stuff really good because you seem to be a nice, friendly and helpful person! The community would benefit from having you hang around armed with some more knowledge
I understand that, but without it you're item will have no name :/
A item without a name is one less item with a name. Remember that.
Okay. There are several things that I see wrong. Hopefully this helps:
First of all:
@Instance("EssenceFromTheDepth")
public static EssenceFromTheDepth instance;
@Instance("BlocksOfTheDeep")
public static BlocksOfTheDeep instance1;
You don't want instances for your items/blocks. The instance is supposed to be for your main mod file:
@Instance("DeepModForge")
public static DeepModForge instance;
Another thing, in your BlocksOfTheDeep class, you have this:
//place in creative tabs
setCreativeTab(DeepModForge.BlocksOfTheDeep);
{
}
}
The opening and ending curly braces aren't needed, and will create errors because they follow a semicolon. Change it to:
//place in creative tabs
setCreativeTab(DeepModForge.BlocksOfTheDeep);
}
Another thing in you Main mod class:
/*
* Basic needed forge stuff
*/
@Mod(modid= DeepModForge.modid,name="TheDeepMod",version="v1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class DeepModForge
{
It is usually bad practice to have a 'v' in your version. I would recommend changing it to:
/*
* Basic needed forge stuff
*/
@Mod(modid= DeepModForge.modid,name="TheDeepMod",version="1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class DeepModForge
{
In your BlocksOfTheDeep class, you have this:
public int quantityDropped(Random random)
{
return DeepModForge.LonsdaleiteBlock.blockID;
}
The method quantityDropped returns how many of the selected item/block is dropped. You are returning the id of the block you created. This value is 521; it will drop a ton of items/blocks.
There could be more problems, but that is what I saw after a few quick glances.
Just doing step 1A will help you a lot, I promise!
@Scoutdrago3:
The same to you mate, it would be really awesome if you learn this stuff really good because you seem to be a nice, friendly and helpful person! The community would benefit from having you hang around armed with some more knowledge
The guide did help a little but it seems to be outdated
Okay. There are several things that I see wrong. Hopefully this helps:
First of all:
@Instance("EssenceFromTheDepth")
public static EssenceFromTheDepth instance;
@Instance("BlocksOfTheDeep")
public static BlocksOfTheDeep instance1;
You don't want instances for your items/blocks. The instance is supposed to be for your main mod file:
@Instance("DeepModForge")
public static DeepModForge instance;
Another thing, in your BlocksOfTheDeep class, you have this:
//place in creative tabs
setCreativeTab(DeepModForge.BlocksOfTheDeep);
{
}
}
The opening and ending curly braces aren't needed, and will create errors because they follow a semicolon. Change it to:
//place in creative tabs
setCreativeTab(DeepModForge.BlocksOfTheDeep);
}
Another thing in you Main mod class:
/*
* Basic needed forge stuff
*/
@Mod(modid= DeepModForge.modid,name="TheDeepMod",version="v1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class DeepModForge
{
It is usually bad practice to have a 'v' in your version. I would recommend changing it to:
/*
* Basic needed forge stuff
*/
@Mod(modid= DeepModForge.modid,name="TheDeepMod",version="1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class DeepModForge
{
In your BlocksOfTheDeep class, you have this:
public int quantityDropped(Random random)
{
return DeepModForge.LonsdaleiteBlock.blockID;
}
The method quantityDropped returns how many of the selected item/block is dropped. You are returning the id of the block you created. This value is 521; it will drop a ton of items/blocks.
There could be more problems, but that is what I saw after a few quick glances.
The blocks of the deep and essence thing is for the new creative tabs I created, I want my blocks to be in my own creative tab instead of blocks tab
The blocks of the deep and essence thing is for the new creative tabs I created, I want my blocks to be in my own creative tab instead of blocks tab
Yes, I realize that, but you also named the class that makes your block BlocksOfTheDeep and the class that makes your Item EssenceOfTheDepth.
You are most likely pretty new to modding, and maybe even programming, so I am going to give you some friendly advice because everyone has been at a point that they had problems.
You have made it really difficult for yourself and the community to help you.
There is more to code than functionality. Code is art, and you, as a programmer, are an artist. It is one thing to make code that works, but you want to strive for making code beautiful.
If you look at code from the original source, you will see that the developers have named things differently. There is a reason for this: it makes things more readable and easier to tell what everything is.
In your code, you have named your item and block classes the same thing you name your tabs in the main class.
//Creative Tab
public static CreativeTabs BlocksOfTheDeep = new TabBlocksOfTheDeep(CreativeTabs.getNextID(), "Blocks Of The Deep");
public static CreativeTabs EssenceFromTheDepth = new TabEssenceFromTheDepth(CreativeTabs.getNextID(), "Essence From The Depth");
public class BlocksOfTheDeep extends Block
{
public BlocksOfTheDeep(int par1, Material rock)
{
public class EssenceFromTheDepth extends Item {
public EssenceFromTheDepth(int par1) {
This is creating confusion. You call these classes from entirely different names.
// define blocks
LonsdaleiteBlock = new BlocksOfTheDeep(521,Material.rock).setUnlocalizedName("LonsdaleiteBlock").setHardness(70.0F).setStepSound(Block.soundMetalFootstep).setResistance(5000.0F);GameRegistry.registerBlock(LonsdaleiteBlock, "LonsdaleiteBlock");
//define items
Lonsdaleite = new EssenceFromTheDepth(3759).setUnlocalizedName("Lonsdaleite").func_111206_d("thedeepmod:Lonsdaleite");
You should have followed a similar naming convention as the developers of minecraft, changing BlocksOfTheDeep to BlockLonsdaleite, and changing EssenseOfTheDepth to ItemLonsdaleite. Then named the tabs in the main class, tabBlocksOfTheDeep and tabEssenseOfTheDepth. Also, named LonsdaleiteBlock, blockLonsdaleite, and Lonsdaleite, itemLonsdaleite.
Another note, you should also organize code into corresponding packages. For example, since BlockLonsdaleite is a block, it should be in a block package. Same goes for ItemLonsdaleite.
Updated Code with name changes and some code fixes:
Main:
package DeepModForge; //Package directory
/*
* Basic importing
*/
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
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 DeepModForge.blocks.BlockLonsdaleite;
import DeepModForge.items.ItemLonsdaleite;
import DeepModForge.tabs.TabBlocksOfTheDeep;
import DeepModForge.tabs.TabEssenseFromTheDepth;
/*
* Basic needed forge stuff
*/
@Mod(modid= DeepModForge.modid,name="TheDeepMod",version="1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class DeepModForge
{
public static final String modid="thedeepmod";
/*
* ToolMaterial
*/
//Telling forge that we are creating these
//items
public static Item itemLonsdaleite;
//blocks
public static Block blockLonsdaleite;
//Creative Tab
public static CreativeTabs tabBlocksOfTheDeep = new TabBlocksOfTheDeep(CreativeTabs.getNextID(), "Blocks Of The Deep");
public static CreativeTabs tabEssenceFromTheDepth = new TabEssenceFromTheDepth(CreativeTabs.getNextID(), "Essence From The Depth");
@Instance("DeepModForge")
public static DeepModForge instance;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
}
@EventHandler
public void load(FMLInitializationEvent event){
// define blocks
blockLonsdaleite = new BlockLonsdaleite(521,Material.rock).setUnlocalizedName("LonsdaleiteBlock").setHardness(70.0F).setStepSound(Block.soundMetalFootstep).setResistance(5000.0F);
GameRegistry.registerBlock(blockLonsdaleite, "LonsdaleiteBlock");
//define items
itemLonsdaleite = new itemLonsdaleite(3759).setUnlocalizedName("Lonsdaleite").func_111206_d("thedeepmod:Lonsdaleite");
GameRegistry.registerItem(itemLonsdaleite, "Lonsdaleite");
//BlockHarvestLevel
MinecraftForge.setBlockHarvestLevel(blockLonsdaleite, "pickaxe", 5);}
//adding names
@EventHandler
public void load1(FMLInitializationEvent event) {
LanguageRegistry.addName(itemLonsdaleite, "Lonsdaleite");
LanguageRegistry.addName(blockLonsdaleite, "Lonsdaleite Block");
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
}
}
BlockLonsdaleite:
package DeepModForge.blocks;
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;
import DeepModForge.DeepModForge;
public class BlockLonsdaleite extends Block
{
public BlockLonsdaleite(int par1, Material rock)
{
super(par1, Material.rock);
//place in creative tabs
setCreativeTab(DeepModForge.tabBlocksOfTheDeep);
}
//drops when broken with pickaxe
public int idDropped(int par1, Random random, int zero) {
return DeepModForge.blockLonsdaleite.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
public void registerIcons(IconRegister iconRegister)
{
blockIcon= iconRegister.registerIcon("thedeepmod:LonsdaleiteBlock");
}
}
ItemLonsdaleite:
package DeepModForge.items;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import DeepModForge.DeepModForge;
public class EssenceFromTheDepth extends Item {
public EssenceFromTheDepth(int par1) {
super(par1); //Returns super constructor: par1 is ID
setCreativeTab(DeepModForge.tabEssenceFromTheDepth);
}
public void registerIcons(IconRegister iconRegister)
{
itemIcon= iconRegister.registerIcon("thedeepmod:Lonsdaleite");
}
}
TabBlocksOfTheDeep:
package DeepModForge.tabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
public final class TabBlocksOfTheDeep extends CreativeTabs
{
public TabBlocksOfTheDeep(int par1, String par2Str)
{
super(par1, par2Str);
}
//sets the image for the creative tab
@SideOnly(Side.CLIENT)
public int getTabIconItemIndex()
{
//there is a difference between items and blocks. will give an example of both
return DeepModForge.blockLonsdaleite.blockID;
}
//sets the title/name for the creative tab
public String getTranslatedTabLabel()
{
return "Blocks Of The Deep";
}
}
TabEssenseFromTheDepth:
package DeepModForge.tabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import DeepModForge.DeepModForge;
public final class TabEssenceFromTheDepth extends CreativeTabs
{
public TabEssenceFromTheDepth(int par1, String par2Str)
{
super(par1, par2Str);
}
//sets the image for the creative tab
@SideOnly(Side.CLIENT)
public int getTabIconItemIndex()
{
//there is a difference between items and blocks. will give an example of both
return DeepModForge.itemLonsdaleite.itemID;
}
//sets the title/name for the creative tab
public String getTranslatedTabLabel()
{
return "Essence From The Depth";
}
}
The guide is a bit outdated, you could not possibly have completed the first part of the guide then..
Try doing step 1 completely, it's fully working and nothing with that step will ever get outdated :PActually after re-reading my "guide" there's nothing in it that can be considered "outdatet", unless you skip major parts of it. But then you don't follow the guide so
Okay. There are several things that I see wrong. Hopefully this helps:
First of all:
@Instance("EssenceFromTheDepth")
public static EssenceFromTheDepth instance;
@Instance("BlocksOfTheDeep")
public static BlocksOfTheDeep instance1;
You don't want instances for your items/blocks. The instance is supposed to be for your main mod file:
@Instance("DeepModForge")
public static DeepModForge instance;
Another thing, in your BlocksOfTheDeep class, you have this:
//place in creative tabs
setCreativeTab(DeepModForge.BlocksOfTheDeep);
{
}
}
The opening and ending curly braces aren't needed, and will create errors because they follow a semicolon. Change it to:
//place in creative tabs
setCreativeTab(DeepModForge.BlocksOfTheDeep);
}
Another thing in you Main mod class:
/*
* Basic needed forge stuff
*/
@Mod(modid= DeepModForge.modid,name="TheDeepMod",version="v1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class DeepModForge
{
It is usually bad practice to have a 'v' in your version. I would recommend changing it to:
/*
* Basic needed forge stuff
*/
@Mod(modid= DeepModForge.modid,name="TheDeepMod",version="1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class DeepModForge
{
In your BlocksOfTheDeep class, you have this:
public int quantityDropped(Random random)
{
return DeepModForge.LonsdaleiteBlock.blockID;
}
The method quantityDropped returns how many of the selected item/block is dropped. You are returning the id of the block you created. This value is 521; it will drop a ton of items/blocks.
There could be more problems, but that is what I saw after a few quick glances.
Also don't forget: He has a { before the Import Package declaration. And he never even opens any mod up. His mod will never work if he doesn't fix those.
Also don't forget: He has a { before the Import Package declaration. And he never even opens any mod up. His mod will never work if he doesn't fix those.
Actually surprised that this problem still hasn't been fixed.
You registered the items in the POST-init but you registered the name in the init. That's like naming the baby before someone's pregnant (if that even makes sense). So register the items in the PRE-init and register the names in the init.
Updated Code with name changes and some code fixes:
Main:
package DeepModForge; //Package directory
/*
* Basic importing
*/
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
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 DeepModForge.blocks.BlockLonsdaleite;
import DeepModForge.items.ItemLonsdaleite;
import DeepModForge.tabs.TabBlocksOfTheDeep;
import DeepModForge.tabs.TabEssenseFromTheDepth;
/*
* Basic needed forge stuff
*/
@Mod(modid= DeepModForge.modid,name="TheDeepMod",version="1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class DeepModForge
{
public static final String modid="thedeepmod";
/*
* ToolMaterial
*/
//Telling forge that we are creating these
//items
public static Item itemLonsdaleite;
//blocks
public static Block blockLonsdaleite;
//Creative Tab
public static CreativeTabs tabBlocksOfTheDeep = new TabBlocksOfTheDeep(CreativeTabs.getNextID(), "Blocks Of The Deep");
public static CreativeTabs tabEssenceFromTheDepth = new TabEssenceFromTheDepth(CreativeTabs.getNextID(), "Essence From The Depth");
@Instance("DeepModForge")
public static DeepModForge instance;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
}
@EventHandler
public void load(FMLInitializationEvent event){
// define blocks
blockLonsdaleite = new BlockLonsdaleite(521,Material.rock).setUnlocalizedName("LonsdaleiteBlock").setHardness(70.0F).setStepSound(Block.soundMetalFootstep).setResistance(5000.0F);
GameRegistry.registerBlock(blockLonsdaleite, "LonsdaleiteBlock");
//define items
itemLonsdaleite = new itemLonsdaleite(3759).setUnlocalizedName("Lonsdaleite").func_111206_d("thedeepmod:Lonsdaleite");
GameRegistry.registerItem(itemLonsdaleite, "Lonsdaleite");
//BlockHarvestLevel
MinecraftForge.setBlockHarvestLevel(blockLonsdaleite, "pickaxe", 5);}
//adding names
@EventHandler
public void load1(FMLInitializationEvent event) {
LanguageRegistry.addName(itemLonsdaleite, "Lonsdaleite");
LanguageRegistry.addName(blockLonsdaleite, "Lonsdaleite Block");
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
}
}
BlockLonsdaleite:
package DeepModForge.blocks;
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;
import DeepModForge.DeepModForge;
public class BlockLonsdaleite extends Block
{
public BlockLonsdaleite(int par1, Material rock)
{
super(par1, Material.rock);
//place in creative tabs
setCreativeTab(DeepModForge.tabBlocksOfTheDeep);
}
//drops when broken with pickaxe
public int idDropped(int par1, Random random, int zero) {
return DeepModForge.blockLonsdaleite.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
public void registerIcons(IconRegister iconRegister)
{
blockIcon= iconRegister.registerIcon("thedeepmod:LonsdaleiteBlock");
}
}
ItemLonsdaleite:
package DeepModForge.items;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import DeepModForge.DeepModForge;
public class EssenceFromTheDepth extends Item {
public EssenceFromTheDepth(int par1) {
super(par1); //Returns super constructor: par1 is ID
setCreativeTab(DeepModForge.tabEssenceFromTheDepth);
}
public void registerIcons(IconRegister iconRegister)
{
itemIcon= iconRegister.registerIcon("thedeepmod:Lonsdaleite");
}
}
TabBlocksOfTheDeep:
package DeepModForge.tabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
public final class TabBlocksOfTheDeep extends CreativeTabs
{
public TabBlocksOfTheDeep(int par1, String par2Str)
{
super(par1, par2Str);
}
//sets the image for the creative tab
@SideOnly(Side.CLIENT)
public int getTabIconItemIndex()
{
//there is a difference between items and blocks. will give an example of both
return DeepModForge.blockLonsdaleite.blockID;
}
//sets the title/name for the creative tab
public String getTranslatedTabLabel()
{
return "Blocks Of The Deep";
}
}
TabEssenseFromTheDepth:
package DeepModForge.tabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import DeepModForge.DeepModForge;
public final class TabEssenceFromTheDepth extends CreativeTabs
{
public TabEssenceFromTheDepth(int par1, String par2Str)
{
super(par1, par2Str);
}
//sets the image for the creative tab
@SideOnly(Side.CLIENT)
public int getTabIconItemIndex()
{
//there is a difference between items and blocks. will give an example of both
return DeepModForge.itemLonsdaleite.itemID;
}
//sets the title/name for the creative tab
public String getTranslatedTabLabel()
{
return "Essence From The Depth";
}
}
I noticed that, too, and it was included in my rewrite post. The OP must not be too concerned about the issue because I basically rewrote the code a couple days ago, and he hasn't responded.
Personally, I like to define and initialize my items/blocks variables outside of any methods publicly, then do all of the registering in the init/load (depending on preference) class. It makes it look more like Block.java or Item.java, but people are entitled to their style.
Yes, I realize that, but you also named the class that makes your block BlocksOfTheDeep and the class that makes your Item EssenceOfTheDepth.
You are most likely pretty new to modding, and maybe even programming, so I am going to give you some friendly advice because everyone has been at a point that they had problems.
You have made it really difficult for yourself and the community to help you.
There is more to code than functionality. Code is art, and you, as a programmer, are an artist. It is one thing to make code that works, but you want to strive for making code beautiful.
If you look at code from the original source, you will see that the developers have named things differently. There is a reason for this: it makes things more readable and easier to tell what everything is.
In your code, you have named your item and block classes the same thing you name your tabs in the main class.
//Creative Tab
public static CreativeTabs BlocksOfTheDeep = new TabBlocksOfTheDeep(CreativeTabs.getNextID(), "Blocks Of The Deep");
public static CreativeTabs EssenceFromTheDepth = new TabEssenceFromTheDepth(CreativeTabs.getNextID(), "Essence From The Depth");
public class BlocksOfTheDeep extends Block
{
public BlocksOfTheDeep(int par1, Material rock)
{
public class EssenceFromTheDepth extends Item {
public EssenceFromTheDepth(int par1) {
This is creating confusion. You call these classes from entirely different names.
// define blocks
LonsdaleiteBlock = new BlocksOfTheDeep(521,Material.rock).setUnlocalizedName("LonsdaleiteBlock").setHardness(70.0F).setStepSound(Block.soundMetalFootstep).setResistance(5000.0F);GameRegistry.registerBlock(LonsdaleiteBlock, "LonsdaleiteBlock");
//define items
Lonsdaleite = new EssenceFromTheDepth(3759).setUnlocalizedName("Lonsdaleite").func_111206_d("thedeepmod:Lonsdaleite");
You should have followed a similar naming convention as the developers of minecraft, changing BlocksOfTheDeep to BlockLonsdaleite, and changing EssenseOfTheDepth to ItemLonsdaleite. Then named the tabs in the main class, tabBlocksOfTheDeep and tabEssenseOfTheDepth. Also, named LonsdaleiteBlock, blockLonsdaleite, and Lonsdaleite, itemLonsdaleite.
Another note, you should also organize code into corresponding packages. For example, since BlockLonsdaleite is a block, it should be in a block package. Same goes for ItemLonsdaleite.
Updated Code with name changes and some code fixes:
Main:
package DeepModForge; //Package directory
/*
* Basic importing
*/
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
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 DeepModForge.blocks.BlockLonsdaleite;
import DeepModForge.items.ItemLonsdaleite;
import DeepModForge.tabs.TabBlocksOfTheDeep;
import DeepModForge.tabs.TabEssenseFromTheDepth;
/*
* Basic needed forge stuff
*/
@Mod(modid= DeepModForge.modid,name="TheDeepMod",version="1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class DeepModForge
{
public static final String modid="thedeepmod";
/*
* ToolMaterial
*/
//Telling forge that we are creating these
//items
public static Item itemLonsdaleite;
//blocks
public static Block blockLonsdaleite;
//Creative Tab
public static CreativeTabs tabBlocksOfTheDeep = new TabBlocksOfTheDeep(CreativeTabs.getNextID(), "Blocks Of The Deep");
public static CreativeTabs tabEssenceFromTheDepth = new TabEssenceFromTheDepth(CreativeTabs.getNextID(), "Essence From The Depth");
@Instance("DeepModForge")
public static DeepModForge instance;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
}
@EventHandler
public void load(FMLInitializationEvent event){
// define blocks
blockLonsdaleite = new BlockLonsdaleite(521,Material.rock).setUnlocalizedName("LonsdaleiteBlock").setHardness(70.0F).setStepSound(Block.soundMetalFootstep).setResistance(5000.0F);
GameRegistry.registerBlock(blockLonsdaleite, "LonsdaleiteBlock");
//define items
itemLonsdaleite = new itemLonsdaleite(3759).setUnlocalizedName("Lonsdaleite").func_111206_d("thedeepmod:Lonsdaleite");
GameRegistry.registerItem(itemLonsdaleite, "Lonsdaleite");
//BlockHarvestLevel
MinecraftForge.setBlockHarvestLevel(blockLonsdaleite, "pickaxe", 5);}
//adding names
@EventHandler
public void load1(FMLInitializationEvent event) {
LanguageRegistry.addName(itemLonsdaleite, "Lonsdaleite");
LanguageRegistry.addName(blockLonsdaleite, "Lonsdaleite Block");
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
}
}
BlockLonsdaleite:
package DeepModForge.blocks;
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;
import DeepModForge.DeepModForge;
public class BlockLonsdaleite extends Block
{
public BlockLonsdaleite(int par1, Material rock)
{
super(par1, Material.rock);
//place in creative tabs
setCreativeTab(DeepModForge.tabBlocksOfTheDeep);
}
//drops when broken with pickaxe
public int idDropped(int par1, Random random, int zero) {
return DeepModForge.blockLonsdaleite.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
public void registerIcons(IconRegister iconRegister)
{
blockIcon= iconRegister.registerIcon("thedeepmod:LonsdaleiteBlock");
}
}
ItemLonsdaleite:
package DeepModForge.items;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import DeepModForge.DeepModForge;
public class EssenceFromTheDepth extends Item {
public EssenceFromTheDepth(int par1) {
super(par1); //Returns super constructor: par1 is ID
setCreativeTab(DeepModForge.tabEssenceFromTheDepth);
}
public void registerIcons(IconRegister iconRegister)
{
itemIcon= iconRegister.registerIcon("thedeepmod:Lonsdaleite");
}
}
TabBlocksOfTheDeep:
package DeepModForge.tabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
public final class TabBlocksOfTheDeep extends CreativeTabs
{
public TabBlocksOfTheDeep(int par1, String par2Str)
{
super(par1, par2Str);
}
//sets the image for the creative tab
@SideOnly(Side.CLIENT)
public int getTabIconItemIndex()
{
//there is a difference between items and blocks. will give an example of both
return DeepModForge.blockLonsdaleite.blockID;
}
//sets the title/name for the creative tab
public String getTranslatedTabLabel()
{
return "Blocks Of The Deep";
}
}
TabEssenseFromTheDepth:
package DeepModForge.tabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import DeepModForge.DeepModForge;
public final class TabEssenceFromTheDepth extends CreativeTabs
{
public TabEssenceFromTheDepth(int par1, String par2Str)
{
super(par1, par2Str);
}
//sets the image for the creative tab
@SideOnly(Side.CLIENT)
public int getTabIconItemIndex()
{
//there is a difference between items and blocks. will give an example of both
return DeepModForge.itemLonsdaleite.itemID;
}
//sets the title/name for the creative tab
public String getTranslatedTabLabel()
{
return "Essence From The Depth";
}
}
THX gonna to try it later
If anyone of u think that there is something that is needed to change please send it to me in my minecraft forum inbox or reply to this topic by editing my code to the right ones in page 1 thx
THX gonna to try it later
If anyone of u think that there is something that is needed to change please send it to me in my minecraft forum inbox or reply to this topic by editing my code to the right ones in page 1 thx
We can't edit your code on your posts unless if we already have posts on the first page.
By the way, if you follow this forum, it will email you when someone posts something.
We can't edit your code on your posts unless if we already have posts on the first page.
By the way, if you follow this forum, it will email you when someone posts something.
Here it is
Mod Main:
package DeepModForge; //Package directory
/*
* Basic importing
*/
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
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;
/*
* Basic needed forge stuff
*/
@Mod(modid= DeepModForge.modid,name="TheDeepMod",version="v1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class DeepModForge
{
public static final String modid="thedeepmod";
/*
* ToolMaterial
*/
//Telling forge that we are creating these
//items
public static Item Lonsdaleite;
//blocks
public static Block LonsdaleiteBlock;
//Creative Tab
public static CreativeTabs BlocksOfTheDeep = new TabBlocksOfTheDeep(CreativeTabs.getNextID(), "Blocks Of The Deep");
public static CreativeTabs EssenceFromTheDepth = new TabEssenceFromTheDepth(CreativeTabs.getNextID(), "Essence From The Depth");
//Declaring Init
@Instance("EssenceFromTheDepth")
public static EssenceFromTheDepth instance;
@Instance("BlocksOfTheDeep")
public static BlocksOfTheDeep instance1;
@EventHandler
public void load(FMLInitializationEvent event){}
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
// define blocks
LonsdaleiteBlock = new BlocksOfTheDeep(521,Material.rock).setUnlocalizedName("LonsdaleiteBlock").setHardness(70.0F).setStepSound(Block.soundMetalFootstep).setResistance(5000.0F);GameRegistry.registerBlock(LonsdaleiteBlock, "LonsdaleiteBlock");
;
//define items
Lonsdaleite = new EssenceFromTheDepth(3759).setUnlocalizedName("Lonsdaleite").func_111206_d("thedeepmod:Lonsdaleite");
//BlockHarvestLevel
MinecraftForge.setBlockHarvestLevel(LonsdaleiteBlock, "pickaxe", 5);}
//adding names
@EventHandler
public void load1(FMLInitializationEvent event) {
LanguageRegistry.addName(Lonsdaleite, "Lonsdaleite");
LanguageRegistry.addName(LonsdaleiteBlock, "Lonsdaleite Block");
}
// TODO Auto-generated method stub
// TODO Auto-generated method stub
{
}
}
Blocks:
package DeepModForge;
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 BlocksOfTheDeep extends Block
{
public BlocksOfTheDeep(int par1, Material rock)
{
super(par1, Material.rock);
//place in creative tabs
setCreativeTab(DeepModForge.BlocksOfTheDeep);
{
}
}
// TODO Auto-generated constructor stub
//drops when broken with pickaxe
public int idDropped(int par1, Random random, int zero) {
return DeepModForge.LonsdaleiteBlock.blockID;
}
public int quantityDropped(Random random)
{
return DeepModForge.LonsdaleiteBlock.blockID;
}
public void registerIcons(IconRegister iconRegister)
{
blockIcon= iconRegister.registerIcon("thedeepmod:LonsdaleiteBlock");
}
}
Items:
package DeepModForge;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
public class EssenceFromTheDepth extends Item {
public EssenceFromTheDepth(int par1) {
super(par1); //Returns super constructor: par1 is ID
setCreativeTab(DeepModForge.EssenceFromTheDepth);
}
public void registerIcons(IconRegister iconRegister)
{
itemIcon= iconRegister.registerIcon("thedeepmod:Lonsdaleite");
}
}
Creative Tab 1:
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
public final class TabEssenceFromTheDepth extends CreativeTabs
{
public TabEssenceFromTheDepth(int par1, String par2Str)
{
super(par1, par2Str);
}
//sets the image for the creative tab
@SideOnly(Side.CLIENT)
public int getTabIconItemIndex()
{
//there is a difference between items and blocks. will give an example of both
return DeepModForge.Lonsdaleite.itemID;
}
//sets the title/name for the creative tab
public String getTranslatedTabLabel()
{
return "Essence From The Depth";
}
}
Creative Tab 2:
package DeepModForge;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
public final class TabBlocksOfTheDeep extends CreativeTabs
{
public TabBlocksOfTheDeep(int par1, String par2Str)
{
super(par1, par2Str);
}
//sets the image for the creative tab
@SideOnly(Side.CLIENT)
public int getTabIconItemIndex()
{
//there is a difference between items and blocks. will give an example of both
return DeepModForge.LonsdaleiteBlock.blockID;
}
//sets the title/name for the creative tab
public String getTranslatedTabLabel()
{
return "Blocks Of The Deep";
}
}
Code is applicable
so feel free to test it in eclipse instead of just looking at the code(if u want to that is)
I believe language registry is needed though, isn't it? Its for adding the actual name of the Item into the game(pretty sure you already know that though :P)
It's what makes it display the proper item name. But it's not needed for it to work
@Deathhollo:
I don't want to sound rude mate, but you would save your self a lot of time and frustration by following this "guide":
www.minecraftforum.net/topic/1892328-need-a-highly-detailed-152-guide/
Just doing step 1A will help you a lot, I promise!
@Scoutdrago3:
The same to you mate, it would be really awesome if you learn this stuff really good because you seem to be a nice, friendly and helpful person! The community would benefit from having you hang around armed with some more knowledge
I understand that, but without it you're item will have no name :/
A item without a name is one less item with a name. Remember that.
Oh and by the way, to you're comment about me:
Sorry if this is all a bit off topic :/
First of all:
You don't want instances for your items/blocks. The instance is supposed to be for your main mod file:
Another thing, in your BlocksOfTheDeep class, you have this:
The opening and ending curly braces aren't needed, and will create errors because they follow a semicolon. Change it to:
Another thing in you Main mod class:
It is usually bad practice to have a 'v' in your version. I would recommend changing it to:
In your BlocksOfTheDeep class, you have this:
The method quantityDropped returns how many of the selected item/block is dropped. You are returning the id of the block you created. This value is 521; it will drop a ton of items/blocks.
There could be more problems, but that is what I saw after a few quick glances.
The guide did help a little but it seems to be outdated
The blocks of the deep and essence thing is for the new creative tabs I created, I want my blocks to be in my own creative tab instead of blocks tab
Yes, I realize that, but you also named the class that makes your block BlocksOfTheDeep and the class that makes your Item EssenceOfTheDepth.
You are most likely pretty new to modding, and maybe even programming, so I am going to give you some friendly advice because everyone has been at a point that they had problems.
You have made it really difficult for yourself and the community to help you.
There is more to code than functionality. Code is art, and you, as a programmer, are an artist. It is one thing to make code that works, but you want to strive for making code beautiful.
If you look at code from the original source, you will see that the developers have named things differently. There is a reason for this: it makes things more readable and easier to tell what everything is.
In your code, you have named your item and block classes the same thing you name your tabs in the main class.
This is creating confusion. You call these classes from entirely different names.
You should have followed a similar naming convention as the developers of minecraft, changing BlocksOfTheDeep to BlockLonsdaleite, and changing EssenseOfTheDepth to ItemLonsdaleite. Then named the tabs in the main class, tabBlocksOfTheDeep and tabEssenseOfTheDepth. Also, named LonsdaleiteBlock, blockLonsdaleite, and Lonsdaleite, itemLonsdaleite.
Another note, you should also organize code into corresponding packages. For example, since BlockLonsdaleite is a block, it should be in a block package. Same goes for ItemLonsdaleite.
Updated Code with name changes and some code fixes:
Main:
BlockLonsdaleite:
ItemLonsdaleite:
TabBlocksOfTheDeep:
TabEssenseFromTheDepth:
Try doing step 1 completely, it's fully working and nothing with that step will ever get outdated :PActually after re-reading my "guide" there's nothing in it that can be considered "outdatet", unless you skip major parts of it. But then you don't follow the guide so
Also don't forget: He has a { before the Import Package declaration. And he never even opens any mod up. His mod will never work if he doesn't fix those.
Good note. I didn't notice that.
I noticed that, too, and it was included in my rewrite post. The OP must not be too concerned about the issue because I basically rewrote the code a couple days ago, and he hasn't responded.
Personally, I like to define and initialize my items/blocks variables outside of any methods publicly, then do all of the registering in the init/load (depending on preference) class. It makes it look more like Block.java or Item.java, but people are entitled to their style.
THX gonna to try it later
If anyone of u think that there is something that is needed to change please send it to me in my minecraft forum inbox or reply to this topic by editing my code to the right ones in page 1 thx
We can't edit your code on your posts unless if we already have posts on the first page.
By the way, if you follow this forum, it will email you when someone posts something.
Here it is
Mod Main:
Blocks:
Items:
Creative Tab 1:
Creative Tab 2:
Code is applicable
so feel free to test it in eclipse instead of just looking at the code(if u want to that is)