Java Code Examples for net.minecraft.world.World#getLoadedEntityList()

The following examples show how to use net.minecraft.world.World#getLoadedEntityList() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
public void killChaosMonkeys() {
	World world = sender.getEntityWorld();
	int numberOfMonkeys = 0;
	for (Entity entity : world.getLoadedEntityList()) {
		if (entity instanceof EntityChaosMonkey) {
			entity.setDead();
			numberOfMonkeys++;
		}
	}

	if (numberOfMonkeys == 0) {
		sendErrorMessage("There are no Chaos Monkeys in this world!");
	} else if (numberOfMonkeys == 1) {
		sendConfirmMessage("Killed 1 Chaos Monkey.");
	} else {
		sendConfirmMessage("Killed " + numberOfMonkeys + " Chaos Monkeys.");
	}
}
 
Example 2
public static void removeTrackedEntities(World world, int x, int y, int z) {
    ChunkCoordinates cc = new ChunkCoordinates(x, y, z);
    if(trackedEntities.containsKey(cc)) {
        for (AffectedEntity ae : trackedEntities.get(cc)) {
            for (Object objE : world.getLoadedEntityList()) {
                if(objE != null && objE instanceof EntityLiving &&
                        !((EntityLiving) objE).isDead &&
                        ((EntityLiving) objE).getUniqueID().equals(ae.eUUID)) {
                    ((EntityLiving) objE).tasks.taskEntries = ae.tasks;
                    ((EntityLiving) objE).targetTasks.taskEntries = ae.targetTasks;
                    injEntityLivingBase.setObject(objE);
                    injEntityLivingBase.setField("ignoreCollisions", false);
                    injEntityLivingBase.setObject(null);
                }
            }
        }
        trackedEntities.remove(new ChunkCoordinates(x, y, z));
    }
}