Fix removing section lighting

- Paper and spigot differ in methods
 - Also don't clone it as we're trying to fill the actual data...
This commit is contained in:
dordsor21 2021-01-14 17:03:32 +00:00
parent b18c646bce
commit bad3d31d90
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
4 changed files with 20 additions and 16 deletions

View File

@ -27,6 +27,7 @@ import com.sk89q.worldedit.internal.Constants;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import io.papermc.lib.PaperLib;
import net.minecraft.server.v1_15_R1.BiomeBase; import net.minecraft.server.v1_15_R1.BiomeBase;
import net.minecraft.server.v1_15_R1.BiomeStorage; import net.minecraft.server.v1_15_R1.BiomeStorage;
import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.BlockPosition;
@ -181,8 +182,8 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
synchronized (nibble) { synchronized (nibble) {
byte[] bytes = nibble.getCloneIfSet(); byte[] bytes = PaperLib.isPaper() ? nibble.getIfSet() : nibble.asBytes();
if (bytes != NibbleArray.EMPTY_NIBBLE) { if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) {
Arrays.fill(bytes, (byte) 0); Arrays.fill(bytes, (byte) 0);
} }
} }
@ -193,8 +194,8 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
synchronized (nibbleSky) { synchronized (nibbleSky) {
byte[] bytes = nibbleSky.getCloneIfSet(); byte[] bytes = PaperLib.isPaper() ? nibbleSky.getIfSet() : nibbleSky.asBytes();
if (bytes != NibbleArray.EMPTY_NIBBLE) { if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) {
Arrays.fill(bytes, (byte) 0); Arrays.fill(bytes, (byte) 0);
} }
} }

View File

@ -27,6 +27,7 @@ import com.sk89q.worldedit.internal.Constants;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import io.papermc.lib.PaperLib;
import net.minecraft.server.v1_16_R1.BiomeBase; import net.minecraft.server.v1_16_R1.BiomeBase;
import net.minecraft.server.v1_16_R1.BiomeStorage; import net.minecraft.server.v1_16_R1.BiomeStorage;
import net.minecraft.server.v1_16_R1.BlockPosition; import net.minecraft.server.v1_16_R1.BlockPosition;
@ -182,8 +183,8 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
synchronized (nibble) { synchronized (nibble) {
byte[] bytes = nibble.getCloneIfSet(); byte[] bytes = PaperLib.isPaper() ? nibble.getIfSet() : nibble.asBytes();
if (bytes != NibbleArray.EMPTY_NIBBLE) { if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) {
Arrays.fill(bytes, (byte) 0); Arrays.fill(bytes, (byte) 0);
} }
} }
@ -194,8 +195,8 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
synchronized (nibbleSky) { synchronized (nibbleSky) {
byte[] bytes = nibbleSky.getCloneIfSet(); byte[] bytes = PaperLib.isPaper() ? nibbleSky.getIfSet() : nibbleSky.asBytes();
if (bytes != NibbleArray.EMPTY_NIBBLE) { if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) {
Arrays.fill(bytes, (byte) 0); Arrays.fill(bytes, (byte) 0);
} }
} }

View File

@ -27,6 +27,7 @@ import com.sk89q.worldedit.internal.Constants;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import io.papermc.lib.PaperLib;
import net.minecraft.server.v1_16_R2.BiomeBase; import net.minecraft.server.v1_16_R2.BiomeBase;
import net.minecraft.server.v1_16_R2.BiomeStorage; import net.minecraft.server.v1_16_R2.BiomeStorage;
import net.minecraft.server.v1_16_R2.BlockPosition; import net.minecraft.server.v1_16_R2.BlockPosition;
@ -182,8 +183,8 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
synchronized (nibble) { synchronized (nibble) {
byte[] bytes = nibble.getCloneIfSet(); byte[] bytes = PaperLib.isPaper() ? nibble.getIfSet() : nibble.asBytes();
if (bytes != NibbleArray.EMPTY_NIBBLE) { if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) {
Arrays.fill(bytes, (byte) 0); Arrays.fill(bytes, (byte) 0);
} }
} }
@ -194,8 +195,8 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
synchronized (nibbleSky) { synchronized (nibbleSky) {
byte[] bytes = nibbleSky.getCloneIfSet(); byte[] bytes = PaperLib.isPaper() ? nibbleSky.getIfSet() : nibbleSky.asBytes();
if (bytes != NibbleArray.EMPTY_NIBBLE) { if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) {
Arrays.fill(bytes, (byte) 0); Arrays.fill(bytes, (byte) 0);
} }
} }

View File

@ -27,6 +27,7 @@ import com.sk89q.worldedit.internal.Constants;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import io.papermc.lib.PaperLib;
import net.minecraft.server.v1_16_R3.BiomeBase; import net.minecraft.server.v1_16_R3.BiomeBase;
import net.minecraft.server.v1_16_R3.BiomeStorage; import net.minecraft.server.v1_16_R3.BiomeStorage;
import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.BlockPosition;
@ -182,8 +183,8 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
synchronized (nibble) { synchronized (nibble) {
byte[] bytes = nibble.getCloneIfSet(); byte[] bytes = PaperLib.isPaper() ? nibble.getIfSet() : nibble.asBytes();
if (bytes != NibbleArray.EMPTY_NIBBLE) { if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) {
Arrays.fill(bytes, (byte) 0); Arrays.fill(bytes, (byte) 0);
} }
} }
@ -194,8 +195,8 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
synchronized (nibbleSky) { synchronized (nibbleSky) {
byte[] bytes = nibbleSky.getCloneIfSet(); byte[] bytes = PaperLib.isPaper() ? nibbleSky.getIfSet() : nibbleSky.asBytes();
if (bytes != NibbleArray.EMPTY_NIBBLE) { if (!PaperLib.isPaper() || bytes != NibbleArray.EMPTY_NIBBLE) {
Arrays.fill(bytes, (byte) 0); Arrays.fill(bytes, (byte) 0);
} }
} }