@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 = {"/fixlighting"}, desc = "Get the light at a position", min = 0, max = 0) @CommandPermissions("worldedit.light.fix") public void fixlighting(Player player, EditSession editSession) throws WorldEditException { FawePlayer fp = FawePlayer.wrap(player); final FaweLocation loc = fp.getLocation(); Region selection = fp.getSelection(); if (selection == null) { final int cx = loc.x >> 4; final int cz = loc.z >> 4; selection = new CuboidRegion( new Vector(cx - 8, 0, cz - 8).multiply(16), new Vector(cx + 8, 0, cz + 8).multiply(16)); } int count = FaweAPI.fixLighting(loc.world, selection, FaweQueue.RelightMode.ALL); BBC.LIGHTING_PROPOGATE_SELECTION.send(fp, count); }
@Command( aliases = {"/removelight", "/removelighting"}, desc = "Removing lighting in a selection", min = 0, max = 0) @CommandPermissions("worldedit.light.remove") public void removelighting(Player player, EditSession editSession) { FawePlayer fp = FawePlayer.wrap(player); final FaweLocation loc = fp.getLocation(); Region selection = fp.getSelection(); if (selection == null) { final int cx = loc.x >> 4; final int cz = loc.z >> 4; selection = new CuboidRegion( new Vector(cx - 8, 0, cz - 8).multiply(16), new Vector(cx + 8, 0, cz + 8).multiply(16)); } int count = FaweAPI.fixLighting(loc.world, selection, FaweQueue.RelightMode.NONE); BBC.UPDATED_LIGHTING_SELECTION.send(fp, count); }
@Command( aliases = {"/setskylight"}, desc = "Set sky lighting in a selection", min = 1, max = 1) @CommandPermissions("worldedit.light.set") public void setskylighting( Player player, EditSession editSession, @Selection Region region, int value) { FawePlayer fp = FawePlayer.wrap(player); final FaweLocation loc = fp.getLocation(); final int cx = loc.x >> 4; final int cz = loc.z >> 4; final NMSMappedFaweQueue queue = (NMSMappedFaweQueue) SetQueue.IMP.getNewQueue(fp.getWorld(), true, false); for (Vector pt : region) { queue.setSkyLight((int) pt.x, (int) pt.y, (int) pt.z, value); } int count = 0; for (Vector2D chunk : region.getChunks()) { queue.sendChunk(queue.getFaweChunk(chunk.getBlockX(), chunk.getBlockZ())); count++; } BBC.UPDATED_LIGHTING_SELECTION.send(fp, count); }