Jump to content

Modding error: State engine forced into a different state


Ablaze

Recommended Posts

Hello everyone!

    My name is Ablaze. I was impressed by the forum with my last topic. I had 4 replies by the next day of the OP. Anyways, here is my newest problem. I got into modding 3-4 days back. I don't mind if I have a coding error; in the sense a problem in the code. I will Google as much as possible, and rack my brains to figure it out. But this one is a real bad one. It isn't an error. When I run Minecraft through eclipse, this is the log i get:-

 

Aug 28, 2013 10:04:37 PM net.minecraft.launchwrapper.LogWrapper log
INFO: Using tweak class name cpw.mods.fml.common.launcher.FMLTweaker
2013-08-28 22:04:39 [iNFO] [ForgeModLoader] Forge Mod Loader version 6.2.55.842 for Minecraft 1.6.2 loading
2013-08-28 22:04:39 [iNFO] [ForgeModLoader] Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_21, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jdk1.7.0_21\jre
2013-08-28 22:04:39 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
2013-08-28 22:04:41 [iNFO] [sTDOUT] Loaded 39 rules from AccessTransformer config file fml_at.cfg
2013-08-28 22:04:42 [iNFO] [sTDOUT] Loaded 107 rules from AccessTransformer config file forge_at.cfg
2013-08-28 22:04:44 [sEVERE] [ForgeModLoader] The binary patch set is missing. Either you are in a development environment, or things are not going to work!
2013-08-28 22:04:46 [iNFO] [ForgeModLoader] Launching wrapped minecraft
2013-08-28 22:04:56 [iNFO] [Minecraft-Client] Setting user: Player505
2013-08-28 22:04:56 [iNFO] [Minecraft-Client] (Session ID is null)
2013-08-28 22:05:08 [iNFO] [Minecraft-Client] LWJGL Version: 2.9.0
2013-08-28 22:05:13 [iNFO] [Minecraft-Client] Reloading ResourceManager: Default
2013-08-28 22:05:15 [iNFO] [sTDOUT] 
2013-08-28 22:05:15 [iNFO] [sTDOUT] Starting up SoundSystem...
2013-08-28 22:05:15 [iNFO] [sTDOUT] Initializing LWJGL OpenAL
2013-08-28 22:05:15 [iNFO] [sTDOUT]     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
2013-08-28 22:05:19 [iNFO] [MinecraftForge] Attempting early MinecraftForge initialization
2013-08-28 22:05:19 [iNFO] [sTDOUT] MinecraftForge v9.10.0.842 Initialized
2013-08-28 22:05:19 [iNFO] [ForgeModLoader] MinecraftForge v9.10.0.842 Initialized
2013-08-28 22:05:22 [iNFO] [sTDOUT] Replaced 101 ore recipies
2013-08-28 22:05:23 [iNFO] [MinecraftForge] Completed early MinecraftForge initialization
2013-08-28 22:05:24 [iNFO] [ForgeModLoader] Reading custom logging properties from C:\Users\********\Desktop\forge\mcp\jars\config\logging.properties
2013-08-28 22:05:24 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL
2013-08-28 22:05:26 [iNFO] [ForgeModLoader] Searching C:\Users\********\Desktop\forge\mcp\jars\mods for mods
2013-08-28 22:05:26 [iNFO] [sTDOUT] OpenAL initialized.
2013-08-28 22:05:26 [iNFO] [sTDOUT] 
2013-08-28 22:06:20 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load
2013-08-28 22:06:20 [iNFO] [mcp] Activating mod mcp
2013-08-28 22:06:20 [iNFO] [FML] Activating mod FML
2013-08-28 22:06:20 [iNFO] [Forge] Activating mod Forge
2013-08-28 22:06:20 [iNFO] [AblazeTheBest_TutorialMod] Activating mod AblazeTheBest_TutorialMod
2013-08-28 22:06:20 [WARNING] [Tutorial Mod] Mod Tutorial Mod is missing a pack.mcmeta file, things may not work well
2013-08-28 22:06:20 [iNFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Tutorial Mod
2013-08-28 22:06:21 [iNFO] [sTDOUT] 
2013-08-28 22:06:21 [iNFO] [sTDOUT] SoundSystem shutting down...
2013-08-28 22:06:21 [iNFO] [sTDOUT]     Author: Paul Lamb, www.paulscode.com
2013-08-28 22:06:21 [iNFO] [sTDOUT] 
2013-08-28 22:06:21 [iNFO] [sTDOUT] 
2013-08-28 22:06:21 [iNFO] [sTDOUT] Starting up SoundSystem...
2013-08-28 22:06:21 [iNFO] [sTDOUT] Initializing LWJGL OpenAL
2013-08-28 22:06:21 [iNFO] [sTDOUT]     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
2013-08-28 22:06:21 [iNFO] [ForgeModLoader] Registering Forge Packet Handler
2013-08-28 22:06:22 [iNFO] [ForgeModLoader] Succeeded registering Forge Packet Handler
2013-08-28 22:06:22 [iNFO] [sTDOUT] OpenAL initialized.
2013-08-28 22:06:22 [iNFO] [sTDOUT] 
2013-08-28 22:06:22 [iNFO] [ForgeModLoader] Configured a dormant chunk cache size of 0
2013-08-28 22:06:34 [iNFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 4 mods
2013-08-28 22:06:34 [WARNING] [Tutorial Mod] Mod Tutorial Mod is missing a pack.mcmeta file, things may not work well
2013-08-28 22:06:34 [iNFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Tutorial Mod
2013-08-28 22:06:35 [iNFO] [sTDOUT] 
2013-08-28 22:06:35 [iNFO] [sTDOUT] SoundSystem shutting down...
2013-08-28 22:06:36 [iNFO] [sTDOUT]     Author: Paul Lamb, www.paulscode.com
2013-08-28 22:06:36 [iNFO] [sTDOUT] 
2013-08-28 22:06:36 [iNFO] [sTDOUT] 
2013-08-28 22:06:36 [iNFO] [sTDOUT] Starting up SoundSystem...
2013-08-28 22:06:36 [iNFO] [sTDOUT] Initializing LWJGL OpenAL
2013-08-28 22:06:36 [iNFO] [sTDOUT]     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
2013-08-28 22:06:36 [iNFO] [sTDOUT] OpenAL initialized.
2013-08-28 22:06:36 [iNFO] [sTDOUT] 
2013-08-28 22:07:06 [sEVERE] [Minecraft-Client] Realms: Invalid session id
2013-08-28 22:07:07 [iNFO] [Minecraft-Server] Starting integrated minecraft server version 1.6.2
2013-08-28 22:07:07 [iNFO] [Minecraft-Server] Generating keypair
2013-08-28 22:07:13 [iNFO] [ForgeModLoader] Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@60d0e35f)
2013-08-28 22:07:14 [iNFO] [ForgeModLoader] Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@60d0e35f)
2013-08-28 22:07:15 [iNFO] [ForgeModLoader] Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@60d0e35f)
2013-08-28 22:07:15 [iNFO] [Minecraft-Server] Preparing start region for level 0
2013-08-28 22:07:16 [iNFO] [sTDERR] java.lang.IllegalArgumentException: n must be positive
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at java.util.Random.nextInt(Random.java:300)
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at tutorial.EventManager.addOreSpawn(EventManager.java:57)
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at tutorial.EventManager.generateSurface(EventManager.java:24)
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at tutorial.EventManager.generate(EventManager.java:18)
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:103)
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:259)
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1249)
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:153)
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:292)
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:90)
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:107)
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:443)
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-08-28 22:07:16 [sEVERE] [Minecraft-Server] Encountered an unexpected exception IllegalArgumentException
java.lang.IllegalArgumentException: n must be positive
at java.util.Random.nextInt(Random.java:300)
at tutorial.EventManager.addOreSpawn(EventManager.java:57)
at tutorial.EventManager.generateSurface(EventManager.java:24)
at tutorial.EventManager.generate(EventManager.java:18)
at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:103)
at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:259)
at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1249)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:153)
at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:292)
at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:90)
at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:107)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:443)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-08-28 22:07:16 [sEVERE] [Minecraft-Server] This crash report has been saved to: C:\Users\Eehit\Desktop\forge\mcp\jars\.\crash-reports\crash-2013-08-28_22.07.16-server.txt
2013-08-28 22:07:16 [iNFO] [Minecraft-Server] Stopping server
2013-08-28 22:07:16 [iNFO] [Minecraft-Server] Saving players
2013-08-28 22:07:16 [iNFO] [Minecraft-Server] Saving worlds
2013-08-28 22:07:16 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld
2013-08-28 22:07:17 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Nether
2013-08-28 22:07:17 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/The End
2013-08-28 22:07:17 [iNFO] [ForgeModLoader] Unloading dimension 0
2013-08-28 22:07:17 [iNFO] [ForgeModLoader] Unloading dimension -1
2013-08-28 22:07:17 [iNFO] [ForgeModLoader] Unloading dimension 1
2013-08-28 22:07:17 [iNFO] [ForgeModLoader] The state engine was in incorrect state SERVER_STARTING and forced into state SERVER_STOPPED. Errors may have been discarded.

 

See the last line? I.E. - The state engine was in incorrect state SERVER_STARTING and forced into state SERVER_STOPPED. Errors may have been discarded.

 

Here is all my code :-

 

Tutorial.java

 

package tutorial;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.potion.Potion;
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.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid = Tutorial.modid, name = "Tutorial Mod", version = "1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Tutorial {
public static final String modid = "AblazeTheBest_TutorialMod";

public static Block fieryIndestuctibleBlock;

public static Block arkmanditeOre;

public static Item fieryFood; 

public static Item arkmanditeIngot;

EventManager eventmanager = new EventManager();
@EventHandler
public void load(FMLInitializationEvent event)
{
	fieryIndestuctibleBlock = new BlockTutorialBlock(500, Material.rock).setUnlocalizedName("fieryIndestuctibleBlock");
	GameRegistry.registerBlock(fieryIndestuctibleBlock, modid + fieryIndestuctibleBlock.getUnlocalizedName().substring(5));
	LanguageRegistry.addName(fieryIndestuctibleBlock, "Fiery Indestructible Block");

	arkmanditeOre = new BlockArkmanditeOre(501, Material.rock).setUnlocalizedName("arkmanditeOre");
	GameRegistry.registerBlock(arkmanditeOre, modid + arkmanditeOre.getUnlocalizedName().substring(5));
	LanguageRegistry.addName(arkmanditeOre, "Arkmandite Ore");

	arkmanditeIngot = new ItemArkmanditeIngot(5001).setUnlocalizedName("arkmanditeIngot");
	GameRegistry.registerItem(arkmanditeIngot, modid + arkmanditeIngot.getUnlocalizedName().substring(5));

	fieryFood = new ItemTutorial(5000, 3, 12.0f, false).setPotionEffect(Potion.fireResistance.id, 5, 0, 0.9f);
	fieryFood.setUnlocalizedName("fieryFood");
	GameRegistry.registerItem(fieryFood, modid + fieryFood.getUnlocalizedName().substring(5));
	LanguageRegistry.addName(fieryFood, "Fiery Food");

	GameRegistry.registerWorldGenerator(eventmanager);

	TutorialCrafting.loadRecipes();

}
}

 

BlockTutorialBlock.java:-

 

package tutorial;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class BlockTutorialBlock extends Block{

public BlockTutorialBlock(int id, Material material) {
	super(id, material);
	this.setCreativeTab(CreativeTabs.tabBlock);
	this.setHardness(2.0f);
	this.setResistance(18000000.0f);
}

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
{
	this.blockIcon = par1IconRegister.registerIcon(Tutorial.modid + ":" + (this.getUnlocalizedName().substring(5)));
}

}

 

ItemTutorial.java:-

 

package tutorial;

import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemFood;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ItemTutorial extends ItemFood{

public ItemTutorial(int id, int hunger, float saturation, boolean wolfFood) {
	super(id, hunger, saturation, wolfFood);
	this.setCreativeTab(CreativeTabs.tabFood);
}

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
{
	this.itemIcon = par1IconRegister.registerIcon(Tutorial.modid + ":" + (this.getUnlocalizedName().substring(5)));
}

}

 

TutorialCrafting.java:-

 

package tutorial;

import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import cpw.mods.fml.common.registry.GameRegistry;

public class TutorialCrafting {

public static void loadRecipes() {
	GameRegistry.addRecipe(new ItemStack(Tutorial.fieryFood, 3), new Object[]{
		"CXC",
		" C ",
		'C', Block.obsidian, 'X', Item.blazePowder
	});

	FurnaceRecipes.smelting().addSmelting(Tutorial.fieryIndestuctibleBlock.blockID, new ItemStack(Tutorial.fieryFood), 0.5f);

}

}

 

EventManager.java:-

 

package tutorial;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;

public class EventManager implements IWorldGenerator{

@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider) 
{
	switch(world.provider.dimensionId) {
            case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16);
	}
}


private void generateSurface(World world, Random random, int x, int z) {
	this.addOreSpawn(Tutorial.arkmanditeOre, world, random, x, z, 16, 16, 2 + random.nextInt(3), 6, 40, 20);
}



/**
 * Adds an Ore Spawn to Minecraft. Simply register all Ores to spawn with this method in your Generation method in your IWorldGeneration extending Class
 *
 * @param The Block to spawn
 * @param The World to spawn in
 * @param A Random object for retrieving random positions within the world to spawn the Block
 * @param An int for passing the X-Coordinate for the Generation method
 * @param An int for passing the Z-Coordinate for the Generation method
 * @param An int for setting the maximum X-Coordinate values for spawning on the X-Axis on a Per-Chunk basis
 * @param An int for setting the maximum Z-Coordinate values for spawning on the Z-Axis on a Per-Chunk basis
 * @param An int for setting the maximum size of a vein
 * @param An int for the Number of chances available for the Block to spawn per-chunk
 * @param An int for the minimum Y-Coordinate height at which this block may spawn
 * @param An int for the maximum Y-Coordinate height at which this block may spawn
 **/
public void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chancesToSpawn, int minY, int maxY)
{
       int maxPossY = minY + (maxY - 1);
       assert maxY > minY: "The maximum Y must be greater than the Minimum Y";
       assert maxX > 0 && maxX <= 16: "addOreSpawn: The Maximum X must be greater than 0 and less than 16";
       assert minY > 0: "addOreSpawn: The Minimum Y must be greater than 0";
       assert maxY < 256 && maxY > 0: "addOreSpawn: The Maximum Y must be less than 256 but greater than 0";
       assert maxZ > 0 && maxZ <= 16: "addOreSpawn: The Maximum Z must be greater than 0 and less than 16";
      
       int diffBtwnMinMaxY = maxY - minY;
       for(int x = 0; x < chancesToSpawn; x++)
       {
             int posX = blockXPos + random.nextInt(maxX);
             int posY = minY + random.nextInt(diffBtwnMinMaxY);
             int posZ = blockZPos + random.nextInt(maxZ);
             (new WorldGenMinable(block.blockID, maxVeinSize)).generate(world, random, posX, posY, posZ);
       }
}

}

 

BlockArkmanditeOre.java:-

 

package tutorial;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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 BlockArkmanditeOre extends Block{

public BlockArkmanditeOre(int id, Material material) {
	super(id, material);
	this.setCreativeTab(CreativeTabs.tabBlock);
	this.setHardness(6.0F);
	this.setResistance(5.0F);
}

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
{
	this.blockIcon = par1IconRegister.registerIcon(Tutorial.modid + ":" + (this.getUnlocalizedName().substring(5)));
}

}

 

ItemArkmanditeIngot.java:-

 

package tutorial;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;

public class ItemArkmanditeIngot extends Item{

public ItemArkmanditeIngot(int id) {
	super(id);
	this.setCreativeTab(CreativeTabs.tabMaterials);
}

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
{
	this.itemIcon = par1IconRegister.registerIcon(Tutorial.modid + ":" + (this.getUnlocalizedName().substring(5)));
}

}

 

Please help me and reply if you can.

 

Thanking you,

Yours sincerely,

Ablaze.

Add me on Skype: AblazeTheBest. Send a message saying "#HeyAblaze"

 

Currently: Making a mod!

Link to comment
Share on other sites

2013-08-28 22:07:16 [iNFO] [sTDERR] java.lang.IllegalArgumentException: n must be positive
2013-08-28 22:07:16 [iNFO] [sTDERR] 	at java.util.Random.nextInt(Random.java:300)

 

Looks like you're trying to get a random number based on a negative integer on line 57 in Events Manager

 

2013-08-28 22:07:16 [iNFO] [sTDERR] 	at tutorial.EventManager.addOreSpawn(EventManager.java:57)

Link to comment
Share on other sites

ok first, how to read logs

 

what youre looking for isnt what you stated

 

what youre looking for is thsi:

2013-08-28 22:07:16 [iNFO] [sTDERR] java.lang.IllegalArgumentException: n must be positive

2013-08-28 22:07:16 [iNFO] [sTDERR] at java.util.Random.nextInt(Random.java:300)

2013-08-28 22:07:16 [iNFO] [sTDERR] at tutorial.EventManager.addOreSpawn(EventManager.java:57)

2013-08-28 22:07:16 [iNFO] [sTDERR] at tutorial.EventManager.generateSurface(EventManager.java:24)

2013-08-28 22:07:16 [iNFO] [sTDERR] at tutorial.EventManager.generate(EventManager.java:18)

2013-08-28 22:07:16 [iNFO] [sTDERR] at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:103)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:259)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1249)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:153)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:292)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:90)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:107)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:443)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)

so lets start by what this means

 

all the "at package.name.classname.method(File.java: line#)"

is called the stack trace, it says where and how the program crash.

in your case it says:

java.lang.IllegalArgumentException

meaning you called a method with soemthign that shouldn't be

its followed by:

n must be positive

which explain why its not a legal argument

and with the stack trace:

at java.util.Random.nextInt(Random.java:300)

its in file java.util.Random in methdo nextInt in the file Random.java at line 300

and thsi method is called from:

at tutorial.EventManager.addOreSpawn(EventManager.java:57)

which is YOUR class (always assume that everything under java.* is correct and working, always assume that YOU are not using the code properlly)

so its in file EventManager.java at line 57 and its in method addOreSpawn

which btw is called from:

at tutorial.EventManager.generateSurface(EventManager.java:24)

generateSurface line 24 in file EventManager, but we assume that your code is fucking up ...

 

line 57 of EventManager (well actually 57+- 2 lines):

int posX = blockXPos + random.nextInt(maxX);
int posY = minY + random.nextInt(diffBtwnMinMaxY);
int posZ = blockZPos + random.nextInt(maxZ);

remember i dont have line numbers and im not goign to count them

so one of these receives a number under 0 (remember earlier: n must be positive)

you can clearly see that by doign a println right before calling those

System.out.println("value of maxX: "+maxX);
int posX = blockXPos + random.nextInt(maxX);
System.out.println("value of diffBtwnMinMaxY: "+diffBtwnMinMaxY);
int posY = minY + random.nextInt(diffBtwnMinMaxY);
System.out.println("value of maxZ: "+maxZ);
int posZ = blockZPos + random.nextInt(maxZ);

 

now if you run thsi the logs will look like this:

"value of maxX: 3

value of diffBtwnMinMaxY: -1

value of maxZ:  5

2013-08-28 22:07:16 [iNFO] [sTDERR] java.lang.IllegalArgumentException: n must be positive

2013-08-28 22:07:16 [iNFO] [sTDERR] at java.util.Random.nextInt(Random.java:300)

2013-08-28 22:07:16 [iNFO] [sTDERR] at tutorial.EventManager.addOreSpawn(EventManager.java:57)

2013-08-28 22:07:16 [iNFO] [sTDERR] at tutorial.EventManager.generateSurface(EventManager.java:24)

2013-08-28 22:07:16 [iNFO] [sTDERR] at tutorial.EventManager.generate(EventManager.java:18)

2013-08-28 22:07:16 [iNFO] [sTDERR] at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:103)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:259)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1249)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:153)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:292)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:90)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:107)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:443)

2013-08-28 22:07:16 [iNFO] [sTDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)

so you know that yes you are fucking up somewhere

btw i made up those numbers, i dont know what the actual output will be

 

since you know you are sending negative numbers to the method nextInt you have to find why you are arriving at these resutl and how to fix it

 

gl hf

 

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

  • 2 months later...

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.