From ed08bf8a9c344ab88893624502f74060f2eb74f2 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 6 Jun 2016 17:04:16 +1000 Subject: [PATCH] Fixes fixlighting Relates to #140 --- .../fawe/bukkit/v1_8/BukkitQueue18R3.java | 38 +++++++++++++- .../fawe/bukkit/v1_9/BukkitQueue_1_9_R1.java | 51 ++++++++++--------- .../com/boydti/fawe/object/FawePlayer.java | 15 +++++- 3 files changed, 78 insertions(+), 26 deletions(-) diff --git a/bukkit18/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitQueue18R3.java b/bukkit18/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitQueue18R3.java index 9a20d908..1efcb4f6 100644 --- a/bukkit18/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitQueue18R3.java +++ b/bukkit18/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitQueue18R3.java @@ -476,16 +476,49 @@ public class BukkitQueue18R3 extends BukkitQueue_0 0) { + ChunkSection section = sections[y >> 4]; + if (section != null) { + section.a(x, y & 15, z, l); + } + } + --y; + } while (y > 0 && l > 0); + } + } + } + } + if (fc.getTotalRelight() == 0 && mode == RelightMode.MINIMAL) { return true; } @@ -503,6 +536,9 @@ public class BukkitQueue18R3 extends BukkitQueue_0= 0; k--) { final int x = FaweCache.CACHE_X[j][k]; diff --git a/bukkit19/src/main/java/com/boydti/fawe/bukkit/v1_9/BukkitQueue_1_9_R1.java b/bukkit19/src/main/java/com/boydti/fawe/bukkit/v1_9/BukkitQueue_1_9_R1.java index a8033966..a09bbf36 100644 --- a/bukkit19/src/main/java/com/boydti/fawe/bukkit/v1_9/BukkitQueue_1_9_R1.java +++ b/bukkit19/src/main/java/com/boydti/fawe/bukkit/v1_9/BukkitQueue_1_9_R1.java @@ -200,38 +200,43 @@ public class BukkitQueue_1_9_R1 extends BukkitQueue_0 0) { - ChunkSection section = sections[i1 >> 4]; - if (section != null) { - section.a(x, i1 & 15, z, l); + if (flag) { + if (mode == RelightMode.ALL) { + c.initLighting(); + } else { + int i = c.g(); + for (int x = 0; x < 16; ++x) { + for (int z = 0; z < 16; ++z) { + int l = 15; + int y = i + 16 - 1; + do { + int opacity = c.a(x, y, z).c(); + if (opacity == 0 && l != 15) { + opacity = 1; } - } - --i1; - } while (i1 > 0 && l > 0); + l -= opacity; + if (l > 0) { + ChunkSection section = sections[y >> 4]; + if (section != null) { + section.a(x, y & 15, z, l); + } + } + --y; + } while (y > 0 && l > 0); + } } } } @@ -310,7 +315,7 @@ public class BukkitQueue_1_9_R1 extends BukkitQueue_0 { try { run.run(); } catch (Throwable e) { - e.printStackTrace(); + FaweException faweException = FaweException.get(e); + if (faweException != null) { + BBC.WORLDEDIT_CANCEL_REASON.send(FawePlayer.this, faweException.getMessage()); + } else { + MainUtil.handleError(e); + } } finally { deleteMeta("fawe_action"); } @@ -420,7 +426,12 @@ public abstract class FawePlayer { try { run.run(); } catch (Throwable e) { - e.printStackTrace(); + FaweException faweException = FaweException.get(e); + if (faweException != null) { + BBC.WORLDEDIT_CANCEL_REASON.send(FawePlayer.this, faweException.getMessage()); + } else { + MainUtil.handleError(e); + } } finally { deleteMeta("fawe_action"); }