public static Location listTagsToLocation(World world,CompoundTag tag){
  if (tag.isList("Pos",TagType.DOUBLE)) {
    List<Double> pos=tag.getList("Pos",TagType.DOUBLE);
    if (pos.size() == 3) {
      Location location=new Location(world,pos.get(0),pos.get(1),pos.get(2));
      if (tag.isList("Rotation",TagType.FLOAT)) {
        List<Float> rot=tag.getList("Rotation",TagType.FLOAT);
        if (rot.size() == 2) {
          location.setYaw(rot.get(0));
          location.setPitch(rot.get(1));
        }
      }
      return location;
    }
  }
  return null;
}

public static Location listTagsToLocation ( World world , CompoundTag tag ) { if ( tag . isList ( "Pos" , TagType . DOUBLE ) ) { List < Double > pos = tag . getList ( "Pos" , TagType . DOUBLE ) ; if ( pos . size ( ) == 3 ) { Location location = new Location ( world , pos . get ( 0 ) , pos . get ( 1 ) , pos . get ( 2 ) ) ; if ( tag . isList ( "Rotation" , TagType . FLOAT ) ) { List < Float > rot = tag . getList ( "Rotation" , TagType . FLOAT ) ; if ( rot . size ( ) == 2 ) { location . setYaw ( rot . get ( 0 ) ) ; location . setPitch ( rot . get ( 1 ) ) ; } } return location ; } } return null ; }
read a location from the " pos " and " rotation " children of a tag . if " pos " is absent or invalid , null is returned . if " rotation " is absent or invalid , it is skipped and a location without rotation is returned .
