mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-10 06:48:34 +00:00
Fix relight and removelight (#475)
* Start work on lighting engine (does not build) * Implement getLighting * Setting, flushing light etc works. Getting light should be working..? * Better queue/chunk handling * Use correct location for lighting update * Correct set location, remove debug * cleanup a little * Fix fixlight * Apply to all versions for the numpties * Remove lighting extent if not using * Actually bitmask blocks when setting in chunks * Initialise Maps and Dequeues with inital size * format * Documentation maybe
This commit is contained in:
@ -27,9 +27,11 @@ import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
|
||||
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
|
||||
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.RelightMode;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -139,16 +141,15 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.light.fix")
|
||||
public void fixLighting(Player player) throws WorldEditException {
|
||||
player.print(TextComponent.of("Temporarily not working"));
|
||||
// final Location loc = player.getLocation();
|
||||
// Region selection = player.getSelection();
|
||||
// if (selection == null) {
|
||||
// final int cx = loc.getBlockX() >> 4;
|
||||
// final int cz = loc.getBlockZ() >> 4;
|
||||
// selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
|
||||
// }
|
||||
// int count = FaweAPI.fixLighting(player.getWorld(), selection,null);
|
||||
// player.print(Caption.of("fawe.info.lighting.propagate.selection" , count));
|
||||
final Location loc = player.getLocation();
|
||||
Region selection = player.getSelection();
|
||||
if (selection == null) {
|
||||
final int cx = loc.getBlockX() >> 4;
|
||||
final int cz = loc.getBlockZ() >> 4;
|
||||
selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
|
||||
}
|
||||
int count = FaweAPI.fixLighting(player.getWorld(), selection,null, RelightMode.ALL);
|
||||
player.print(Caption.of("fawe.info.lighting.propagate.selection" , count));
|
||||
}
|
||||
|
||||
// @Command(
|
||||
@ -163,22 +164,21 @@ public class RegionCommands {
|
||||
// player.print(TextComponent.of("Light: " + block + " | " + sky));
|
||||
// }
|
||||
|
||||
// @Command(
|
||||
// name = "/removelighting",
|
||||
// desc = "Removing lighting in a selection"
|
||||
// )
|
||||
// @CommandPermissions("worldedit.light.remove")
|
||||
// public void removeLighting(Player player) {
|
||||
// player.print(TextComponent.of("Temporarily not working"));
|
||||
// Region selection = player.getSelection();
|
||||
// if (selection == null) {
|
||||
// final int cx = player.getLocation().getBlockX() >> 4;
|
||||
// final int cz = player.getLocation().getBlockZ() >> 4;
|
||||
// selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
|
||||
// }
|
||||
// int count = FaweAPI.fixLighting(player.getWorld(), selection, null);
|
||||
// player.print(Caption.of("fawe.info.updated.lighting.selection" , count));
|
||||
// }
|
||||
@Command(
|
||||
name = "/removelighting",
|
||||
desc = "Removing lighting in a selection"
|
||||
)
|
||||
@CommandPermissions("worldedit.light.remove")
|
||||
public void removeLighting(Player player) {
|
||||
Region selection = player.getSelection();
|
||||
if (selection == null) {
|
||||
final int cx = player.getLocation().getBlockX() >> 4;
|
||||
final int cz = player.getLocation().getBlockZ() >> 4;
|
||||
selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
|
||||
}
|
||||
int count = FaweAPI.fixLighting(player.getWorld(), selection, null, RelightMode.NONE);
|
||||
player.print(Caption.of("fawe.info.updated.lighting.selection" , count));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/nbtinfo",
|
||||
|
Reference in New Issue
Block a user