mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-12-01 07:03:52 +01:00
Optimize set air for more versions
This commit is contained in:
parent
33548c8d55
commit
9d920a5510
@ -328,8 +328,12 @@ public class BukkitChunk_1_10 extends CharFaweChunk<Chunk, BukkitQueue_1_10> {
|
||||
if (array == null) {
|
||||
continue;
|
||||
}
|
||||
int countAir = this.getAir(j);
|
||||
ChunkSection section = sections[j];
|
||||
if (section == null) {
|
||||
if (count == countAir) {
|
||||
continue;
|
||||
}
|
||||
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
|
||||
section = sections[j] = getParent().newChunkSection(j << 4, flag, null);
|
||||
getParent().setPalette(section, this.sectionPalettes[j]);
|
||||
@ -340,6 +344,10 @@ public class BukkitChunk_1_10 extends CharFaweChunk<Chunk, BukkitQueue_1_10> {
|
||||
}
|
||||
continue;
|
||||
} else if (count >= 4096) {
|
||||
if (countAir >= 4096) {
|
||||
sections[j] = null;
|
||||
continue;
|
||||
}
|
||||
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
|
||||
getParent().setPalette(section, this.sectionPalettes[j]);
|
||||
getParent().setCount(0, count - this.getAir(j), section);
|
||||
|
@ -338,14 +338,14 @@ public class BukkitChunk_1_11 extends CharFaweChunk<Chunk, com.boydti.fawe.bukki
|
||||
if (count == 0) {
|
||||
continue;
|
||||
}
|
||||
int air = this.getAir(j);
|
||||
int countAir = this.getAir(j);
|
||||
final char[] array = this.getIdArray(j);
|
||||
if (array == null) {
|
||||
continue;
|
||||
}
|
||||
ChunkSection section = sections[j];
|
||||
if (section == null) {
|
||||
if (count == air) {
|
||||
if (count == countAir) {
|
||||
continue;
|
||||
}
|
||||
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
|
||||
@ -358,7 +358,7 @@ public class BukkitChunk_1_11 extends CharFaweChunk<Chunk, com.boydti.fawe.bukki
|
||||
}
|
||||
continue;
|
||||
} else if (count >= 4096) {
|
||||
if (air >= 4096) {
|
||||
if (countAir >= 4096) {
|
||||
sections[j] = null;
|
||||
continue;
|
||||
}
|
||||
|
@ -279,16 +279,21 @@ public class BukkitChunk_1_7 extends CharFaweChunk<Chunk, BukkitQueue17> {
|
||||
}
|
||||
// Set blocks
|
||||
for (int j = 0; j < sections.length; j++) {
|
||||
if (this.getCount(j) == 0) {
|
||||
int count = this.getCount(j);
|
||||
if (count == 0) {
|
||||
continue;
|
||||
}
|
||||
byte[] newIdArray = this.getByteIdArray(j);
|
||||
if (newIdArray == null) {
|
||||
continue;
|
||||
}
|
||||
int countAir = this.getAir(j);
|
||||
NibbleArray newDataArray = this.getDataArray(j);
|
||||
ChunkSection section = sections[j];
|
||||
if ((section == null) || (this.getCount(j) >= 4096)) {
|
||||
if (section == null) {
|
||||
if (count == countAir) {
|
||||
continue;
|
||||
}
|
||||
sections[j] = section = new ChunkSection(j << 4, flag);
|
||||
section.setIdArray(newIdArray);
|
||||
if (newDataArray != null) {
|
||||
@ -296,6 +301,17 @@ public class BukkitChunk_1_7 extends CharFaweChunk<Chunk, BukkitQueue17> {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (count >= 4096) {
|
||||
if (countAir >= 4096) {
|
||||
sections[j] = null;
|
||||
continue;
|
||||
}
|
||||
section.setIdArray(newIdArray);
|
||||
if (newDataArray != null) {
|
||||
section.setDataArray(newDataArray);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
byte[] currentIdArray = (byte[]) BukkitQueue17.fieldIds.get(section);
|
||||
NibbleArray currentDataArray = (NibbleArray) BukkitQueue17.fieldData.get(section);
|
||||
boolean data = currentDataArray != null && newDataArray != null;
|
||||
|
@ -218,20 +218,32 @@ public class BukkitChunk_1_8 extends CharFaweChunk<Chunk, BukkitQueue18R3> {
|
||||
}
|
||||
// Set blocks
|
||||
for (int j = 0; j < sections.length; j++) {
|
||||
if (this.getCount(j) == 0) {
|
||||
int count = this.getCount(j);
|
||||
if (count == 0) {
|
||||
continue;
|
||||
}
|
||||
char[] newArray = this.getIdArray(j);
|
||||
if (newArray == null) {
|
||||
continue;
|
||||
}
|
||||
int countAir = this.getAir(j);
|
||||
ChunkSection section = sections[j];
|
||||
if (section != null && BukkitQueue18R3.isDirty != null) {
|
||||
BukkitQueue18R3.isDirty.set(section, true);
|
||||
}
|
||||
if ((section == null) || (this.getCount(j) >= 4096)) {
|
||||
section = new ChunkSection(j << 4, flag, newArray);
|
||||
sections[j] = section;
|
||||
if (section == null) {
|
||||
if (count == countAir) {
|
||||
continue;
|
||||
}
|
||||
sections[j] = section = new ChunkSection(j << 4, flag, newArray);
|
||||
continue;
|
||||
}
|
||||
if (count >= 4096) {
|
||||
if (count == countAir) {
|
||||
sections[j] = null;
|
||||
continue;
|
||||
}
|
||||
sections[j] = section = new ChunkSection(j << 4, flag, newArray);
|
||||
continue;
|
||||
}
|
||||
int by = j << 4;
|
||||
|
@ -330,8 +330,12 @@ public class BukkitChunk_1_9 extends CharFaweChunk<Chunk, BukkitQueue_1_9_R1> {
|
||||
if (array == null) {
|
||||
continue;
|
||||
}
|
||||
int countAir = this.getAir(j);
|
||||
ChunkSection section = sections[j];
|
||||
if (section == null) {
|
||||
if (count == countAir) {
|
||||
continue;
|
||||
}
|
||||
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
|
||||
section = sections[j] = getParent().newChunkSection(j << 4, flag, null);
|
||||
getParent().setPalette(section, this.sectionPalettes[j]);
|
||||
@ -342,6 +346,10 @@ public class BukkitChunk_1_9 extends CharFaweChunk<Chunk, BukkitQueue_1_9_R1> {
|
||||
}
|
||||
continue;
|
||||
} else if (count >= 4096) {
|
||||
if (countAir >= 4096) {
|
||||
sections[j] = null;
|
||||
continue;
|
||||
}
|
||||
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
|
||||
getParent().setPalette(section, this.sectionPalettes[j]);
|
||||
getParent().setCount(0, count - this.getAir(j), section);
|
||||
|
@ -281,8 +281,12 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
|
||||
if (array == null) {
|
||||
continue;
|
||||
}
|
||||
int countAir = this.getAir(j);
|
||||
ExtendedBlockStorage section = sections[j];
|
||||
if (section == null) {
|
||||
if (count == countAir) {
|
||||
continue;
|
||||
}
|
||||
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
|
||||
section = sections[j] = new ExtendedBlockStorage(j << 4, flag);
|
||||
getParent().setPalette(section, this.sectionPalettes[j]);
|
||||
@ -292,6 +296,10 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
|
||||
sections[j] = section = new ExtendedBlockStorage(j << 4, flag);
|
||||
}
|
||||
} else if (count >= 4096) {
|
||||
if (count == countAir) {
|
||||
sections[j] = null;
|
||||
continue;
|
||||
}
|
||||
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
|
||||
getParent().setPalette(section, this.sectionPalettes[j]);
|
||||
getParent().setCount(0, count - this.getAir(j), section);
|
||||
|
@ -298,8 +298,12 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||
if (array == null) {
|
||||
continue;
|
||||
}
|
||||
int countAir = this.getAir(j);
|
||||
ExtendedBlockStorage section = sections[j];
|
||||
if (section == null) {
|
||||
if (count == countAir) {
|
||||
continue;
|
||||
}
|
||||
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
|
||||
section = sections[j] = new ExtendedBlockStorage(j << 4, flag);
|
||||
getParent().setPalette(section, this.sectionPalettes[j]);
|
||||
@ -309,6 +313,10 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
|
||||
sections[j] = section = new ExtendedBlockStorage(j << 4, flag);
|
||||
}
|
||||
} else if (count >= 4096) {
|
||||
if (count == countAir) {
|
||||
sections[j] = null;
|
||||
continue;
|
||||
}
|
||||
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
|
||||
getParent().setPalette(section, this.sectionPalettes[j]);
|
||||
getParent().setCount(0, count - this.getAir(j), section);
|
||||
|
Loading…
Reference in New Issue
Block a user