@Override
 public boolean isValidLocation(
     World world,
     EntityLiving entity,
     int xCoord,
     int yCoord,
     int zCoord,
     TypeValuePair typeValuePair,
     HashMap<String, Object> valueCache) {
   boolean isInverted = (Boolean) typeValuePair.getValue();
   boolean canSpawn = entity.getCanSpawnHere();
   return isInverted ? canSpawn : !canSpawn;
 }
  @Override
  public boolean isValidLocation(
      World world,
      EntityLiving entity,
      int xCoord,
      int yCoord,
      int zCoord,
      TypeValuePair typeValuePair,
      HashMap<String, Object> valueCache) {
    Object[] values = (Object[]) typeValuePair.getValue();
    boolean isInverted = (Boolean) values[0];

    int randInt = (Integer) values[1];
    int randOffset = (Integer) values[2];
    int maximum = (Integer) values[3];

    boolean isValid = !(world.rand.nextInt(randInt) + randOffset <= maximum);
    return isInverted ? isValid : !isValid;
  }