1

PLEASE HELP ME

JimboPanda123's Avatar JimboPanda1233/19/15 7:13 am
3/21/2015 1:17 am
guestds's Avatar guestds
Hi,
I was making a mod using eclipse. I added my first item but i cannot add another item. I was following the same code as the first item i made (a gem) but the code will not work for another item, even though it is the same. Is this a glitch or does each item have a different code or something?

Hope you can help
Posted by JimboPanda123's Avatar
JimboPanda123
Level 41 : Master Enderdragon
21

Create an account or sign in to comment.

13

1
03/21/2015 1:17 am
Level 19 : Journeyman Modder
guestds
guestds's Avatar
iv edited it to make sure nobody makes a mod like mine btw
1
03/21/2015 1:16 am
Level 19 : Journeyman Modder
guestds
guestds's Avatar
i use eclipse too heres my item code try it maybe it might work if not go to youth digital and ask them:

package mymod;

import mymod.blocks.MyBlock;
import mymod.blocks.MyBlockGen;
import mymod.items.MyFood;
import mymod.items.MyItem;
import mymod.items.MyPickaxe;
import mymod.items.MySword;
import mymod.proxies.CommonProxy;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.EnumHelper;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
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.creativetab.CreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.common.MinecraftForge;


/* MOD INFO */
@Mod( modid = "mymod", name = "First Mod", version = "0.0.0.1")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)


public class Main {

/* PROXY INFO */
@SidedProxy(clientSide = "mymod.proxies.ClientProxy", serverSide = "mymod.proxies.CommonProxy")
public static CommonProxy proxy;


/**
* DECLARATION SECTION
* *********************************************************** */

// DECLARE THE ITEM
public static Item MyItem_1;


/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */


@EventHandler
public void preInit( FMLPreInitializationEvent event )
{
/**
* LOAD SECTION
* *********************************************************** */

// LOAD THE ITEM
MyItem_1 = new MyItem(2030, "MyItem_1").setCreativeTab(CreativeTabs.tabMaterials).setMaxStackSize(64);
GameRegistry.registerItem(MyItem_1, "MyItem_1");
LanguageRegistry.addName(MyItem_1, "Cheese");



/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */

}

@EventHandler
public static void init( FMLInitializationEvent event )
{

/**
* RECIPES SECTION
* *********************************************************** */

// ITEM RECIPE
GameRegistry.addRecipe(new ItemStack(MyItem_1, 16), new Object[]
{
"FFF",
"FSF",
"FFF",
'F', Block.obsidian,
'S', Block.blockDiamond
});


/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */


/**
* EXTRA METHODS SECTION
* *********************************************************** */

// REGISTER THE ORE GENERATION
GameRegistry.registerWorldGenerator(new MyBlockGen());



/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */


}

@EventHandler
public static void postInit( FMLPostInitializationEvent event )
{

}

}
1
03/20/2015 3:31 pm
Level 41 : Master Enderdragon
JimboPanda123
JimboPanda123's Avatar
Hi,
I am making an item called cheese but the texture does not load onto the item.
Here is the code that shows the texture of the cheese being set but nothing happens

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
//Item/Block init and registering
//Config handling
itemCheese = new ItemFood(8, 0.5F, false).setUnlocalizedName("itemcheese").setTextureName("cm:itemCheese");
itemGrilledCheese = new ItemFood(16, 1.0F, true).setUnlocalizedName("itemgrilledcheese");
1
03/20/2015 9:34 am
Level 41 : Master Enderdragon
JimboPanda123
JimboPanda123's Avatar
PLEASE CAN SOMEONE HELP ME?
1
03/20/2015 7:15 am
Level 41 : Master Enderdragon
JimboPanda123
JimboPanda123's Avatar
If you know coding,
please reply
1
03/20/2015 3:35 am
Level 41 : Master Enderdragon
JimboPanda123
JimboPanda123's Avatar
Thanks so much minecraft still fails to run.
I think it this the bottom half of the code causing trouble
(starts when yours ends)

GameRegistry.registerItem(itemTable, itemTable.getUnlocalizedName().substring(5));
GameRegistry.registerItem(itemGem, itemGem.getUnlocalizedName().substring(5));

@EventHandler
public void Init(FMLInitializationEvent event)


//Proxy, TIleENtity, entity, GUI and Packet Registering



@EventHandler
public void postInit(FMLPostInitializationEvent event) {
1
03/19/2015 5:24 pm
Level 89 : Elite Senpai
sekwah41
sekwah41's Avatar
Try that, you sorta messed up the brackets by putting an unneeded one half way through the preInit event


@EventHandler
public void preInit(FMLPreInitializationEvent event) {
//Item/Block init and registering
//Config handling
itemTable = new ItemTable().setUnlocalizedName("ItemTable").setTextureName("bsm:itemTable");
itemGem = new ItemGem().setUnlocalizedName("ItemGem").setTextureName("bsm:itemGem");

GameRegistry.registerItem(itemTable, itemTable.getUnlocalizedName().substring(5));
GameRegistry.registerItem(itemGem, itemGem.getUnlocalizedName().substring(5));
}
1
03/19/2015 4:46 pm
Level 41 : Master Enderdragon
JimboPanda123
JimboPanda123's Avatar
if anyone knows, please reply
1
03/19/2015 4:05 pm
Level 41 : Master Enderdragon
JimboPanda123
JimboPanda123's Avatar
Can you tell me what is wrong with this?

package Jimbopanda12.BlockSwordsMod;

import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.world.biome.BiomeCache.Block;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
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.registry.GameRegistry;

@Mod(modid = "bsm", name = "Block Swords Mod", version = "1.0")
public class BlockSwordsMod {

public static Item itemTable;
public static Item itemGem;


@EventHandler
public void preInit(FMLPreInitializationEvent event) {
//Item/Block init and registering
//Config handling
itemTable = new ItemTable().setUnlocalizedName("ItemTable").setTextureName("bsm:itemTable");
itemGem = new ItemGem().setUnlocalizedName("ItemGem").setTextureName("bsm:itemGem");
}


GameRegistry.registerItem(itemTable, itemTable.getUnlocalizedName().substring(5));
GameRegistry.registerItem(itemGem, itemGem.getUnlocalizedName().substring(5));
}

@EventHandler
public void init(FMLInitializationEvent event) {
//Proxy, TIleENtity, entity, GUI and Packet Registering

}

@EventHandler
public void postInit(FMLPostInitializationEvent event) {

}
}
1
03/19/2015 3:54 pm
Level 41 : Master Enderdragon
JimboPanda123
JimboPanda123's Avatar
I use the same code for the other item but when i type .set, nothing comes up as a suggestion to put in (like UnlocalizedName)

Also, how do you add more than one item and when i make a crafting recipe, it does not work.

@EventHandler
public void init(FMLInitializationEvent event) {
//Proxy, TIleENtity, entity, GUI and Packet Registering
GameRegistry.addRecipe(new ItemStack(Items.apple),
"XXX",
"XXX",
"XXX",
'X', Blocks.leaves

Finaly, when i try to add a new item, the text automatically appears blue so i cannot open a new text document so i cannot wirte the code for the item proberly
public static Item itemGem;

Any ideas?
1
03/19/2015 3:41 pm
Level 89 : Elite Senpai
sekwah41
sekwah41's Avatar
whats the code for the second item? I only see 1
1
03/19/2015 1:16 pm
Level 41 : Master Enderdragon
JimboPanda123
JimboPanda123's Avatar
This is my code:

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
//Item/Block init and registering
//Config handling
itemTable = new ItemTable().setUnlocalizedName("ItemTable").setTextureName("bsm:itemTable");
GameRegistry.registerItem(itemTable, itemTable.getUnlocalizedName().substring(5));
1
03/19/2015 7:25 am
Level 89 : Elite Senpai
sekwah41
sekwah41's Avatar
Can you show your code?
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome