This commit is contained in:
Jesse Boyd 2018-06-24 21:50:24 +10:00
parent c4d373549a
commit 29794d4ccd
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
18 changed files with 66 additions and 56 deletions

View File

@ -58,7 +58,7 @@ public class BukkitChunk_All extends CharFaweChunk<Chunk, BukkitQueue_All> {
copy.biomes = biomes; copy.biomes = biomes;
} else { } else {
copy = new BukkitChunk_All(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone()); copy = new BukkitChunk_All(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone());
copy.biomes = biomes.clone(); copy.biomes = biomes != null ? biomes.clone() : null;
} }
copy.chunk = chunk; copy.chunk = chunk;
return copy; return copy;

View File

@ -49,9 +49,7 @@ public class BukkitChunk_1_10 extends CharFaweChunk<Chunk, BukkitQueue_1_10> {
copy.chunk = chunk; copy.chunk = chunk;
} else { } else {
copy = new BukkitChunk_1_10(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone()); copy = new BukkitChunk_1_10(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone());
copy.biomes = biomes; copy.biomes = biomes != null ? biomes.clone() : null;
copy.chunk = chunk;
copy.biomes = biomes.clone();
copy.chunk = chunk; copy.chunk = chunk;
} }
if (sectionPalettes != null) { if (sectionPalettes != null) {
@ -436,8 +434,10 @@ public class BukkitChunk_1_10 extends CharFaweChunk<Chunk, BukkitQueue_1_10> {
} }
byte[] currentBiomes = nmsChunk.getBiomeIndex(); byte[] currentBiomes = nmsChunk.getBiomeIndex();
for (int i = 0 ; i < this.biomes.length; i++) { for (int i = 0 ; i < this.biomes.length; i++) {
if (this.biomes[i] != 0) { byte biome = this.biomes[i];
currentBiomes[i] = this.biomes[i]; if (biome != 0) {
if (biome == -1) biome = 0;
currentBiomes[i] = biome;
} }
} }
} }

View File

@ -110,9 +110,7 @@ public class BukkitChunk_1_11 extends CharFaweChunk<Chunk, com.boydti.fawe.bukki
copy.chunk = chunk; copy.chunk = chunk;
} else { } else {
copy = new BukkitChunk_1_11(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone()); copy = new BukkitChunk_1_11(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone());
copy.biomes = biomes; copy.biomes = biomes != null ? biomes.clone() : null;
copy.chunk = chunk;
copy.biomes = biomes.clone();
copy.chunk = chunk; copy.chunk = chunk;
} }
if (sectionPalettes != null) { if (sectionPalettes != null) {
@ -470,8 +468,10 @@ public class BukkitChunk_1_11 extends CharFaweChunk<Chunk, com.boydti.fawe.bukki
} }
byte[] currentBiomes = nmsChunk.getBiomeIndex(); byte[] currentBiomes = nmsChunk.getBiomeIndex();
for (int i = 0 ; i < this.biomes.length; i++) { for (int i = 0 ; i < this.biomes.length; i++) {
if (this.biomes[i] != 0) { byte biome = this.biomes[i];
currentBiomes[i] = this.biomes[i]; if (biome != 0) {
if (biome == -1) biome = 0;
currentBiomes[i] = biome;
} }
} }
} }

View File

@ -86,9 +86,7 @@ public class BukkitChunk_1_12 extends CharFaweChunk<Chunk, BukkitQueue_1_12> {
copy.chunk = chunk; copy.chunk = chunk;
} else { } else {
copy = new BukkitChunk_1_12(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone()); copy = new BukkitChunk_1_12(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone());
copy.biomes = biomes; copy.biomes = biomes != null ? biomes.clone() : null;
copy.chunk = chunk;
copy.biomes = biomes.clone();
copy.chunk = chunk; copy.chunk = chunk;
} }
if (sectionPalettes != null) { if (sectionPalettes != null) {
@ -460,8 +458,10 @@ public class BukkitChunk_1_12 extends CharFaweChunk<Chunk, BukkitQueue_1_12> {
} }
byte[] currentBiomes = nmsChunk.getBiomeIndex(); byte[] currentBiomes = nmsChunk.getBiomeIndex();
for (int i = 0 ; i < this.biomes.length; i++) { for (int i = 0 ; i < this.biomes.length; i++) {
if (this.biomes[i] != 0) { byte biome = this.biomes[i];
currentBiomes[i] = this.biomes[i]; if (biome != 0) {
if (biome == -1) biome = 0;
currentBiomes[i] = biome;
} }
} }
} }

View File

@ -52,9 +52,7 @@ public class BukkitChunk_1_7 extends CharFaweChunk<Chunk, BukkitQueue17> {
copy.chunk = chunk; copy.chunk = chunk;
} else { } else {
copy = new BukkitChunk_1_7(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone(), (byte[][]) MainUtil.copyNd(byteIds), datas.clone()); copy = new BukkitChunk_1_7(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone(), (byte[][]) MainUtil.copyNd(byteIds), datas.clone());
copy.biomes = biomes; copy.biomes = biomes != null ? biomes.clone() : null;
copy.chunk = chunk;
copy.biomes = biomes.clone();
copy.chunk = chunk; copy.chunk = chunk;
} }
return copy; return copy;
@ -411,8 +409,10 @@ public class BukkitChunk_1_7 extends CharFaweChunk<Chunk, BukkitQueue17> {
if (this.biomes != null) { if (this.biomes != null) {
byte[] currentBiomes = nmsChunk.m(); byte[] currentBiomes = nmsChunk.m();
for (int i = 0 ; i < this.biomes.length; i++) { for (int i = 0 ; i < this.biomes.length; i++) {
if (this.biomes[i] != 0) { byte biome = this.biomes[i];
currentBiomes[i] = this.biomes[i]; if (biome != 0) {
if (biome == -1) biome = 0;
currentBiomes[i] = biome;
} }
} }
} }

View File

@ -46,9 +46,7 @@ public class BukkitChunk_1_8 extends CharFaweChunk<Chunk, BukkitQueue18R3> {
copy.chunk = chunk; copy.chunk = chunk;
} else { } else {
copy = new BukkitChunk_1_8(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone()); copy = new BukkitChunk_1_8(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone());
copy.biomes = biomes; copy.biomes = biomes != null ? biomes.clone() : null;
copy.chunk = chunk;
copy.biomes = biomes.clone();
copy.chunk = chunk; copy.chunk = chunk;
} }
return copy; return copy;
@ -278,8 +276,10 @@ public class BukkitChunk_1_8 extends CharFaweChunk<Chunk, BukkitQueue18R3> {
if (this.biomes != null) { if (this.biomes != null) {
byte[] currentBiomes = nmsChunk.getBiomeIndex(); byte[] currentBiomes = nmsChunk.getBiomeIndex();
for (int i = 0 ; i < this.biomes.length; i++) { for (int i = 0 ; i < this.biomes.length; i++) {
if (this.biomes[i] != 0) { byte biome = this.biomes[i];
currentBiomes[i] = this.biomes[i]; if (biome != 0) {
if (biome == -1) biome = 0;
currentBiomes[i] = biome;
} }
} }
} }

View File

@ -48,9 +48,7 @@ public class BukkitChunk_1_9 extends CharFaweChunk<Chunk, BukkitQueue_1_9_R1> {
copy.chunk = chunk; copy.chunk = chunk;
} else { } else {
copy = new BukkitChunk_1_9(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone()); copy = new BukkitChunk_1_9(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone());
copy.biomes = biomes; copy.biomes = biomes != null ? biomes.clone() : null;
copy.chunk = chunk;
copy.biomes = biomes.clone();
copy.chunk = chunk; copy.chunk = chunk;
} }
if (sectionPalettes != null) { if (sectionPalettes != null) {

View File

@ -5,11 +5,8 @@ import com.boydti.fawe.object.FaweChunk;
import com.boydti.fawe.object.FaweQueue; import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.MathMan;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import java.util.HashMap;
import java.util.HashSet; import java.util.*;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
public abstract class CharFaweChunk<T, V extends FaweQueue> extends FaweChunk<T> { public abstract class CharFaweChunk<T, V extends FaweQueue> extends FaweChunk<T> {
@ -170,7 +167,7 @@ public abstract class CharFaweChunk<T, V extends FaweQueue> extends FaweChunk<T>
@Override @Override
public Set<CompoundTag> getEntities() { public Set<CompoundTag> getEntities() {
return entities == null ? new HashSet<CompoundTag>() : entities; return entities == null ? Collections.emptySet() : entities;
} }
@Override @Override
@ -350,10 +347,11 @@ public abstract class CharFaweChunk<T, V extends FaweQueue> extends FaweChunk<T>
} }
@Override @Override
public void setBiome(final int x, final int z, final byte biome) { public void setBiome(final int x, final int z, byte biome) {
if (this.biomes == null) { if (this.biomes == null) {
this.biomes = new byte[256]; this.biomes = new byte[256];
} }
if (biome == 0) biome = -1;
biomes[((z & 15) << 4) + (x & 15)] = biome; biomes[((z & 15) << 4) + (x & 15)] = biome;
} }

View File

@ -27,7 +27,7 @@ public class SimpleCharFaweChunk extends CharFaweChunk {
copy.biomes = biomes; copy.biomes = biomes;
} else { } else {
copy = new SimpleCharFaweChunk(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone()); copy = new SimpleCharFaweChunk(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone());
copy.biomes = biomes.clone(); copy.biomes = biomes != null ? biomes.clone() : null;
} }
return copy; return copy;
} }

View File

@ -334,8 +334,10 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
if (this.biomes != null) { if (this.biomes != null) {
byte[] currentBiomes = nmsChunk.getBiomeArray(); byte[] currentBiomes = nmsChunk.getBiomeArray();
for (int i = 0 ; i < this.biomes.length; i++) { for (int i = 0 ; i < this.biomes.length; i++) {
if (this.biomes[i] != 0) { byte biome = this.biomes[i];
currentBiomes[i] = this.biomes[i]; if (biome != 0) {
if (biome == -1) biome = 0;
currentBiomes[i] = biome;
} }
} }
} }

View File

@ -356,8 +356,10 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
if (this.biomes != null) { if (this.biomes != null) {
byte[] currentBiomes = nmsChunk.getBiomeArray(); byte[] currentBiomes = nmsChunk.getBiomeArray();
for (int i = 0 ; i < this.biomes.length; i++) { for (int i = 0 ; i < this.biomes.length; i++) {
if (this.biomes[i] != 0) { byte biome = this.biomes[i];
currentBiomes[i] = this.biomes[i]; if (biome != 0) {
if (biome == -1) biome = 0;
currentBiomes[i] = biome;
} }
} }
} }

View File

@ -356,8 +356,10 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
if (this.biomes != null) { if (this.biomes != null) {
byte[] currentBiomes = nmsChunk.getBiomeArray(); byte[] currentBiomes = nmsChunk.getBiomeArray();
for (int i = 0 ; i < this.biomes.length; i++) { for (int i = 0 ; i < this.biomes.length; i++) {
if (this.biomes[i] != 0) { byte biome = this.biomes[i];
currentBiomes[i] = this.biomes[i]; if (biome != 0) {
if (biome == -1) biome = 0;
currentBiomes[i] = biome;
} }
} }
} }

View File

@ -375,8 +375,10 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
if (this.biomes != null) { if (this.biomes != null) {
byte[] currentBiomes = nmsChunk.getBiomeArray(); byte[] currentBiomes = nmsChunk.getBiomeArray();
for (int i = 0 ; i < this.biomes.length; i++) { for (int i = 0 ; i < this.biomes.length; i++) {
if (this.biomes[i] != 0) { byte biome = this.biomes[i];
currentBiomes[i] = this.biomes[i]; if (biome != 0) {
if (biome == -1) biome = 0;
currentBiomes[i] = biome;
} }
} }
} }

View File

@ -249,8 +249,10 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
if (this.biomes != null) { if (this.biomes != null) {
byte[] currentBiomes = nmsChunk.getBiomeArray(); byte[] currentBiomes = nmsChunk.getBiomeArray();
for (int i = 0 ; i < this.biomes.length; i++) { for (int i = 0 ; i < this.biomes.length; i++) {
if (this.biomes[i] != 0) { byte biome = this.biomes[i];
currentBiomes[i] = this.biomes[i]; if (biome != 0) {
if (biome == -1) biome = 0;
currentBiomes[i] = biome;
} }
} }
} }

View File

@ -331,8 +331,10 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
if (this.biomes != null) { if (this.biomes != null) {
byte[] currentBiomes = nmsChunk.getBiomeArray(); byte[] currentBiomes = nmsChunk.getBiomeArray();
for (int i = 0 ; i < this.biomes.length; i++) { for (int i = 0 ; i < this.biomes.length; i++) {
if (this.biomes[i] != 0) { byte biome = this.biomes[i];
currentBiomes[i] = this.biomes[i]; if (biome != 0) {
if (biome == -1) biome = 0;
currentBiomes[i] = biome;
} }
} }
} }

View File

@ -46,9 +46,7 @@ public class NukkitChunk extends CharFaweChunk<BaseFullChunk, NukkitQueue> {
copy.chunk = chunk; copy.chunk = chunk;
} else { } else {
copy = new NukkitChunk(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone()); copy = new NukkitChunk(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone());
copy.biomes = biomes; copy.biomes = biomes != null ? biomes.clone() : null;
copy.chunk = chunk;
copy.biomes = biomes.clone();
copy.chunk = chunk; copy.chunk = chunk;
} }
return copy; return copy;

View File

@ -378,8 +378,10 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
if (this.biomes != null) { if (this.biomes != null) {
byte[] currentBiomes = nmsChunk.getBiomeArray(); byte[] currentBiomes = nmsChunk.getBiomeArray();
for (int i = 0 ; i < this.biomes.length; i++) { for (int i = 0 ; i < this.biomes.length; i++) {
if (this.biomes[i] != 0) { byte biome = this.biomes[i];
currentBiomes[i] = this.biomes[i]; if (biome != 0) {
if (biome == -1) biome = 0;
currentBiomes[i] = biome;
} }
} }
} }

View File

@ -378,8 +378,10 @@ public class SpongeChunk_1_12 extends CharFaweChunk<Chunk, SpongeQueue_1_12> {
if (this.biomes != null) { if (this.biomes != null) {
byte[] currentBiomes = nmsChunk.getBiomeArray(); byte[] currentBiomes = nmsChunk.getBiomeArray();
for (int i = 0 ; i < this.biomes.length; i++) { for (int i = 0 ; i < this.biomes.length; i++) {
if (this.biomes[i] != 0) { byte biome = this.biomes[i];
currentBiomes[i] = this.biomes[i]; if (biome != 0) {
if (biome == -1) biome = 0;
currentBiomes[i] = biome;
} }
} }
} }