Posted August 2, 201312 yr Hello! I am trying to spawn some mobs inside of my TickerClient. I have spawned entities using items before, but for some reason, I cannot get the mobs to spawn! At first, I thought it was because I was using WorldClient and not World, but even after switching to World instead of WorldClient, it still didn't work. Here's the related code: private void onTickInGame(Minecraft mc) { mc.theWorld.getGameRules().setOrCreateGameRule("doMobSpawning", "false"); File allEntityData = new File(mc.getMinecraftDir() + "/mods/TimeMod/past/EntityLocations/" + FMLClientHandler.instance().getServer().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(); } }
August 2, 201312 yr Author You can't spawn mobs on the client. How would I fix this? I have tried both WorldClient and World to no avail.... do I need a separate ticker for the server?
August 2, 201312 yr TickerClient should be server side everything you do that NOT ui is server side always how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
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.