Examples of CuboidRegion


Examples of com.sk89q.worldedit.regions.CuboidRegion

        Block distalBaseCenter = farSide.getRelative(face);
        if (!BlockUtil.areBlocksIdentical(distalBaseCenter, proximalBaseCenter))
            throw new InvalidMechanismException("mech.bridge.material");

        // Select the togglable region
        CuboidRegion toggle = getCuboidArea(trigger, proximalBaseCenter, distalBaseCenter);

        // this is kinda funky, but we only check one position
        // to see if the bridge is open and/or closable.
        // efficiency choice :/
        Block hinge = proximalBaseCenter.getRelative(SignUtil.getFacing(trigger));
View Full Code Here

Examples of com.sk89q.worldedit.regions.CuboidRegion

    @Override
    public void clear() {

        try {
            CuboidRegion region = new CuboidRegion(origin, origin.add(size.getX() - 1, size.getY() - 1,
                    size.getZ() - 1));
            EditSession editSession = new EditSession(new BukkitWorld(world), -1);
            editSession.enableQueue();
            editSession.setBlocks(region, new BaseBlock(0));
            editSession.flushQueue();
View Full Code Here

Examples of com.sk89q.worldedit.regions.CuboidRegion

        }
        if (!BlockUtil.areBlocksIdentical(distalBaseCenter, proximalBaseCenter))
            throw new InvalidMechanismException("mech.door.material");

        // Select the togglable region
        CuboidRegion toggle = getCuboidArea(trigger, proximalBaseCenter, distalBaseCenter);

        // this is kinda funky, but we only check one position
        // to see if the bridge is open and/or closable.
        // efficiency choice :/
        Block hinge;
View Full Code Here

Examples of com.sk89q.worldedit.regions.CuboidRegion

    }

    @Override
    public CuboidRegion getCuboidArea(Block trigger, Block proximalBaseCenter, Block distalBaseCenter) throws InvalidMechanismException {
        // Select the togglable region
        CuboidRegion toggle = new CuboidRegion(BukkitUtil.toVector(proximalBaseCenter), BukkitUtil.toVector(distalBaseCenter));
        ChangedSign sign = BukkitUtil.toChangedSign(trigger);
        int left, right;
        try {
            left = Math.max(0, Math.min(maxWidth, Integer.parseInt(sign.getLine(2))));
        } catch (Exception e) {
            left = 1;
        }
        try {
            right = Math.max(0, Math.min(maxWidth, Integer.parseInt(sign.getLine(3))));
        } catch (Exception e) {
            right = 1;
        }

        // Expand Left
        for (int i = 0; i < left; i++) {
            if(distalBaseCenter.getRelative(SignUtil.getLeft(trigger), i).getType() != proximalBaseCenter.getRelative(SignUtil.getLeft(trigger), i).getType() && distalBaseCenter.getRelative(SignUtil.getLeft(trigger), i).getData() != proximalBaseCenter.getRelative(SignUtil.getLeft(trigger), i).getData())
                throw new InvalidMechanismException("mech.door.material");
            toggle.expand(BukkitUtil.toVector(SignUtil.getLeft(trigger)), new Vector(0, 0, 0));
        }

        // Expand Right
        for (int i = 0; i < right; i++) {
            if(distalBaseCenter.getRelative(SignUtil.getRight(trigger), i).getType() != proximalBaseCenter.getRelative(SignUtil.getRight(trigger), i).getType() && distalBaseCenter.getRelative(SignUtil.getRight(trigger), i).getData() != proximalBaseCenter.getRelative(SignUtil.getRight(trigger), i).getData())
                throw new InvalidMechanismException("mech.door.material");
            toggle.expand(BukkitUtil.toVector(SignUtil.getRight(trigger)), new Vector(0, 0, 0));
        }

        // Don't toggle the end points
        toggle.contract(BukkitUtil.toVector(BlockFace.UP), BukkitUtil.toVector(BlockFace.DOWN));

        return toggle;
    }
View Full Code Here

Examples of com.sk89q.worldedit.regions.CuboidRegion

        if(sel!=null)
        {
            Location pos1 = sel.getMinimumPoint();
            Location pos2 = sel.getMaximumPoint();   
            try{
          CuboidRegion region = (CuboidRegion) sel.getRegionSelector().getRegion();
          pos1 = new Location(player.getWorld(), region.getPos1().getX(), region.getPos1().getY(), region.getPos1().getZ());
          pos2 = new Location(player.getWorld(), region.getPos2().getX(), region.getPos2().getY(), region.getPos2().getZ());
            }catch(Exception e){
            }
            this.playerLoc1.put(player.getName(), pos1);
            this.playerLoc2.put(player.getName(), pos2);
            return true;
View Full Code Here

Examples of org.mctourney.autoreferee.regions.CuboidRegion

    return dist;
  }

  public CuboidRegion getMapCuboid()
  {
    CuboidRegion cube = null;
    for (AutoRefRegion reg : getStartRegions())
      cube = AutoRefRegion.combine(cube, reg);

    for (AutoRefTeam team : getTeams())
      for (AutoRefRegion reg : team.getRegions())
View Full Code Here

Examples of org.mctourney.autoreferee.regions.CuboidRegion

    catch (IOException e) { e.printStackTrace(); }
  }

  public RenderedImage getMapImage() throws IOException
  {
    CuboidRegion cube = getMapCuboid();
    if (cube == null) throw new IOException("No start regions defined.");

    Location min = cube.getMinimumPoint(),
      max = cube.getMaximumPoint();

    return MapImageGenerator.generateFromWorld(getWorld(),
      min.getBlockX(), max.getBlockX(), min.getBlockZ(), max.getBlockZ());
  }
View Full Code Here

Examples of org.mctourney.autoreferee.regions.CuboidRegion

  { return null; }

  @Override
  public Location getTarget()
  {
    CuboidRegion cube = null;
    for (AutoRefRegion reg : this.regions)
      cube = AutoRefRegion.combine(cube, reg);
    return cube == null ? null : cube.getGroundedCenter();
  }
View Full Code Here

Examples of org.mctourney.autoreferee.regions.CuboidRegion

    AutoRefRegion reg = null;

    if ((sel instanceof CuboidSelection))
    {
      CuboidSelection csel = (CuboidSelection) sel;
      reg = new CuboidRegion(csel.getMinimumPoint(), csel.getMaximumPoint());
    }

    // if we couldn't get a region from WorldEdit
    if (reg == null) return false;
View Full Code Here

Examples of org.mctourney.autoreferee.regions.CuboidRegion

    AutoRefRegion reg = null;

    if ((sel instanceof CuboidSelection))
    {
      CuboidSelection csel = (CuboidSelection) sel;
      reg = new CuboidRegion(csel.getMinimumPoint(), csel.getMaximumPoint());
    }
    else
    {
      sender.sendMessage("You must have a selection with WorldEdit already to run this method.");
      return true;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.