Jump to content

Slot 0 with config file


minnymin3

Recommended Posts

I created a basic mod that adds a few new blocks into the game and added a config. When i launched it after i added the config, I got these errors:

java.lang.IllegalArgumentException: Slot 0 is already occupied by minny.minnylight.GlowBrick@6a63afa4 when adding minny.minnylight.GlowTorch@36a06e8d
at net.minecraft.src.Block.<init>(Block.java:292)
at net.minecraft.src.Block.<init>(Block.java:325)
at minny.minnylight.GlowTorch.<init>(GlowTorch.java:26)
at minny.minnylight.mod_MinnyLight.load(mod_MinnyLight.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:440)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:651)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:197)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:469)
at net.minecraft.client.Minecraft.run(Minecraft.java:756)
at java.lang.Thread.run(Thread.java:680)

The config file says

block {
    I:"Coloured Glass"=4093
    I:"Glow Brick"=4095
    I:"Glow Torch"=4094
}

I have no idea why it is making the block ID 0. Any help would be very much appreciated.

 

Here is the rest of my code, specifically mod_minnylight

package minny.minnylight;

/*
* Basic importing
*/

import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraftforge.common.Configuration;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
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="Minny's Lighting",name="Minny's Lighting",version="0.2.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)



public class mod_MinnyLight {
       
       

        
        @SidedProxy(clientSide="minny.minnylight.ClientProxy", serverSide="minny.minnylight.CommonProxy")
        public static CommonProxy proxy;
       

        @PreInit
    	public void preLoad(FMLPreInitializationEvent event) {
        	
        	Configuration config = new Configuration(event.getSuggestedConfigurationFile());
        	
        	config.load();
        	
        	int GlowBrickID = config.getBlock("Glow Brick", 148).getInt();
        	int GlowTorchID = config.getBlock("Glow Torch", 149).getInt();
        	int ColouredGlassID = config.getBlock("Coloured Glass", 150).getInt();
        	
        	config.save();
        	
        	
    	}
       
        //Declaring Init
        @Init
        public void load(FMLInitializationEvent event){
               
                //GlowBrick
                GlowBrick = (new GlowBrick(GlowBrickID , 0).setBlockName("Glow Brick").setLightValue(1.0F).setHardness(1F).setResistance(5F));
                
                GameRegistry.registerBlock(GlowBrick);
                
                LanguageRegistry.addName(GlowBrick, "GlowBrick");
                
                GameRegistry.addRecipe(new ItemStack(GlowBrick, , new Object[]{
                	"SSS","SgS","SSS",'g',Block.glowStone,'S',Block.stoneBrick
                });
                
                //GlowTorch
                GlowTorch = (new GlowTorch(GlowTorchID , 1).setBlockName("Glow Torch").setLightValue(1.0F).setHardness(0F).setResistance(10F));   
                
                GameRegistry.registerBlock(GlowTorch);
                
                LanguageRegistry.addName(GlowTorch, "Glow Torch");
                
                GameRegistry.addRecipe(new ItemStack(GlowTorch, 4), new Object[]{
                	"g","s",'g',Item.lightStoneDust,'s',Item.stick
                });

                //WhiteGlass
                ColouredGlass = (new ColouredGlass(ColouredGlassID , 2).setBlockName("White Glass").setLightOpacity(1).setHardness(0.3F));
                
                GameRegistry.registerBlock(ColouredGlass, MultiColouredGLass.class);
                
                for (int ix = 0; ix < 16; ix++) {
                  //Defining all the dyes
                	ItemStack whiteDye = new ItemStack(Item.dyePowder, 1, 16);
                	ItemStack orangeDye = new ItemStack(Item.dyePowder, 1, 15);
                	ItemStack magentaDye = new ItemStack(Item.dyePowder, 1, 14);
                	ItemStack lightBlueDye = new ItemStack(Item.dyePowder, 1, 13);
                	ItemStack yellowDye = new ItemStack(Item.dyePowder, 1, 12);
                	ItemStack limeDye = new ItemStack(Item.dyePowder, 1, 11);
                	ItemStack pinkDye = new ItemStack(Item.dyePowder, 1, 10);
                	ItemStack greyDye = new ItemStack(Item.dyePowder, 1, 9);
                	ItemStack lightGreyDye = new ItemStack(Item.dyePowder, 1, ;
                	ItemStack cyanDye = new ItemStack(Item.dyePowder, 1, 7);
                	ItemStack purpleDye = new ItemStack(Item.dyePowder, 1, 6);
                	ItemStack blueDye = new ItemStack(Item.dyePowder, 1, 5);
                	ItemStack brownDye = new ItemStack(Item.dyePowder, 1, 4);
                	ItemStack greenDye = new ItemStack(Item.dyePowder, 1, 3);
                	ItemStack redDye = new ItemStack(Item.dyePowder, 1, 2);
                	ItemStack blackDye = new ItemStack(Item.dyePowder, 1, 1);
                	
                  //Defining all the colors of glass	
                	ItemStack  whiteGlass = new ItemStack(ColouredGlass, 1, 1);
                	ItemStack  orangeGlass = new ItemStack(ColouredGlass, 1, 2);
                	ItemStack  magentaGlass = new ItemStack(ColouredGlass, 1, 3);
                	ItemStack  lightBlueGlass = new ItemStack(ColouredGlass, 1, 4);
                	ItemStack  yellowGlass = new ItemStack(ColouredGlass, 1, 5);
                	ItemStack  limeGlass = new ItemStack(ColouredGlass, 1, 6);
                	ItemStack  pinkGlass = new ItemStack(ColouredGlass, 1, 7);
                	ItemStack  greyGlass = new ItemStack(ColouredGlass, 1, ;
                	ItemStack  lightGreyGlass = new ItemStack(ColouredGlass, 1, 9);
                	ItemStack  cyanGlass = new ItemStack(ColouredGlass, 1, 10);
                	ItemStack  purpleGlass = new ItemStack(ColouredGlass, 1, 11);
                	ItemStack  blueGlass = new ItemStack(ColouredGlass, 1, 12);
                	ItemStack  brownGlass = new ItemStack(ColouredGlass, 1, 13);
                	ItemStack  greenGlass = new ItemStack(ColouredGlass, 1, 14);
                	ItemStack  redGlass = new ItemStack(ColouredGlass, 1, 15);
                	ItemStack  blackGlass = new ItemStack(ColouredGlass, 1, 16);
                	
                  //Defining the multiBlock colored glass	
                	ItemStack multiBlockStack = new ItemStack(ColouredGlass, 1, ix);
                	
                  //Defining all the recipes of all the colors of glass	
                	
                	GameRegistry.addShapelessRecipe(whiteGlass, Block.glass, whiteDye);
                	GameRegistry.addShapelessRecipe(orangeGlass, Block.glass, orangeDye);
                	GameRegistry.addShapelessRecipe(magentaGlass, Block.glass, magentaDye);
                	GameRegistry.addShapelessRecipe(lightBlueGlass, Block.glass, lightBlueDye);
                	GameRegistry.addShapelessRecipe(yellowGlass, Block.glass, yellowDye);
                	GameRegistry.addShapelessRecipe(limeGlass, Block.glass, limeDye);
                	GameRegistry.addShapelessRecipe(pinkGlass, Block.glass, pinkDye);
                	GameRegistry.addShapelessRecipe(greyGlass, Block.glass, greyDye);
                	GameRegistry.addShapelessRecipe(lightGreyGlass, Block.glass, lightGreyDye);
                	GameRegistry.addShapelessRecipe(cyanGlass, Block.glass, cyanDye);
                	GameRegistry.addShapelessRecipe(purpleGlass, Block.glass, purpleDye);
                	GameRegistry.addShapelessRecipe(blueGlass, Block.glass, blueDye);
                	GameRegistry.addShapelessRecipe(brownGlass, Block.glass, brownDye);
                	GameRegistry.addShapelessRecipe(greenGlass, Block.glass, greenDye);
                	GameRegistry.addShapelessRecipe(redGlass, Block.glass, redDye);
                	GameRegistry.addShapelessRecipe(blackGlass, Block.glass, blackDye);
                	
                	
                	LanguageRegistry.addName(multiBlockStack, ColouredGlassNames[multiBlockStack.getItemDamage()]);
                }
                
                
                
                proxy.registerRenderers();
        }

    	@PostInit
    	public void postInit(FMLPostInitializationEvent event) {
    		// Stub Method
    	}
    	//Telling forge that we are creating these
        public static Block GlowBrick;
        public static Block GlowTorch;
        public static Block ColouredGlass;
        private static final String[] ColouredGlassNames = { 
        	"White Glass", "Orange Glass", "Magenta Glass", "Light Blue Glass",
        	"Yellow Glass", "Lime Glass", "Pink Glass", "Dark Grey Glass",
        	"Light Grey Glass", "Cyan Glass", "Purple Glass", "Blue Glass",
        	"Brown Glass", "Green Glass", "Red Glass", "Black Glass"
        };
        public int GlowBrickID;
        public int GlowTorchID;
        public int ColouredGlassID;
}

 

EDIT: I followed the tut: http://www.minecraftforge.net/wiki/How_to_make_an_advanced_configuration_file

Link to comment
Share on other sites

 

        public int GlowBrickID;

        public int GlowTorchID;

        public int ColouredGlassID;

 

...

 

 

        int GlowBrickID = config.getBlock("Glow Brick", 148).getInt();

        int GlowTorchID = config.getBlock("Glow Torch", 149).getInt();

        int ColouredGlassID = config.getBlock("Coloured Glass", 150).getInt();

       

....

*facepalm* http://bit.ly/W5opB8

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.