This commit is contained in:
Jesse Boyd 2018-08-21 04:02:37 +10:00
parent a703bba082
commit 46e36d90a4
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
6 changed files with 79 additions and 33 deletions

View File

@ -231,21 +231,27 @@ public class BukkitChunk_1_10 extends CharFaweChunk<Chunk, BukkitQueue_1_10> {
}
for (int i = 0; i < entities.length; i++) {
int count = this.getCount(i);
if (count == 0) {
if (count == 0 || getParent().getSettings().EXPERIMENTAL.KEEP_ENTITIES_IN_BLOCKS) {
continue;
} else if (count >= 4096) {
Collection<net.minecraft.server.v1_10_R1.Entity> ents = entities[i];
if (!ents.isEmpty()) {
if (copy != null) {
for (net.minecraft.server.v1_10_R1.Entity entity : ents) {
copy.storeEntity(entity);
synchronized (BukkitQueue_0.class) {
Iterator<Entity> iter = ents.iterator();
while (iter.hasNext()) {
Entity entity = iter.next();
if (entity instanceof EntityPlayer) {
continue;
}
iter.remove();
if (copy != null) {
copy.storeEntity(entity);
}
removeEntity(entity);
}
}
synchronized (BukkitQueue_0.class) {
ents.clear();
}
}
} else if (!getParent().getSettings().EXPERIMENTAL.KEEP_ENTITIES_IN_BLOCKS) {
} else {
Collection<net.minecraft.server.v1_10_R1.Entity> ents = entities[i];
if (!ents.isEmpty()) {
char[] array = this.getIdArray(i);

View File

@ -3,6 +3,7 @@ package com.boydti.fawe.bukkit.v1_11;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.bukkit.v0.BukkitQueue_0;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.example.CharFaweChunk;
import com.boydti.fawe.object.FaweChunk;
import com.boydti.fawe.object.FaweQueue;
@ -218,6 +219,7 @@ public class BukkitChunk_1_11 extends CharFaweChunk<Chunk, com.boydti.fawe.bukki
BukkitChunk_1_11_Copy copy = getParent().getChangeTask() != null ? new BukkitChunk_1_11_Copy(getParent(), getX(), getZ()) : null;
final Chunk chunk = this.getChunk();
final World world = chunk.getWorld();
Settings settings = getParent().getSettings();
int bx = this.getX() << 4;
int bz = this.getZ() << 4;
final boolean flag = world.getEnvironment() == World.Environment.NORMAL;
@ -252,21 +254,27 @@ public class BukkitChunk_1_11 extends CharFaweChunk<Chunk, com.boydti.fawe.bukki
}
for (int i = 0; i < entities.length; i++) {
int count = this.getCount(i);
if (count == 0) {
if (count == 0 || settings.EXPERIMENTAL.KEEP_ENTITIES_IN_BLOCKS) {
continue;
} else if (count >= 4096) {
Collection<Entity> ents = entities[i];
if (!ents.isEmpty()) {
if (copy != null) {
for (Entity entity : ents) {
copy.storeEntity(entity);
synchronized (BukkitQueue_0.class) {
Iterator<Entity> iter = ents.iterator();
while (iter.hasNext()) {
Entity entity = iter.next();
if (entity instanceof EntityPlayer) {
continue;
}
iter.remove();
if (copy != null) {
copy.storeEntity(entity);
}
removeEntity(entity);
}
}
synchronized (BukkitQueue_0.class) {
ents.clear();
}
}
} else if (!getParent().getSettings().EXPERIMENTAL.KEEP_ENTITIES_IN_BLOCKS) {
} else {
Collection<Entity> ents = entities[i];
if (!ents.isEmpty()) {
char[] array = this.getIdArray(i);

View File

@ -3,6 +3,7 @@ package com.boydti.fawe.bukkit.v1_12;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.bukkit.v0.BukkitQueue_0;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.example.CharFaweChunk;
import com.boydti.fawe.object.FaweChunk;
import com.boydti.fawe.object.FaweQueue;
@ -195,6 +196,7 @@ public class BukkitChunk_1_12 extends CharFaweChunk<Chunk, BukkitQueue_1_12> {
BukkitChunk_1_12_Copy copy = getParent().getChangeTask() != null ? new BukkitChunk_1_12_Copy(getParent(), getX(), getZ()) : null;
final Chunk chunk = this.getChunk();
final World world = chunk.getWorld();
Settings settings = getParent().getSettings();
int bx = this.getX() << 4;
int bz = this.getZ() << 4;
final boolean flag = world.getEnvironment() == World.Environment.NORMAL;
@ -231,21 +233,27 @@ public class BukkitChunk_1_12 extends CharFaweChunk<Chunk, BukkitQueue_1_12> {
}
for (int i = 0; i < entities.length; i++) {
int count = this.getCount(i);
if (count == 0) {
if (count == 0 || settings.EXPERIMENTAL.KEEP_ENTITIES_IN_BLOCKS) {
continue;
} else if (count >= 4096) {
Collection<Entity> ents = entities[i];
if (!ents.isEmpty()) {
if (copy != null) {
for (Entity entity : ents) {
copy.storeEntity(entity);
synchronized (BukkitQueue_0.class) {
Iterator<Entity> iter = ents.iterator();
while (iter.hasNext()) {
Entity entity = iter.next();
if (entity instanceof EntityPlayer) {
continue;
}
iter.remove();
if (copy != null) {
copy.storeEntity(entity);
}
removeEntity(entity);
}
}
synchronized (BukkitQueue_0.class) {
ents.clear();
}
}
} else if (!getParent().getSettings().EXPERIMENTAL.KEEP_ENTITIES_IN_BLOCKS) {
} else {
Collection<Entity> ents = entities[i];
if (!ents.isEmpty()) {
int layerYStart = i << 4;

View File

@ -152,16 +152,24 @@ public class BukkitChunk_1_7 extends CharFaweChunk<Chunk, BukkitQueue17> {
// Remove entities
for (int i = 0; i < 16; i++) {
int count = this.getCount(i);
if (count == 0) {
if (count == 0 || getParent().getSettings().EXPERIMENTAL.KEEP_ENTITIES_IN_BLOCKS) {
continue;
} else if (count >= 4096) {
Collection<Entity> ents = entities[i];
if (!ents.isEmpty()) {
synchronized (BukkitQueue_0.class) {
ents.clear();
Iterator<Entity> iter = ents.iterator();
while (iter.hasNext()) {
Entity entity = iter.next();
if (entity instanceof EntityPlayer) {
continue;
}
iter.remove();
nmsWorld.removeEntity(entity);
}
}
}
} else if (!getParent().getSettings().EXPERIMENTAL.KEEP_ENTITIES_IN_BLOCKS) {
} else {
Collection<Entity> ents = entities[i];
if (!ents.isEmpty()) {
char[] array = this.getIdArray(i);

View File

@ -82,16 +82,24 @@ public class BukkitChunk_1_8 extends CharFaweChunk<Chunk, BukkitQueue18R3> {
// Remove entities
for (int i = 0; i < 16; i++) {
int count = this.getCount(i);
if (count == 0) {
if (count == 0 || getParent().getSettings().EXPERIMENTAL.KEEP_ENTITIES_IN_BLOCKS) {
continue;
} else if (count >= 4096) {
Collection<Entity> ents = entities[i];
if (!ents.isEmpty()) {
synchronized (BukkitQueue_0.class) {
ents.clear();
Iterator<Entity> iter = ents.iterator();
while (iter.hasNext()) {
Entity entity = iter.next();
if (entity instanceof EntityPlayer) {
continue;
}
iter.remove();
nmsWorld.removeEntity(entity);
}
}
}
} else if (!getParent().getSettings().EXPERIMENTAL.KEEP_ENTITIES_IN_BLOCKS) {
} else {
Collection<Entity> ents = entities[i];
if (!ents.isEmpty()) {
char[] array = this.getIdArray(i);

View File

@ -172,16 +172,24 @@ public class BukkitChunk_1_9 extends CharFaweChunk<Chunk, BukkitQueue_1_9_R1> {
// Remove entities
for (int i = 0; i < entities.length; i++) {
int count = this.getCount(i);
if (count == 0) {
if (count == 0 || getParent().getSettings().EXPERIMENTAL.KEEP_ENTITIES_IN_BLOCKS) {
continue;
} else if (count >= 4096) {
Collection<Entity> ents = entities[i];
if (!ents.isEmpty()) {
synchronized (BukkitQueue_0.class) {
ents.clear();
Iterator<Entity> iter = ents.iterator();
while (iter.hasNext()) {
Entity entity = iter.next();
if (entity instanceof EntityPlayer) {
continue;
}
iter.remove();
nmsWorld.removeEntity(entity);
}
}
}
} else if (!getParent().getSettings().EXPERIMENTAL.KEEP_ENTITIES_IN_BLOCKS) {
} else {
Collection<Entity> ents = entities[i];
if (!ents.isEmpty()) {
char[] array = this.getIdArray(i);