@Command( aliases = {"/getlighting"}, desc = "Get the light at a position", min = 0, max = 0) @CommandPermissions("worldedit.light.fix") public void getlighting(Player player, EditSession editSession) throws WorldEditException { FawePlayer fp = FawePlayer.wrap(player); final FaweLocation loc = fp.getLocation(); FaweQueue queue = SetQueue.IMP.getNewQueue(loc.world, true, false); fp.sendMessage( "Light: " + queue.getEmmittedLight(loc.x, loc.y, loc.z) + " | " + queue.getSkyLight(loc.x, loc.y, loc.z)); }
@Command( aliases = {"/set"}, usage = "[pattern]", desc = "Set all blocks within selection", min = 1, max = 1) @CommandPermissions("worldedit.region.set") @Logging(REGION) public void set( Player player, EditSession editSession, LocalSession session, @Selection Region selection, Pattern to) throws WorldEditException { if (selection instanceof CuboidRegion && editSession.hasFastMode() && to instanceof BlockPattern) { try { CuboidRegion cuboid = (CuboidRegion) selection; RegionWrapper current = new RegionWrapper(cuboid.getMinimumPoint(), cuboid.getMaximumPoint()); BaseBlock block = ((BlockPattern) to).getBlock(); final FaweQueue queue = editSession.getQueue(); final int minY = cuboid.getMinimumY(); final int maxY = cuboid.getMaximumY(); final int id = block.getId(); final byte data = (byte) block.getData(); final FaweChunk<?> fc = queue.getFaweChunk(0, 0); fc.fillCuboid(0, 15, minY, maxY, 0, 15, id, data); fc.optimize(); int bcx = (current.minX) >> 4; int bcz = (current.minZ) >> 4; int tcx = (current.maxX) >> 4; int tcz = (current.maxZ) >> 4; // [chunkx, chunkz, pos1x, pos1z, pos2x, pos2z, isedge] MainUtil.chunkTaskSync( current, new RunnableVal<int[]>() { @Override public void run(int[] value) { FaweChunk newChunk; if (value[6] == 0) { newChunk = fc.copy(true); newChunk.setLoc(queue, value[0], value[1]); } else { int bx = value[2] & 15; int tx = value[4] & 15; int bz = value[3] & 15; int tz = value[5] & 15; if (bx == 0 && tx == 15 && bz == 0 && tz == 15) { newChunk = fc.copy(true); newChunk.setLoc(queue, value[0], value[1]); } else { newChunk = queue.getFaweChunk(value[0], value[1]); newChunk.fillCuboid( value[2] & 15, value[4] & 15, minY, maxY, value[3] & 15, value[5] & 15, id, data); } } newChunk.addToQueue(); } }); queue.enqueue(); long start = System.currentTimeMillis(); BBC.OPERATION.send(player, BBC.VISITOR_BLOCK.format(cuboid.getArea())); queue.flush(); BBC.ACTION_COMPLETE.send(player, (System.currentTimeMillis() - start) / 1000d); return; } catch (Throwable e) { MainUtil.handleError(e); } } int affected = editSession.setBlocks(selection, Patterns.wrap(to)); BBC.OPERATION.send(player, affected); }
public MCAExtent(World world, FaweQueue queue) { super(world); this.queue = queue; this.folder = new File(queue.getSaveFolder(), "regions"); this.regions = new HashMap<>(); }