Exemplo n.º 1
0
 @Override
 public List<CuboidRegion> parse(ParsingContext context) throws ModuleParsingException {
   String name = context.getElement().getAttributeValue("name");
   BlockRegion a =
       ParsingUtil.parse(
           name, context.getElement(), check(context.getElement().getAttributeValue("min")));
   BlockRegion b =
       ParsingUtil.parse(
           name, context.getElement(), check(context.getElement().getAttributeValue("max")));
   return Lists.newArrayList(new CuboidRegion(name, a, b));
 }
    @Override
    public List<IntersectRegion> parse(ParsingContext context) throws ModuleParsingException {
      String name = context.getElement().getAttributeValue("name");

      List<RegionModule> regions = new ArrayList<>();
      for (Element element : context.getElement().getChildren()) {
        regions.addAll(
            new RegionBuilder()
                .parse(element, new BuilderContext(BuildPhase.ANY).register(context.getMap())));
      }

      if (regions.size() < 2) {
        throw new ModuleParsingException(
            IntersectRegion.class, "IntersectRegions require at least 2 regions");
      }

      return Lists.newArrayList(new IntersectRegion(name, regions));
    }