public synchronized int replaceAllByName(String name, JixelEntity entity) {
		if (entity == null) {
			JixelGame.getConsole().printErr(new NullPointerException("Can not set entity to null"));
			return -1;
		}
		int count = 0;
		synchronized (entityList) {
			for (int i = 0; i < entityList.size(); i++) {
				if (name == null && entity.getName() == null) {
					count++;
					entityList.set(i, entity);
				} else if (name.equals(entity.getName())) {
					count++;
					entityList.set(i, entity);
				}
			}
		}
		return count;
	}