Jump to content

NullPointerException on MinecraftServer crashing game


charsmud

Recommended Posts

I am trying to move my client ticker over to a server ticker, as all my code was only being executed by the client.  However, I am getting a nullPointerException on a MinecraftServer variable inside of my server ticker.  Here's the code and error:

 

 

package timeTraveler.ticker;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.EnumSet;

import timeTraveler.core.TimeTraveler;
import timeTraveler.entities.EntityPlayerPast;
import timeTraveler.gui.GuiTimeTravel;
import timeTraveler.mechanics.CopyFile;
import timeTraveler.mechanics.EntityMechanics;
import timeTraveler.mechanics.PastMechanics;

import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.potion.Potion;
import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.server.FMLServerHandler;

public class ServerTickHandler implements ITickHandler
{

public int ctr;
public int ct;
public int count;

public static int paradoxLevel;

public static int seconds = 10;
public static int minutes = 1;

public int invisPotTime = 0;
public int sneakTime = 0;

private int timeNumber = 1;


/*int prevSheep;
int prevPig;
int prevCow;
int prevChick;
int prevSqu;
int prevWol;
int prevOce;
int prevBat;
int prevGol;
int prevMoo;
int prevVil;

int prevEnd;
int prevZpi;
int prevBla;
int prevCsp;
int prevCre;
int prevGha;
int prevMag;
int prevSil;
int prevSke;
int prevSli;
int prevSpi;
int prevWit;
int prevZom;*/

String text;

CopyFile copyFile = new CopyFile();

public boolean hasRun = false;
public boolean hasInitMobs = false;

private boolean nextSet = true;

private boolean isInPast;


    private void onServerTick(MinecraftServer server, Minecraft mc)
    {
    	if(FMLServerHandler.instance().getServer() != null || mc.theWorld != null)
    	{
    		System.out.println("");
    		ctr++;
    		ct++;

    		PastMechanics mechanics = new PastMechanics();
    		EntityMechanics entityMechanics = new EntityMechanics();
    		
    	    text  = "Time Remaining: " + minutes + " Minute, " + seconds + " Seconds";
        	TimeTraveler.vars.setPastText(text);
        	TimeTraveler.vars.setParadoxLevel(paradoxLevel);
        	System.out.println(TimeTraveler.vars.getPastText());
        	System.out.println(TimeTraveler.vars.getParadoxLevel());
        	System.out.println(text);
        	System.out.println(paradoxLevel);

    		isInPast = GuiTimeTravel.isInPast;		
    		if(!isInPast)
    		{
    			if(mc.thePlayer.isJumping)
    			{
    			}
    			if(mc.thePlayer.isSneaking())
    			{
    			}
    		}
    		
    		if(ct == 20)
    		{
    			if(!isInPast)
    			{
    				mechanics.addEntityData(TimeTraveler.vars.getEntiyLocData());
    				
    				ct = 0;
    			}
    		}
    		
    		if(ctr == 20 * 60)
    		{
    			if(!isInPast)
    			{
    				mechanics.saveTime(server, mc, copyFile);
    				//mechanics.addPlayerLoc(mc.getIntegratedServer(), mc, "stop");
    				//mechanics.addPlayerLoc(mc.getIntegratedServer(), mc, "newtime");
    				mechanics.saveEntityData(TimeTraveler.vars.getEntiyLocData(), server);
    			}
    			ctr = 0;
    		}
    		if(!hasRun)
    		{
            	hasRun = true;
            	mechanics.firstTime(server, mc);
    		}
    		if(isInPast)
    		{			
    			
    			mc.theWorld.getGameRules().setOrCreateGameRule("doMobSpawning", "false");
    			
    			
    			File allEntityData = new File(mc.getMinecraftDir() + "/mods/TimeMod/past/EntityLocations/" + server.getWorldName() + "/" + TimeTraveler.vars.getPastTime() + ".epd");
    					
    			try 
    			{
    				BufferedReader reader = new BufferedReader(new FileReader(allEntityData));
    				String line;
    				while (((line = reader.readLine()) != null) && nextSet) 
    				{
    					if(line.equals("===================="))
    					{
    						nextSet = false;
    					}
    					else 
    					{
    						String[] entityData = line.split(",");
    									
    						String entityName = entityData[0];
    						int entityX = Integer.parseInt(entityData[1]);
    						int entityY = Integer.parseInt(entityData[2]);
    						int entityZ = Integer.parseInt(entityData[3]);
    									
    						//System.out.println(entityName + " " + entityX + " " + entityY + " " + entityZ);
    						Entity pastEntity = EntityList.createEntityByName(entityName, mc.thePlayer.worldObj);
    							
    						if(pastEntity != null)
    						{
    							PathEntity path = ((EntityLiving)pastEntity).getNavigator().getPath();
    							if(pastEntity != null)
    							{
    								pastEntity.posX = (double)entityX;
    								pastEntity.posY = (double)entityY;
    								pastEntity.posZ = (double)entityZ;
    											
    								System.out.println(pastEntity);
    								mc.thePlayer.worldObj.spawnEntityInWorld(pastEntity);
    							}

    						}
    						else
    						{
    							EntityPlayerPast pastPlayer = new EntityPlayerPast(mc.thePlayer.worldObj);
    							pastPlayer.posX = (double)entityX;
    							pastPlayer.posY = (double)entityY;
    							pastPlayer.posZ = (double)entityZ;
    							System.out.println(pastPlayer);
    							mc.thePlayer.worldObj.spawnEntityInWorld(pastPlayer);
    						}
    																	
    				        //path = ((EntityLiving)pastEntity).getNavigator().getPathToXYZ((double)entityX, (double)entityY, (double)entityZ);
    				            		
    				        //((EntityLiving)pastEntity).getNavigator().setPath(path, 1.0F);
    				        //((EntityLiving)pastEntity).getNavigator().tryMoveToXYZ((double)entityX, (double)entityY, (double)entityZ, 0.5F);

    					}
    					System.out.println(nextSet);
    				}
    				reader.close();	
    			} 
    			catch (IOException e) 
    			{
    				e.printStackTrace();
    			} 
    			
    			count++;
    			if(paradoxLevel < 0)
    			{
    				paradoxLevel = 0;
    			}
    			if(paradoxLevel <= 128)
    			{
    				EntityPlayerSP eps = mc.thePlayer;
    				if(eps.isPotionActive(Potion.invisibility))
    				{
    					invisPotTime++;
    					if(invisPotTime == 10)
    					{
    						paradoxLevel = paradoxLevel - 5;
    						invisPotTime = 0;
    					}
    				}
    				if(eps.isEating()) 
    				{
    					paradoxLevel++;
    					eps.experienceTotal = eps.experienceTotal + 2;
    				}
    				if(eps.isSneaking())
    				{
    					sneakTime++;
    					if(sneakTime == 30)
    					{
    						paradoxLevel = paradoxLevel - 2;
    						sneakTime = 0;
    					}
    				}
    								/*WorldClient w = mc.theWorld;
    				//Passive Mobs
    				EntitySheep es = new EntitySheep(w);
    				EntityPig ep = new EntityPig(w);
    				EntityCow ec = new EntityCow(w);
    				EntityChicken eck = new EntityChicken(w);
    				EntitySquid esq = new EntitySquid(w);
    				EntityWolf ew = new EntityWolf(w);
    				EntityOcelot eo = new EntityOcelot(w);
    				EntityBat eb = new EntityBat(w);
    				EntityIronGolem ei = new EntityIronGolem(w);
    				EntityMooshroom em = new EntityMooshroom(w);
    				EntityVillager ev = new EntityVillager(w);
    				EntityEnderman ee = new EntityEnderman(w);
    				EntityPigZombie ezp = new EntityPigZombie(w);
    				EntityBlaze ebl = new EntityBlaze(w);
    				EntityCaveSpider ecs = new EntityCaveSpider(w);
    				EntityCreeper ecr = new EntityCreeper(w);
    				EntityGhast eg = new EntityGhast(w);
    				EntityMagmaCube emc = new EntityMagmaCube(w);
    				EntitySilverfish esi = new EntitySilverfish(w);
    				EntitySkeleton esk = new EntitySkeleton(w);
    				EntitySlime esl = new EntitySlime(w);
    				EntitySpider esp = new EntitySpider(w);
    				EntityWitch ewi = new EntityWitch(w);
    				EntityZombie ez = new EntityZombie(w);
    				if(!hasInitMobs) 
    				{
    					 prevSheep = w.countEntities(es.getClass());
    					 prevPig = w.countEntities(ep.getClass());
    					 prevCow = w.countEntities(ec.getClass());
    					 prevChick = w.countEntities(eck.getClass());
    					 prevSqu = w.countEntities(esq.getClass());
    					 prevWol = w.countEntities(ew.getClass());
    					 prevOce = w.countEntities(eo.getClass());
    					 prevBat = w.countEntities(eb.getClass());
    					 prevGol = w.countEntities(ei.getClass());
    					 prevMoo = w.countEntities(ei.getClass());
    					 prevVil = w.countEntities(ev.getClass());
    					 prevEnd = w.countEntities(ee.getClass());
    					 prevZpi = w.countEntities(ezp.getClass());
    					 prevBla = w.countEntities(ebl.getClass());
    					 prevCsp = w.countEntities(ecs.getClass());
    					 prevCre = w.countEntities(ecr.getClass());
    					 prevGha = w.countEntities(eg.getClass());
    					 prevMag = w.countEntities(emc.getClass());
    					 prevSil = w.countEntities(esi.getClass());
    					 prevSke = w.countEntities(esk.getClass());
    					 prevSli = w.countEntities(esl.getClass());
    					 prevSpi = w.countEntities(esp.getClass());
    					 prevWit = w.countEntities(ewi.getClass());
    					 prevZom = w.countEntities(ez.getClass());
    					 hasRun = true;
    				}
    				if(prevSheep > w.countEntities(es.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 4;
    					prevSheep = w.countEntities(es.getClass());
    				}
    				if(prevPig > w.countEntities(ep.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 8;
    					prevPig = w.countEntities(ep.getClass());
    				}
    				if(prevCow > w.countEntities(ec.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 12;
    					prevCow = w.countEntities(ec.getClass());
    				}
    				if(prevChick > w.countEntities(eck.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 7;
    					prevChick = w.countEntities(eck.getClass());
    				}
    				if(prevSqu > w.countEntities(esq.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 2;
    					prevSqu = w.countEntities(esq.getClass());
    				}
    				if(prevWol > w.countEntities(ew.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 14;
    					prevWol = w.countEntities(ew.getClass());
    				}
    				if(prevOce > w.countEntities(eo.getClass())){
    					paradoxLevel = paradoxLevel + 20;
    					prevOce = w.countEntities(eo.getClass());
    				}
    				if(prevBat > w.countEntities(eb.getClass()))
    				{
    					paradoxLevel++;
    					prevBat = w.countEntities(eo.getClass());
    				}
    				if(prevMoo > w.countEntities(em.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 14;
    					prevMoo = w.countEntities(em.getClass());
    				}
    				if(prevGol > w.countEntities(ei.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 78;
    					prevBat = w.countEntities(ei.getClass());
    				}
    				if(prevVil > w.countEntities(ev.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 55;
    					prevVil = w.countEntities(ev.getClass());
    				}
    				if(prevEnd > w.countEntities(ee.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 25;
    					prevEnd = w.countEntities(ee.getClass());
    				}
    				if(prevZpi > w.countEntities(ezp.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 19;
    					prevZpi = w.countEntities(ezp.getClass());
    				}
    				if(prevBla > w.countEntities(ebl.getClass())) 
    				{
    					paradoxLevel = paradoxLevel + 33;
    					prevBla = w.countEntities(ebl.getClass());
    				}
    				if(prevCsp > w.countEntities(ecs.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 29;
    					prevCsp = w.countEntities(ecs.getClass());
    				}
    				if(prevCre > w.countEntities(ecr.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 69;
    					prevCre = w.countEntities(ecr.getClass());
    				}
    				if(prevGha > w.countEntities(eg.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 56;
    					prevGha = w.countEntities(eg.getClass());
    				}
    				if(prevMag > w.countEntities(emc.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 10;
    					prevMag = w.countEntities(emc.getClass());
    				}
    				if(prevSil > w.countEntities(esi.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 4;
    					prevSil = w.countEntities(esi.getClass());
    				}
    				if(prevSke > w.countEntities(esk.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 34;
    					prevSke = w.countEntities(esk.getClass());
    				}
    				if(prevSli > w.countEntities(esl.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 10;
    					prevSli = w.countEntities(esl.getClass());
    				}
    				if(prevSpi > w.countEntities(esp.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 27;
    					prevSpi = w.countEntities(esp.getClass());
    				}
    				if(prevWit > w.countEntities(ewi.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 49;
    					prevWit = w.countEntities(ewi.getClass());
    				}
    				if(prevZom > w.countEntities(ez.getClass()))
    				{
    					paradoxLevel = paradoxLevel + 20;
    					prevZom = w.countEntities(ez.getClass());
    				}

    				if(prevSheep < w.countEntities(es.getClass()))
    				{
    					prevSheep = w.countEntities(es.getClass());
    				}
    				if(prevPig < w.countEntities(ep.getClass()))
    				{
    					prevPig = w.countEntities(ep.getClass());
    				}
    				if(prevCow < w.countEntities(ec.getClass()))
    				{
    					prevCow = w.countEntities(ec.getClass());
    				}
    				if(prevChick < w.countEntities(eck.getClass()))
    				{
    					prevChick = w.countEntities(eck.getClass());
    				}
    				if(prevSqu < w.countEntities(esq.getClass()))
    				{
    					prevSqu = w.countEntities(esq.getClass());
    				}
    				if(prevWol < w.countEntities(ew.getClass()))
    				{
    					prevWol = w.countEntities(ew.getClass());
    				}
    				if(prevOce < w.countEntities(eo.getClass()))
    				{
    					prevOce = w.countEntities(eo.getClass());
    				}
    				if(prevBat < w.countEntities(eb.getClass()))
    				{
    					prevBat = w.countEntities(eb.getClass());
    				}
    				if(prevGol < w.countEntities(ei.getClass()))
    				{
    					prevGol = w.countEntities(ei.getClass());
    				}
    				if(prevMoo < w.countEntities(em.getClass()))
    				{
    					prevMoo = w.countEntities(em.getClass());
    				}
    				if(prevVil < w.countEntities(ev.getClass()))
    				{
    					prevVil = w.countEntities(ev.getClass());
    				}
    				if(prevEnd < w.countEntities(ee.getClass())) 
    				{
    					prevEnd = w.countEntities(ee.getClass());
    				}
    				if(prevZpi < w.countEntities(ezp.getClass()))
    				{
    					prevZpi = w.countEntities(ezp.getClass());
    				}
    				if(prevBla < w.countEntities(ebl.getClass()))
    				{
    					prevBla = w.countEntities(ebl.getClass());
    				}
    				if(prevCsp < w.countEntities(ecs.getClass()))
    				{
    					prevCsp = w.countEntities(ecs.getClass());
    				}
    				if(prevCre < w.countEntities(ecr.getClass()))
    				{
    					prevCre = w.countEntities(ecr.getClass());
    				}
    				if(prevGha < w.countEntities(eg.getClass()))
    				{
    					prevGha = w.countEntities(eg.getClass());
    				}
    				if(prevMag < w.countEntities(emc.getClass()))
    				{
    					prevMag = w.countEntities(emc.getClass());
    				}
    				if(prevSil < w.countEntities(esi.getClass()))
    				{
    					prevSil = w.countEntities(esi.getClass());
    				}
    				if(prevSke < w.countEntities(esk.getClass()))
    				{
    					prevSke = w.countEntities(esk.getClass());
    				}
    				if(prevSli < w.countEntities(esl.getClass()))
    				{
    					prevSli = w.countEntities(esl.getClass());
    				}
    				if(prevSpi < w.countEntities(esp.getClass()))
    				{
    					prevSpi = w.countEntities(esp.getClass());
    				}
    				if(prevWit < w.countEntities(ewi.getClass()))
    				{
    					prevWit = w.countEntities(ewi.getClass());
    				}
    				if(prevZom < w.countEntities(ez.getClass()))
    				{
    					prevZom = w.countEntities(ez.getClass());
    				}*/
    			}
    			else
    			{
    				mechanics.returnToPresent(mc, paradoxLevel, server);
    			}
    		}
    		if(isInPast)
    		{
    			if(count == 20)
    			{
    				seconds--;
    				count = 0;
    			}
    			if(seconds == 0)
    			{
    				minutes--;
    				seconds = 60;
    			}
    			if(minutes == 0)
    			{
    				text = "Time Remaining: " + seconds + " Seconds";
    			}
    			if(minutes <= 0 && seconds <= 1)
    			{
    				mechanics.outOfTime(mc, server, text);
    			}
    		}	

    	}

    }

    @Override
    public void tickStart(EnumSet<TickType> type, Object... tickData)
    {
         if (type.equals(EnumSet.of(TickType.PLAYER)))  
         {
             onServerTick(FMLServerHandler.instance().getServer(), FMLClientHandler.instance().getClient());
         }
    }

    @Override
    public EnumSet<TickType> ticks()
    {
        return EnumSet.of(TickType.PLAYER, TickType.SERVER);
    }

    @Override
    public void tickEnd(EnumSet<TickType> type, Object... tickData)
    {

    }

    @Override
    public String getLabel()
    {
        return null;
    }
}

 

 

 

package timeTraveler.core;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.src.ModLoader;
import net.minecraft.world.biome.BiomeGenBase;
import timeTraveler.blocks.BlockParadoxCondenser;
import timeTraveler.blocks.BlockTimeTraveler;
import timeTraveler.blocks.Collision;
import timeTraveler.blocks.ParadoxExtractor;
import timeTraveler.entities.EntityParadoxHunter;
import timeTraveler.entities.EntityPlayerPast;
import timeTraveler.gui.GuiHandler;
import timeTraveler.items.BottledParadox;
import timeTraveler.items.CondensedParadox;
import timeTraveler.items.EmptyBottle;
import timeTraveler.items.ItemParadoximer;
import timeTraveler.mechanics.FutureTravelMechanics;
import timeTraveler.network.TimeTravelerPacketHandler;
import timeTraveler.proxies.CommonProxy;
import timeTraveler.structures.StructureGenerator;
import timeTraveler.ticker.ServerTickHandler;
import timeTraveler.ticker.TickerClient;
import timeTraveler.tileentity.TileEntityCollision;
import timeTraveler.tileentity.TileEntityExtractor;
import cpw.mods.fml.client.FMLClientHandler;
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.PreInit;
import cpw.mods.fml.common.Mod.ServerStarted;
import cpw.mods.fml.common.Mod.ServerStarting;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;


@Mod(modid = "Charsmud_TimeTraveler", name = "Time Traveler", version = "0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false, serverPacketHandlerSpec = @SidedPacketHandler (channels = {"futuretravel", "paradoxgui"}, packetHandler = TimeTravelerPacketHandler.class))

/**
* Main laucher for TimeTraveler
* @author Charsmud
*
*/
public class TimeTraveler
{
@SidedProxy(clientSide = "timeTraveler.proxies.ClientProxy", serverSide = "timeTraveler.proxies.CommonProxy")


public static CommonProxy proxy;

@Instance
public static TimeTraveler instance = new TimeTraveler();

public static Block travelTime;
public static Block paradoxCondenser;
public static Block paradoxExtractor;
public static Block collisionBlock;

public static Item paradoximer;
public static Item bottledParadox;
public static Item condensedParadox;
public static Item emptyBottle;

public static final String modid = "Charsmud_TimeTraveler";

FutureTravelMechanics ftm;

private GuiHandler guihandler;

static int startEntityId = 300;

public static UnchangingVars vars = new UnchangingVars();

/**
 * Initializes DeveloperCapes
 * @param event
 */
@PreInit
public void preInit(FMLPreInitializationEvent event)
{
	proxy.initCapes();
}
/**
 * Initiates mod, registers block and item for use.  Generates the necessary folders.
 */
@Init
public void load(FMLInitializationEvent event)
{  	
	proxy.registerRenderThings();
	initialize();
	registerBlocks();
	addNames();
	addRecipes();
	addSmelt();
	mkDirs();
	registerEntities();
	//sqlLite();
	//villageStuff();

	GameRegistry.registerTileEntity(TileEntityCollision.class, "collide");
	GameRegistry.registerTileEntity(TileEntityExtractor.class, "extractor");

	TickRegistry.registerTickHandler(new TickerClient(), Side.CLIENT);		

	GameRegistry.registerWorldGenerator(new StructureGenerator());
	NetworkRegistry.instance().registerGuiHandler(this, guihandler);
	ModLoader.registerEntityID(EntityPlayerPast.class, "PlayerPast", 100);//registers the mobs name and id
	// ModLoader.addSpawn(EntityPlayerPast.class, 25, 25, 25, EnumCreatureType.creature);
}

@ServerStarting
public void onServerStart(FMLServerStartingEvent event) 
{
	TickRegistry.registerTickHandler(new ServerTickHandler(), Side.SERVER);
}


public static int getUniqueEntityId() 
{
	do 
  	{
		startEntityId++;
  	} 
	while (EntityList.getStringFromID(startEntityId) != null);

	return startEntityId;
}
public static void registerEntityEgg(Class<? extends Entity> entity, int primaryColor, int secondaryColor) 
{
	int id = getUniqueEntityId();
	EntityList.IDtoClassMapping.put(id, entity);
	EntityList.entityEggs.put(id, new EntityEggInfo(id, primaryColor, secondaryColor));
}



/**
 * Initializes Variables
 */
public void initialize()
{
	paradoximer = new ItemParadoximer(2330).setUnlocalizedName("ItemParadoximer");	
	bottledParadox = new BottledParadox(2331).setUnlocalizedName("BottledParadox");
	condensedParadox = new CondensedParadox(2332).setUnlocalizedName("CondensedParadox");
	emptyBottle = new EmptyBottle(2333).setUnlocalizedName("emptyBottle");

	travelTime = new BlockTimeTraveler(255).setUnlocalizedName("BlockTimeTraveler");
	paradoxCondenser = new BlockParadoxCondenser(254, true).setUnlocalizedName("BlockParadoxCondenser");
	paradoxExtractor = new ParadoxExtractor(253, true).setUnlocalizedName("ParadoxExtractor");
	collisionBlock = new Collision(252, Material.air).setUnlocalizedName("collisionBlock");

	ftm = new FutureTravelMechanics();		
	guihandler = new GuiHandler();
}
/**
 * Registers Blocks
 */
public void registerBlocks()
{
	GameRegistry.registerBlock(travelTime, "travelTime");
	GameRegistry.registerBlock(paradoxCondenser, "paradoxCondenser");
	GameRegistry.registerBlock(paradoxExtractor, "paradoxExtractor");
	GameRegistry.registerBlock(collisionBlock, "collisionBlock");
}
/**
 * Adds Names
 */
public void addNames()
{
	LanguageRegistry.addName(travelTime, "Paradox Cube");
	LanguageRegistry.addName(paradoximer, "Paradoximer");
	LanguageRegistry.addName(paradoxCondenser, "Paradox Condenser");
	LanguageRegistry.addName(bottledParadox, "Bottled Paradox");
	LanguageRegistry.addName(condensedParadox, "Condensed Paradox");
	LanguageRegistry.addName(paradoxExtractor, "Paradox Extractor");
	LanguageRegistry.addName(emptyBottle, "Empty Bottle");
}
/**
 * Adds Recipes
 */
public void addRecipes()
{
	/*GameRegistry.addRecipe(new ItemStack(emptyBottle,  1), new Object[] 
			{
		" o ", "x x", " x ", Character.valueOf('x'), Block.glass.blockID, Character.valueOf('o'), Item.clay.itemID
			});*/
}
/**
 * Adds Smelting Recipes
 */
public void addSmelt()
{
	FurnaceRecipes.smelting().addSmelting(Item.glassBottle.itemID, new ItemStack(TimeTraveler.emptyBottle), 0.2F);
}

/**
 * Makes the Directories needed
 */
public void mkDirs()
{
	File pastCreation = new File(FMLClientHandler.instance().getClient().getMinecraftDir() + "/mods/TimeMod/past");
	File presentCreation = new File(FMLClientHandler.instance().getClient().getMinecraftDir() + "/mods/TimeMod/present");
	File futureCreation = new File(FMLClientHandler.instance().getClient().getMinecraftDir() + "/mods/TimeMod/future");

	pastCreation.mkdirs();
	presentCreation.mkdirs();
	futureCreation.mkdirs();

}
/**
 * Registers Entities
 */
public void registerEntities()
{
	EntityRegistry.registerModEntity(EntityParadoxHunter.class, "ParadoxHunter", 1, this, 80, 1, true);
	EntityRegistry.addSpawn(EntityParadoxHunter.class, 10, 2, 4, EnumCreatureType.creature, BiomeGenBase.beach, BiomeGenBase.extremeHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.forest, BiomeGenBase.forestHills, BiomeGenBase.jungle, BiomeGenBase.jungleHills, BiomeGenBase.mushroomIsland, BiomeGenBase.mushroomIslandShore, BiomeGenBase.ocean, BiomeGenBase.plains, BiomeGenBase.river, BiomeGenBase.swampland);
	LanguageRegistry.instance().addStringLocalization("entity.Charsmud_TimeTraveler.ParadoxHunter.name", "Paradox Hunter");


	registerEntityEgg(EntityParadoxHunter.class, 0xffffff, 0x000000);
}

public void sqlLite()
{
	try
	{
		Class.forName("org.sqlite.JDBC");
		Connection connection = null;
		try 
		{

			// create a database connection
			connection = DriverManager.getConnection("jdbc:sqlite:" + FMLClientHandler.instance().getClient().getMinecraftDir() + "/mods/TimeMod/database.db");
			Statement statement = connection.createStatement();
			statement.setQueryTimeout(30); // set timeout to 30 sec.

			//statement.executeUpdate("drop table if exists person");
			statement.executeUpdate("create table MobData (name string, x int, y int, z int)");
			statement.executeUpdate("insert into MobData values('Test', 1, 2, 3)");
			statement.executeUpdate("insert into MobData values('Test 2', 4, 5, 6)");
			ResultSet rs = statement.executeQuery("select * from MobData");
			while (rs.next()) 
			{

				// read the result set
				System.out.println("name = " + rs.getString("name"));
				System.out.println("x = " + rs.getInt("x"));
				System.out.println("x = " + rs.getInt("y"));
				System.out.println("x = " + rs.getInt("z"));

			}
		} 
		catch (SQLException e) 
		{
			// if the error message is "out of memory",
			// it probably means no database file is found
			System.err.println(e.getMessage());
		}
		finally 
		{
			try 
			{
				if (connection != null)
				{
					connection.close();
				}
			}
			catch (SQLException e)
			{
				// connection close failed.
				System.err.println(e);
			}
		}
	}
	catch(Exception e)
	{
		System.err.println(e);
	}
}
}

 

 

 

package timeTraveler.mechanics;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.stats.StatList;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.storage.WorldInfo;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.client.FMLClientHandler;

import timeTraveler.core.TimeTraveler;
import timeTraveler.gui.GuiTimeTravel;
import timeTraveler.ticker.ServerTickHandler;
import timeTraveler.ticker.TickerClient;

/**
* Contains information about the new Mechanics for the past
* @author Charsmud
*
*/
public class PastMechanics
{
/**
 * Updates Paradox Bar and Renders
 * @param minecraft
 * @param amtOfParadox
 */
public void updateParadoxBar(Minecraft minecraft, int amtOfParadox)
{
    ScaledResolution var5 = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
    
    int var6 = var5.getScaledWidth();
    int var7 = var5.getScaledHeight();
    int var8 = var7 / var7 + 25;
    
    GuiIngame gig = new GuiIngame(minecraft);
    
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, minecraft.renderEngine.getTexture("/timeTraveler/textureMap/newGUIElements.png"));
	gig.drawTexturedModalRect(var6 / 2 - 200, var8, 0, 0, 128, ;
	gig.drawTexturedModalRect(var6 / 2 - 200, var8, 0, 8, amtOfParadox, ;
}
/**
 * adds an EntityLiving's name and coordinates to a List.
 * @param par1EntityLiving
 * @param par2List
 */
public void addEntityData(List<String> par2List)
{

	List<EntityLiving> allEntities = FMLClientHandler.instance().getClient().theWorld.loadedEntityList;

	for(int i = 0; i < allEntities.size(); i++)
	{
		if(allEntities.get(i) instanceof EntityLiving)
		{
			String entityName = allEntities.get(i).getEntityName();
			int xCoord = (int) allEntities.get(i).posX;
			int yCoord = (int) allEntities.get(i).posY;
			int zCoord = (int) allEntities.get(i).posZ;

			par2List.add(entityName + "," + xCoord + "," + yCoord + "," + zCoord);
		}
	}
	par2List.add("====================");
}
/**
 * Saves the list input as a .epd file (entity position data).
 * Also clears the list once it's done writing to the file.
 * @param par1List
 */
public void saveEntityData(List<String> par1List, MinecraftServer par2MinecraftServer)
{
	  FileWriter fstream;
	try
	{
		File init = new File(FMLClientHandler.instance().getClient().getMinecraftDir() + "\\mods\\TimeMod\\past\\EntityLocations\\" + par2MinecraftServer.getWorldName());
		if(!init.exists())
		{
			init.mkdirs();
		}
		int fNumbers = new File(FMLClientHandler.instance().getClient().getMinecraftDir(), "\\mods\\TimeMod\\past\\EntityLocations\\" + par2MinecraftServer.getWorldName()).listFiles().length + 1;

		String time = "Time ";
		time = time.concat(String.format("%03d",fNumbers));
		fstream = new FileWriter(FMLClientHandler.instance().getClient().getMinecraftDir() + "\\mods\\TimeMod\\past\\EntityLocations\\" + par2MinecraftServer.getWorldName() + "\\" + time + ".epd");

		BufferedWriter out = new BufferedWriter(fstream);
		for(int i = 0; i < par1List.size(); i++)
		{
			out.write(par1List.get(i));
			out.newLine();

		}
		out.flush();
		out.close();
		par1List.clear();
	}
	catch (IOException e)
	{
		e.printStackTrace();
	}

}

/**
 * Saves the first timezone when world is created
 * @param ms
 */
public void firstTime(MinecraftServer ms, Minecraft minecraft)
{
	if(ClientMethods.isSinglePlayer())
	{
		CopyFile cf = new CopyFile();
	    File beginningOfWorld = new File(minecraft.getMinecraftDir() + "/mods/TimeMod/present/" + ms.getWorldName());
	    
	    if(beginningOfWorld.length() == 0)
	    {
	    	File initWorldGen = new File(minecraft.getMinecraftDir() + "/mods/TimeMod/past/" + ms.getWorldName());
	    	initWorldGen.mkdirs();
	        File fi = new File(minecraft.getMinecraftDir() + "/saves/" + ms.getWorldName() + "/region");
	        File moveTo = new File(minecraft.getMinecraftDir() + "/mods/TimeMod/past/" + ms.getWorldName() + "/Time 001");
	        try
	        {
	            cf.copyDirectory(fi, moveTo);
	        }
	        catch(IOException ex)
	        {
	        	ex.printStackTrace();
	        }
	    }

	}
}
/**
 * Creates a Past Timezone
 * @param ms
 * @param minecraft
 * @param cf
 * 
 */
public void saveTime(MinecraftServer ms, Minecraft minecraft, CopyFile cf)
{
	if(ClientMethods.isSinglePlayer())
	{
		WorldInfo we = minecraft.theWorld.getWorldInfo();
		   
		File fil = new File(minecraft.getMinecraftDir(), "mods/TimeMod/past/" + ms.getWorldName());
		   
		if(!fil.exists())
		{
			fil.mkdir();
		}
		int counter = new File(minecraft.getMinecraftDir(), "mods/TimeMod/past/" + ms.getWorldName()).listFiles().length + 1;
	    //int counter = counterstart - 1;

	    try
		{
			WorldInfo worldinfo = minecraft.theWorld.getWorldInfo();
		  
			File fi = new File(minecraft.getMinecraftDir() + "\\saves\\" + ms.getWorldName() + "\\region");
			File f2 = new File (minecraft.getMinecraftDir() + "\\mods\\TimeMod\\past\\" + ms.getWorldName());
			f2.mkdir();

			String fname = minecraft.getMinecraftDir() + "\\mods\\TimeMod\\past\\" + ms.getWorldName() + "\\Time ";
			//counter = counter + 1;
			fname = fname.concat(String.format("%03d",counter));
		          
			File directoryToMoveTo = new File(fname);
		                		   
			cf.copyDirectory(fi, directoryToMoveTo);
		          
			System.out.println("Created a time!");       
			//File destination = new File(Minecraft.getMinecraftDir(), "mods/TimeMod/past");
			//File zipped = new File(Minecraft.getMinecraftDir(), "mods/TimeMod/past/w1.zip");
		           
			// copyfiletime.unzip(zipped, destination);  
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}

	}
}
/**
 * Return the player to the present from past.
 * @param minecraft
 * @param paradoxLevel
 * @param ms
 * @param minutes
 * @param seconds
 */
public void returnToPresent(Minecraft minecraft, int paradoxLevel, MinecraftServer ms)
{
	if(ClientMethods.isSinglePlayer())
	{
		String worldName = ms.getWorldName();
		String folderName = ms.getFolderName();
		WorldClient worldClient = minecraft.theWorld;
		GuiTimeTravel gtt = new GuiTimeTravel();
		EntityPlayer ep = minecraft.thePlayer;
		ep.setDead();

		paradoxLevel = 0;


        minecraft.statFileWriter.readStat(StatList.leaveGameStat, 1);
        minecraft.theWorld.sendQuittingDisconnectingPacket();
        minecraft.loadWorld((WorldClient)null);
        //minecraft.displayGuiScreen(new GuiMainMenu());
        
        
        File present = new File(minecraft.getMinecraftDir() + "/mods/TimeMod/present/" + ms.getWorldName());
        File worldFileDest = GuiTimeTravel.staticsource;
        File worldFile = new File(minecraft.getMinecraftDir() + "/saves/" + ms.getWorldName() + "/region");
        
        System.out.println(present);
        System.out.println(worldFileDest);
        System.out.println(worldFile);
        try {
            if (minecraft.getSaveLoader().canLoadWorld(worldName))
            { 	
	        	Thread.sleep(3000);
	        	CopyFile.moveMultipleFiles(worldFile, worldFileDest);
	            Thread.sleep(2000);
	        	CopyFile.moveMultipleFiles(present, worldFile);
	            gtt.isInPast = false;
	            ServerTickHandler.minutes = 1;
	            ServerTickHandler.seconds = 10;
			    paradoxLevel = 0;
		        minecraft.launchIntegratedServer(folderName, worldName, (WorldSettings)null);
            }
            else
            {
            	System.out.println("COULD NOT LOAD WORLD!  ");
            }

        }
        catch (Exception ex) {
        	ex.printStackTrace();
        }
	}
}
/**
 * Draws the time left button
 * @param minecraft
 * @param text
 */
public void drawTimeTicker(Minecraft minecraft, String text)
{
	GuiButton button = new GuiButton(0,0,5, text);
	button.drawButton(minecraft,0,0);
}
/**
 * Player ran out of time in the past, sends player to present
 * @param minecraft
 * @param ms
 * @param minutes
 * @param seconds
 * @param text
 */
public void outOfTime(Minecraft minecraft, MinecraftServer ms, String text)
{
	if(ClientMethods.isSinglePlayer())
	{
		GuiTimeTravel gtt = new GuiTimeTravel();
		WorldClient worldClient = minecraft.theWorld;
		String worldName = ms.getWorldName();
		String folderName = ms.getFolderName();

	    minecraft.theWorld.sendQuittingDisconnectingPacket();
	    minecraft.loadWorld((WorldClient)null);
	    minecraft.displayGuiScreen(new GuiMainMenu());
	           
	    File present = new File(minecraft.getMinecraftDir() + "/mods/TimeMod/present/" + ms.getWorldName());
	    File worldFileDest = GuiTimeTravel.staticsource;
	    File worldFile = new File(minecraft.getMinecraftDir() + "/saves/" + ms.getWorldName() + "/region");
	    
	    try 
	    {
	        if (minecraft.getSaveLoader().canLoadWorld(worldName))
	        {
			    Thread.sleep(3000);
			    CopyFile.moveMultipleFiles(worldFile, worldFileDest);
			    Thread.sleep(1000);
			    CopyFile.moveMultipleFiles(present, worldFile);
			    gtt.isInPast = false;
			    ServerTickHandler.minutes = 1;
			    ServerTickHandler.seconds = 10;
			    minecraft.launchIntegratedServer(folderName, worldName, (WorldSettings)null);
		        //minecraft.loadWorld(worldClient);
            }
	    }  
	    catch (Exception ex)
	    {
	    	ex.printStackTrace();
		}	
	}
}
}

 

 

And the error report:

 

 

2013-08-02 12:32:53 [iNFO] [ForgeModLoader] Forge Mod Loader version 5.2.12.712 for Minecraft 1.5.2 loading
2013-08-02 12:32:53 [iNFO] [ForgeModLoader] Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_09, running on Windows 7:amd64:6.1, installed at C:\Users\Will\Desktop\eclipse-jee-juno-SR2-win32-x86_64\eclipse\jre
2013-08-02 12:32:53 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
2013-08-02 12:32:56 [iNFO] [sTDOUT] 229 recipes
2013-08-02 12:32:56 [iNFO] [sTDOUT] 27 achievements
2013-08-02 12:32:56 [iNFO] [Minecraft-Client] Setting user: Player748
2013-08-02 12:32:56 [iNFO] [sTDOUT] (Session ID is -)
2013-08-02 12:32:56 [iNFO] [sTDERR] Client asked for parameter: server
2013-08-02 12:32:56 [iNFO] [Minecraft-Client] LWJGL Version: 2.4.2
2013-08-02 12:32:56 [iNFO] [MinecraftForge] Attempting early MinecraftForge initialization
2013-08-02 12:32:56 [iNFO] [sTDOUT] MinecraftForge v7.8.0.712 Initialized
2013-08-02 12:32:56 [iNFO] [ForgeModLoader] MinecraftForge v7.8.0.712 Initialized
2013-08-02 12:32:56 [iNFO] [sTDOUT] Replaced 85 ore recipies
2013-08-02 12:32:57 [iNFO] [MinecraftForge] Completed early MinecraftForge initialization
2013-08-02 12:32:57 [iNFO] [ForgeModLoader] Reading custom logging properties from C:\Users\Will\Desktop\minecraftforge-src-1.5.2-7.8.0.712 - TimeTraveler\forge\mcp\jars\config\logging.properties
2013-08-02 12:32:57 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL
2013-08-02 12:32:57 [iNFO] [ForgeModLoader] Searching C:\Users\Will\Desktop\minecraftforge-src-1.5.2-7.8.0.712 - TimeTraveler\forge\mcp\jars\mods for mods
2013-08-02 12:32:58 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load
2013-08-02 12:32:58 [iNFO] [mcp] Activating mod mcp
2013-08-02 12:32:58 [iNFO] [FML] Activating mod FML
2013-08-02 12:32:58 [iNFO] [Forge] Activating mod Forge
2013-08-02 12:32:58 [iNFO] [Charsmud_TimeTraveler] Activating mod Charsmud_TimeTraveler
2013-08-02 12:32:58 [iNFO] [ForgeModLoader] Registering Forge Packet Handler
2013-08-02 12:32:58 [iNFO] [ForgeModLoader] Succeeded registering Forge Packet Handler
2013-08-02 12:32:58 [iNFO] [ForgeModLoader] Configured a dormant chunk cache size of 0
2013-08-02 12:32:59 [iNFO] [sTDOUT] https://dl.dropboxusercontent.com/u/85284082/cape.txt
2013-08-02 12:32:59 [iNFO] [sTDOUT] https://dl.dropboxusercontent.com/u/85284082/TimeTravelerCapeC.png
2013-08-02 12:32:59 [iNFO] [sTDOUT] https://dl.dropboxusercontent.com/u/85284082/TimeTravelerCapeA.png
2013-08-02 12:32:59 [iNFO] [sTDOUT] https://dl.dropboxusercontent.com/u/85284082/TimeTravelerCapeB.png
2013-08-02 12:32:59 [iNFO] [sTDOUT] https://dl.dropboxusercontent.com/u/85284082/TimeTravelerCapeD.png
2013-08-02 12:32:59 [iNFO] [sTDOUT] https://dl.dropboxusercontent.com/u/85284082/TimeTravelerCapeE.png
2013-08-02 12:33:00 [iNFO] [sTDOUT] 
2013-08-02 12:33:00 [iNFO] [sTDOUT] Starting up SoundSystem...
2013-08-02 12:33:00 [iNFO] [sTDOUT] Initializing LWJGL OpenAL
2013-08-02 12:33:00 [iNFO] [sTDOUT]     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
2013-08-02 12:33:00 [iNFO] [sTDOUT] OpenAL initialized.
2013-08-02 12:33:00 [iNFO] [sTDOUT] 
2013-08-02 12:33:01 [iNFO] [ForgeModLoader] Forge Mod Loader has detected an older LWJGL version, new advanced texture animation features are disabled
2013-08-02 12:33:01 [iNFO] [ForgeModLoader] Not using advanced OpenGL 4.3 advanced capability for animations : OpenGL 4.3 is not available
2013-08-02 12:33:01 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava_flow.txt
2013-08-02 12:33:01 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water_flow.txt
2013-08-02 12:33:01 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_0.txt
2013-08-02 12:33:01 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_1.txt
2013-08-02 12:33:01 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava.txt
2013-08-02 12:33:01 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/portal.txt
2013-08-02 12:33:01 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water.txt
2013-08-02 12:33:02 [iNFO] [Minecraft-Client] Found animation info for: textures/items/clock.txt
2013-08-02 12:33:02 [iNFO] [Minecraft-Client] Found animation info for: textures/items/compass.txt
2013-08-02 12:33:02 [iNFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 4 mods
2013-08-02 12:33:03 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava_flow.txt
2013-08-02 12:33:03 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water_flow.txt
2013-08-02 12:33:03 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/BLockParadoxCondenserFront.txt
2013-08-02 12:33:03 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/BlockParadoxCondenserBack.txt
2013-08-02 12:33:03 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/BlockParadoxCondenserBot.txt
2013-08-02 12:33:03 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/BlockParadoxCondenserSide.txt
2013-08-02 12:33:03 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_0.txt
2013-08-02 12:33:03 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_1.txt
2013-08-02 12:33:03 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/lava.txt
2013-08-02 12:33:03 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/portal.txt
2013-08-02 12:33:03 [iNFO] [Minecraft-Client] Found animation info for: textures/blocks/water.txt
2013-08-02 12:33:04 [iNFO] [Minecraft-Client] Found animation info for: textures/items/clock.txt
2013-08-02 12:33:04 [iNFO] [Minecraft-Client] Found animation info for: textures/items/compass.txt
2013-08-02 12:33:07 [iNFO] [Minecraft-Server] Starting integrated minecraft server version 1.5.2
2013-08-02 12:33:07 [iNFO] [Minecraft-Server] Generating keypair
2013-08-02 12:33:07 [iNFO] [ForgeModLoader] Loading dimension 0 (ang) (net.minecraft.server.integrated.IntegratedServer@5e0948f1)
2013-08-02 12:33:07 [iNFO] [ForgeModLoader] Loading dimension 1 (ang) (net.minecraft.server.integrated.IntegratedServer@5e0948f1)
2013-08-02 12:33:07 [iNFO] [ForgeModLoader] Loading dimension -1 (ang) (net.minecraft.server.integrated.IntegratedServer@5e0948f1)
2013-08-02 12:33:07 [iNFO] [Minecraft-Server] Preparing start region for level 0
2013-08-02 12:33:08 [iNFO] [sTDOUT] loading single player
2013-08-02 12:33:08 [iNFO] [Minecraft-Server] Player748[/127.0.0.1:0] logged in with entity id 280 at (-279.69999998807907, 71.0, 219.30000001192093)
2013-08-02 12:33:08 [iNFO] [MinecraftForge] Attempting early MinecraftForge initialization
2013-08-02 12:33:08 [iNFO] [sTDOUT] MinecraftForge v7.8.0.712 Initialized
2013-08-02 12:33:08 [iNFO] [ForgeModLoader] MinecraftForge v7.8.0.712 Initialized
2013-08-02 12:33:08 [iNFO] [MinecraftForge] Completed early MinecraftForge initialization
2013-08-02 12:33:08 [iNFO] [sTDOUT] 
2013-08-02 12:33:08 [iNFO] [sTDOUT] Time Remaining: 1 Minute, 10 Seconds
2013-08-02 12:33:08 [iNFO] [sTDOUT] 0
2013-08-02 12:33:08 [iNFO] [sTDOUT] Time Remaining: 1 Minute, 10 Seconds
2013-08-02 12:33:08 [iNFO] [sTDOUT] 0
2013-08-02 12:33:08 [iNFO] [sTDERR] net.minecraft.util.ReportedException: Ticking player
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:60)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:675)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:571)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:469)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-08-02 12:33:08 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at timeTraveler.mechanics.PastMechanics.firstTime(PastMechanics.java:129)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at timeTraveler.ticker.ServerTickHandler.onServerTick(ServerTickHandler.java:140)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at timeTraveler.ticker.ServerTickHandler.tickStart(ServerTickHandler.java:549)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at cpw.mods.fml.common.SingleIntervalHandler.tickStart(SingleIntervalHandler.java:28)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at cpw.mods.fml.common.FMLCommonHandler.tickStart(FMLCommonHandler.java:122)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:383)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:279)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:326)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.handleFlying(NetServerHandler.java:308)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.network.packet.Packet10Flying.processPacket(Packet10Flying.java:51)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:134)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:53)
2013-08-02 12:33:08 [iNFO] [sTDERR] 	... 6 more
2013-08-02 12:33:08 [sEVERE] [Minecraft-Server] Encountered an unexpected exception ReportedException
net.minecraft.util.ReportedException: Ticking player
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:60)
at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:675)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:571)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:469)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.NullPointerException
at timeTraveler.mechanics.PastMechanics.firstTime(PastMechanics.java:129)
at timeTraveler.ticker.ServerTickHandler.onServerTick(ServerTickHandler.java:140)
at timeTraveler.ticker.ServerTickHandler.tickStart(ServerTickHandler.java:549)
at cpw.mods.fml.common.SingleIntervalHandler.tickStart(SingleIntervalHandler.java:28)
at cpw.mods.fml.common.FMLCommonHandler.tickStart(FMLCommonHandler.java:122)
at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:383)
at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:279)
at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:326)
at net.minecraft.network.NetServerHandler.handleFlying(NetServerHandler.java:308)
at net.minecraft.network.packet.Packet10Flying.processPacket(Packet10Flying.java:51)
at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:134)
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:53)
... 6 more
2013-08-02 12:33:08 [sEVERE] [Minecraft-Server] This crash report has been saved to: C:\Users\Will\Desktop\minecraftforge-src-1.5.2-7.8.0.712 - TimeTraveler\forge\mcp\jars\.\crash-reports\crash-2013-08-02_12.33.08-server.txt
2013-08-02 12:33:08 [iNFO] [Minecraft-Server] Stopping server
2013-08-02 12:33:08 [iNFO] [Minecraft-Server] Saving players
2013-08-02 12:33:08 [iNFO] [Minecraft-Server] Saving worlds
2013-08-02 12:33:08 [iNFO] [Minecraft-Server] Saving chunks for level 'ang'/Overworld
2013-08-02 12:33:08 [iNFO] [Minecraft-Server] Saving chunks for level 'ang'/Nether
2013-08-02 12:33:08 [iNFO] [Minecraft-Server] Saving chunks for level 'ang'/The End
2013-08-02 12:33:09 [iNFO] [ForgeModLoader] Unloading dimension 0
2013-08-02 12:33:09 [iNFO] [ForgeModLoader] Unloading dimension -1
2013-08-02 12:33:09 [iNFO] [ForgeModLoader] Unloading dimension 1
2013-08-02 12:33:09 [sEVERE] [ForgeModLoader] Fatal errors were detected during the transition from SERVER_STARTED to SERVER_STOPPED. Loading cannot continue
2013-08-02 12:33:09 [sEVERE] [ForgeModLoader] 
mcp{7.44} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
FML{5.2.12.712} [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
Forge{7.8.0.712} [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
Charsmud_TimeTraveler{0.1} [Time Traveler] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
2013-08-02 12:33:09 [sEVERE] [ForgeModLoader] The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base classForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside ofForgeModLoader, especially Optifine, to see if there are fixes available.
2013-08-02 12:33:09 [iNFO] [sTDERR] Exception in thread "Server thread" java.lang.RuntimeException: The ForgeModLoader state engine is invalid
2013-08-02 12:33:09 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.transition(LoadController.java:134)
2013-08-02 12:33:09 [iNFO] [sTDERR] 	at cpw.mods.fml.common.Loader.serverStopped(Loader.java:800)
2013-08-02 12:33:09 [iNFO] [sTDERR] 	at cpw.mods.fml.common.FMLCommonHandler.handleServerStopped(FMLCommonHandler.java:468)
2013-08-02 12:33:09 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:531)
2013-08-02 12:33:09 [iNFO] [sTDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-08-02 12:33:18 [iNFO] [Minecraft-Client] Stopping!
2013-08-02 12:33:19 [iNFO] [sTDOUT] 
2013-08-02 12:33:19 [iNFO] [sTDOUT] SoundSystem shutting down...
2013-08-02 12:33:19 [iNFO] [sTDOUT]     Author: Paul Lamb, www.paulscode.com
2013-08-02 12:33:19 [iNFO] [sTDOUT] 

 

 

Any ideas?

Link to comment
Share on other sites

This is line 129:

 

		    File beginningOfWorld = new File(minecraft.getMinecraftDir() + "/mods/TimeMod/present/" + ms.getWorldName());

 

I'm fairly confident it's because ms is null, but I have no idea how to fix it.  I tried if(ms != null) but that just crashed.  :P

Link to comment
Share on other sites

does this happen in game or before ? like on startup, becuase if its on startup that might make sens as the server/world isnt generated yet

 

 

also

private void onServerTick(MinecraftServer server, Minecraft mc)
    {
    	if(FMLServerHandler.instance().getServer() != null || mc.theWorld != null)
    	{

 

cant you send FMLServerHandler.instance().getServer() to the method instead ? cuz that you know isnt null

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

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

It happens with I load a world.  I tried changing the line to this:

 

 

		    File beginningOfWorld = new File(minecraft.getMinecraftDir() + "/mods/TimeMod/present/" + FMLServerHandler.instance().getServer().getWorldName());

 

 

But I got the same crash.

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • https://mclo.gs/4UC49Ao
    • Way back in the Forge 1.17 days, work started for adding JPMS (Java Platform Module Support) to ModLauncher and ForgeModLoader. This has been used internally by Forge and some libraries for a while now, but mods (those with mods.toml specifically) have not been able to take advantage of it. As of Forge 1.21.1 and 1.21.3, this is now possible!   What is JPMS and what does it mean for modders? JPMS is the Java Platform Module System, introduced in Java 9. It allows you to define modules, which are collections of packages and resources that can be exported or hidden from other modules. This allows for much more fine-tuned control over visibility, cleaner syntax for service declarations and support for sealed types across packages. For example, you might have a mod with a module called `com.example.mod` that exports `com.example.mod.api` and `com.example.mod.impl` to other mods, but hides `com.example.mod.internal` from them. This would allow you to have a clean API for other mods to use, while keeping your internal implementation details hidden from IDE hints, helping prevent accidental usage of internals that might break without prior notice. This is particularly useful if you'd like to use public records with module-private constructors or partially module-private record components, as you can create a sealed interface that only your record implements, having the interface be exported and the record hidden. It's also nice for declaring and using services, as you'll get compile-time errors from the Java compiler for typos and the like, rather than deferring to runtime errors. In more advanced cases, you can also have public methods that are only accessible to specific other modules -- handy if you want internal interactions between multiple of your own mods.   How do I bypass it? We understand there may be drama in implementing a system that prevents mods from accessing each other's internals when necessary (like when a mod is abandoned or you need to fix a compat issue) -- after all, we are already modding a game that doesn't have explicit support for Java mods yet. We have already thought of this and are offering APIs from day one to selectively bypass module restrictions. Let me be clear: Forge mods are not required to use JPMS. If you don't want to use it, you don't have to. The default behaviour is to have fully open, fully exported automatic modules. In Java, you can use the `Add-Opens` and `Add-Exports` manifest attributes to selectively bypass module restrictions of other mods at launch time, and we've added explicit support for these when loading your Forge mods. At compile-time, you can use existing solutions such as the extra-java-module-info Gradle plugin to deal with non-modular dependencies and add extra opens and exports to other modules. Here's an example on how to make the internal package `com.example.examplemod.internal` open to your mod in your build.gradle: tasks.named('jar', Jar) { manifest { attributes([ 'Add-Opens' : 'com.example.examplemod/com.example.examplemod.internal' 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors // (...) ]) } } With the above in your mod's jar manifest, you can now reflectively access the classes inside that internal package. Multiple entries are separated with a space, as per Java's official spec. You can also use Add-Exports to directly call without reflection, however you'd need to use the Gradle plugin mentioned earlier to be able to compile. The syntax for Add-Exports is the same as Add-Opens, and instructions for the compile-time step with the Gradle plugin are detailed later in this post. Remember to prefer the opens and exports keywords inside module-info.java for sources you control. The Add-Opens/Add-Exports attributes are only intended for forcing open other mods.   What else is new with module support? Previously, the runtime module name was always forced to the first mod ID in your `mods.toml` file and all packages were forced fully open and exported. Module names are now distinguished from mod IDs, meaning the module name in your module-info.java can be different from the mod ID in your `mods.toml`. This allows you to have a more descriptive module name that doesn't have to be the same as your mod ID, however we strongly recommend including your mod ID as part of your module name to aid troubleshooting. The `Automatic-Module-Name` manifest attribute is now also honoured, allowing you to specify a module name for your mod without needing to create a `module-info.java` file. This is particularly useful for mods that don't care about JPMS features but want to have a more descriptive module name and easier integration with other mods that do use JPMS.   How do I use it? The first step is to create a `module-info.java` file in your mod's source directory. This file should be in the same package as your main mod class, and should look something like this: open module com.example.examplemod { requires net.minecraftforge.eventbus; requires net.minecraftforge.fmlcore; requires net.minecraftforge.forge; requires net.minecraftforge.javafmlmod; requires net.minecraftforge.mergetool.api; requires org.slf4j; requires logging; } For now, we're leaving the whole module open to reflection, which is a good starting point. When we know we want to close something off, we can remove the open modifier from the module and open or export individual packages instead. Remember that you need to be open to Forge (module name net.minecraftforge.forge), otherwise it can't call your mod's constructor. Next is fixing modules in Gradle. While Forge and Java support modules properly, Gradle does not put automatic modules on the module path by default, meaning that the logging module (from com.mojang:logging) is not found. To fix this, add the Gradle plugin and add a compile-time module definition for that Mojang library: plugins { // (...) id 'org.gradlex.extra-java-module-info' version "1.9" } // (...) extraJavaModuleInfo { failOnMissingModuleInfo = false automaticModule("com.mojang:logging", "logging") } The automatic module override specified in your build.gradle should match the runtime one to avoid errors. You can do the same for any library or mod dependency that is missing either a module-info or explicit Automatic-Module-Name, however be aware that you may need to update your mod once said library adds one. That's all you need to get started with module support in your mods. You can learn more about modules and how to use them at dev.java.
    • Faire la mise à jour grâce à ce lien m'a aider personnellement, merci à @Paint_Ninja. https://www.amd.com/en/support 
    • When I came across the 'Exit Code: I got a 1 error in my Minecraft mods, so I decided to figure out what was wrong. First, I took a look at the logs. In the mods folder (usually where you'd find logs or crash reports), I found the latest.log file or the corresponding crash report. I read it through carefully, looking for any lines with errors or warnings. Then I checked the Minecraft Forge support site, where you can often find info on what causes errors and how to fix them. I then disabled half of my mods and tried running the game. If the error disappeared, it meant that the problem was with the disabled mod. I repeated this several times to find the problem mod.
    • I have no idea - switch to a pre-configured modpack and use it as working base    
  • Topics

×
×
  • Create New...

Important Information

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