I'm developing for the first time a config file for my mod, and I thought I had it right, until all my items would not appear except for the hoe.
Here is my Mod File:
package palaster97.mods.slimecommunity;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import cpw.mods.fml.common.Mod;
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.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.Property;
@Mod(modid="SlimeCommunity", name="Slime Community", version="0.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class SlimeCommunity {
@Instance("SlimeCommunity")
public static SlimeCommunity instance;
@SidedProxy(clientSide="palaster97.mods.slimecommunity.client.ClientProxy", serverSide="palaster97.mods.slimecommunity.generic.CommonProxy")
public static CommonProxy proxy;
// Mob Spawn Egg ID
public static int idShopSlime;
// Item IDs for Config
public static int axeSlimeID;
public static int pickaxeSlimeID;
public static int swordSlimeID;
public static int shovelSlimeID;
public static int hoeSlimeID;
// Tool and Armor Material
public static EnumToolMaterial toolSlime = EnumHelper.addToolMaterial("SLIME", 1, 195, 5.0f, 2, 12);
// Tool ID "Can change in Config"
public static Item axeSlime = (new ItemSlimeAxe(axeSlimeID, toolSlime)).setUnlocalizedName("hatchetSlime");
public static Item pickaxeSlime = (new ItemSlimePickaxe(pickaxeSlimeID, toolSlime)).setUnlocalizedName("pickaxeSlime");
public static Item swordSlime = (new ItemSlimeSword(swordSlimeID, toolSlime)).setUnlocalizedName("swordSlime");
public static Item shovelSlime = (new ItemSlimeSpade(shovelSlimeID, toolSlime)).setUnlocalizedName("shovelSlime");
public static Item hoeSlime = (new ItemSlimeHoe(hoeSlimeID, toolSlime)).setUnlocalizedName("hoeSlime");
// Armor ID "Can change in Config"
@PreInit
public void preInit(FMLPreInitializationEvent event){
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
axeSlimeID = config.getItem(Configuration.CATEGORY_ITEM, "Slime Axe", 6000).getInt();
pickaxeSlimeID = config.getItem(Configuration.CATEGORY_ITEM ,"Slime Pickaxe", 6001).getInt();
swordSlimeID = config.getItem(Configuration.CATEGORY_ITEM, "Slime Sword", 6002).getInt();
shovelSlimeID = config.getItem(Configuration.CATEGORY_ITEM, "Slime Shovel", 6003).getInt();
hoeSlimeID = config.getItem(Configuration.CATEGORY_ITEM, "Slime Hoe", 6004).getInt();
idShopSlime = config.getItem(Configuration.CATEGORY_ITEM, "Shop Slime Item Spawn", 6005).getInt();
if(config.hasChanged()){
config.save();
}
}
@Init
public void load(FMLInitializationEvent event){
proxy.registerRenderers();
// Shop Slime Registry
EntityList.IDtoClassMapping.put(idShopSlime, EntityShopSlime.class);
EntityList.entityEggs.put(idShopSlime, new EntityEggInfo(idShopSlime, 0x00ff00, 0x00fcfc));
EntityRegistry.registerModEntity(EntityShopSlime.class, "ShopSlime", idShopSlime, this, 80, 3, true);
LanguageRegistry.instance().addStringLocalization("entity.SlimeCommunity.ShopSlime.name", "Shop Slime");
// Slime Axe
GameRegistry.addRecipe(new ItemStack(axeSlime), " xx", " yx", " y ", 'x' , Item.slimeBall , 'y', Item.stick);
GameRegistry.addRecipe(new ItemStack(axeSlime), "xx ", "xy ", " y ", 'x' , Item.slimeBall , 'y', Item.stick);
LanguageRegistry.addName(axeSlime, "Slime Axe");
// Slime Pick
GameRegistry.addRecipe(new ItemStack(pickaxeSlime), "xxx", " y ", " y ", 'x' , Item.slimeBall , 'y', Item.stick);
LanguageRegistry.addName(pickaxeSlime, "Slime Pickaxe");
// Slime Hoe
GameRegistry.addRecipe(new ItemStack(axeSlime), " xx", " y ", " y ", 'x' , Item.slimeBall , 'y', Item.stick);
GameRegistry.addRecipe(new ItemStack(axeSlime), "xx ", " y ", " y ", 'x' , Item.slimeBall , 'y', Item.stick);
LanguageRegistry.addName(hoeSlime, "Slime Hoe");
// Slime Sword
GameRegistry.addRecipe(new ItemStack(swordSlime), " x ", " x ", " y ", 'x' , Item.slimeBall , 'y', Item.stick);
LanguageRegistry.addName(swordSlime, "Slime Sword");
// Slime Shovel
GameRegistry.addRecipe(new ItemStack(shovelSlime), " x ", " y ", " y ", 'x' , Item.slimeBall , 'y', Item.stick);
LanguageRegistry.addName(shovelSlime, "Slime Shovel");
}
@PostInit
public void postInit(FMLPostInitializationEvent event){
// Stub Method
}
}
Also when I run minecraft from eclipse, I get this weird errors about my Items:
2013-05-22 18:31:03 [INFO] [STDOUT] CONFLICT @ 0 item slot already occupied by net.minecraft.item.ItemSpade@7bb9d080 while adding palaster97.mods.slimecommunity.ItemSlimeAxe@6427c2f5
2013-05-22 18:31:03 [INFO] [fml.ItemTracker] The mod SlimeCommunity is overwriting existing item at 256 (net.minecraft.item.ItemSpade from Minecraft) with palaster97.mods.slimecommunity.ItemSlimeAxe
2013-05-22 18:31:03 [INFO] [STDOUT] CONFLICT @ 0 item slot already occupied by palaster97.mods.slimecommunity.ItemSlimeAxe@6427c2f5 while adding palaster97.mods.slimecommunity.ItemSlimePickaxe@62cf29cb
2013-05-22 18:31:03 [INFO] [fml.ItemTracker] The mod SlimeCommunity is overwriting existing item at 256 (palaster97.mods.slimecommunity.ItemSlimeAxe from SlimeCommunity) with palaster97.mods.slimecommunity.ItemSlimePickaxe
2013-05-22 18:31:03 [INFO] [STDOUT] CONFLICT @ 0 item slot already occupied by palaster97.mods.slimecommunity.ItemSlimePickaxe@62cf29cb while adding palaster97.mods.slimecommunity.ItemSlimeSword@6492c540
2013-05-22 18:31:03 [INFO] [fml.ItemTracker] The mod SlimeCommunity is overwriting existing item at 256 (palaster97.mods.slimecommunity.ItemSlimePickaxe from SlimeCommunity) with palaster97.mods.slimecommunity.ItemSlimeSword
2013-05-22 18:31:03 [INFO] [STDOUT] CONFLICT @ 0 item slot already occupied by palaster97.mods.slimecommunity.ItemSlimeSword@6492c540 while adding palaster97.mods.slimecommunity.ItemSlimeSpade@745df3a9
2013-05-22 18:31:03 [INFO] [fml.ItemTracker] The mod SlimeCommunity is overwriting existing item at 256 (palaster97.mods.slimecommunity.ItemSlimeSword from SlimeCommunity) with palaster97.mods.slimecommunity.ItemSlimeSpade
2013-05-22 18:31:03 [INFO] [STDOUT] CONFLICT @ 0 item slot already occupied by palaster97.mods.slimecommunity.ItemSlimeSpade@745df3a9 while adding palaster97.mods.slimecommunity.ItemSlimeHoe@63ba710
2013-05-22 18:31:03 [INFO] [fml.ItemTracker] The mod SlimeCommunity is overwriting existing item at 256 (palaster97.mods.slimecommunity.ItemSlimeSpade from SlimeCommunity) with palaster97.mods.slimecommunity.ItemSlimeHoe
public static Item axeSlime = (new ItemSlimeAxe(axeSlimeID, toolSlime)).setUnlocalizedName("hatchetSlime");
public static Item pickaxeSlime = (new ItemSlimePickaxe(pickaxeSlimeID, toolSlime)).setUnlocalizedName("pickaxeSlime");
public static Item swordSlime = (new ItemSlimeSword(swordSlimeID, toolSlime)).setUnlocalizedName("swordSlime");
public static Item shovelSlime = (new ItemSlimeSpade(shovelSlimeID, toolSlime)).setUnlocalizedName("shovelSlime");
public static Item hoeSlime = (new ItemSlimeHoe(hoeSlimeID, toolSlime)).setUnlocalizedName("hoeSlime");
These static fields are initialized before the preInit method can be executed. Since those ID fields aren't yet defined, they are all zero.
To fix, you shouldn't actually initialize them until you after define the IDs.
public static Item axeSlime;
public static Item pickaxeSlime;
public static Item swordSlime;
public static Item shovelSlime;
public static Item hoeSlime;
Thank you, it is working fine, but I got a question the default ID I put for the items 6000-6005. However, if I'm in game and look at the item ids they are 31995-31999, and the spawn egg being 383/8005, why does it do this?
Thank you, it is working fine, but I got a question the default ID I put for the items 6000-6005. However, if I'm in game and look at the item ids they are 31995-31999, and the spawn egg being 383/8005, why does it do this?
I had the same problem not too long ago. All I did was change to bigger numbers. Remember that the minecraft engine automatically offsets item IDs by 256. Also if you wanna save on typing, you can get rid of Configuration.CATAGORY_ITEM arg if you wanted to. You're already telling forge that its an item with config.getItem
Here is my Mod File:
Also when I run minecraft from eclipse, I get this weird errors about my Items:
Please help me.
These static fields are initialized before the preInit method can be executed. Since those ID fields aren't yet defined, they are all zero.
To fix, you shouldn't actually initialize them until you after define the IDs.
I had the same problem not too long ago. All I did was change to bigger numbers. Remember that the minecraft engine automatically offsets item IDs by 256. Also if you wanna save on typing, you can get rid of Configuration.CATAGORY_ITEM arg if you wanted to. You're already telling forge that its an item with config.getItem