Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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();
		} 		
}

  • 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?

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.