mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 21:56:33 +01:00
Fix entity iteration/removal
This commit is contained in:
parent
479d92b573
commit
a9cafb13a2
@ -16,7 +16,6 @@ import com.sk89q.jnbt.Tag;
|
|||||||
import com.sk89q.worldedit.internal.Constants;
|
import com.sk89q.worldedit.internal.Constants;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -209,9 +208,9 @@ public class BukkitChunk_1_10 extends CharFaweChunk<Chunk, BukkitQueue_1_10> {
|
|||||||
if (!ents.isEmpty()) {
|
if (!ents.isEmpty()) {
|
||||||
char[] array = this.getIdArray(i);
|
char[] array = this.getIdArray(i);
|
||||||
if (array == null || entities[i] == null || entities[i].isEmpty()) continue;
|
if (array == null || entities[i] == null || entities[i].isEmpty()) continue;
|
||||||
ents = new ArrayList<>(entities[i]);
|
Entity[] entsArr = ents.toArray(new Entity[ents.size()]);
|
||||||
synchronized (BukkitQueue_0.adapter) {
|
synchronized (BukkitQueue_0.adapter) {
|
||||||
for (Entity entity : ents) {
|
for (Entity entity : entsArr) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -231,10 +230,13 @@ public class BukkitChunk_1_10 extends CharFaweChunk<Chunk, BukkitQueue_1_10> {
|
|||||||
if (!entsToRemove.isEmpty()) {
|
if (!entsToRemove.isEmpty()) {
|
||||||
synchronized (BukkitQueue_0.adapter) {
|
synchronized (BukkitQueue_0.adapter) {
|
||||||
for (int i = 0; i < entities.length; i++) {
|
for (int i = 0; i < entities.length; i++) {
|
||||||
Collection<Entity> ents = new ArrayList<>(entities[i]);
|
Collection<Entity> ents = entities[i];
|
||||||
for (Entity entity : ents) {
|
if (ents.isEmpty()) {
|
||||||
if (entsToRemove.contains(entity.getUniqueID())) {
|
Entity[] entsArr = ents.toArray(new Entity[ents.size()]);
|
||||||
nmsWorld.removeEntity(entity);
|
for (Entity entity : entsArr) {
|
||||||
|
if (entsToRemove.contains(entity.getUniqueID())) {
|
||||||
|
nmsWorld.removeEntity(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ import com.sk89q.worldedit.internal.Constants;
|
|||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -230,13 +229,16 @@ public class BukkitChunk_1_11 extends CharFaweChunk<Chunk, com.boydti.fawe.bukki
|
|||||||
if (!entsToRemove.isEmpty()) {
|
if (!entsToRemove.isEmpty()) {
|
||||||
synchronized (BukkitQueue_0.adapter) {
|
synchronized (BukkitQueue_0.adapter) {
|
||||||
for (int i = 0; i < entities.length; i++) {
|
for (int i = 0; i < entities.length; i++) {
|
||||||
Collection<Entity> ents = new ArrayList<>(entities[i]);
|
Collection<Entity> ents = entities[i];
|
||||||
for (Entity entity : ents) {
|
if (ents.isEmpty()) {
|
||||||
if (entsToRemove.contains(entity.getUniqueID())) {
|
Entity[] entsArr = ents.toArray(new Entity[ents.size()]);
|
||||||
if (copy != null) {
|
for (Entity entity : entsArr) {
|
||||||
copy.storeEntity(entity);
|
if (entsToRemove.contains(entity.getUniqueID())) {
|
||||||
|
if (copy != null) {
|
||||||
|
copy.storeEntity(entity);
|
||||||
|
}
|
||||||
|
nmsWorld.removeEntity(entity);
|
||||||
}
|
}
|
||||||
nmsWorld.removeEntity(entity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -263,8 +265,9 @@ public class BukkitChunk_1_11 extends CharFaweChunk<Chunk, com.boydti.fawe.bukki
|
|||||||
if (!ents.isEmpty()) {
|
if (!ents.isEmpty()) {
|
||||||
char[] array = this.getIdArray(i);
|
char[] array = this.getIdArray(i);
|
||||||
if (array == null || ents == null || ents.isEmpty()) continue;
|
if (array == null || ents == null || ents.isEmpty()) continue;
|
||||||
|
Entity[] entsArr = ents.toArray(new Entity[ents.size()]);
|
||||||
synchronized (BukkitQueue_0.adapter) {
|
synchronized (BukkitQueue_0.adapter) {
|
||||||
for (Entity entity : ents) {
|
for (Entity entity : entsArr) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -171,9 +171,9 @@ public class BukkitChunk_1_7 extends CharFaweChunk<Chunk, BukkitQueue17> {
|
|||||||
if (!ents.isEmpty()) {
|
if (!ents.isEmpty()) {
|
||||||
char[] array = this.getIdArray(i);
|
char[] array = this.getIdArray(i);
|
||||||
if (array == null || entities[i] == null || entities[i].isEmpty()) continue;
|
if (array == null || entities[i] == null || entities[i].isEmpty()) continue;
|
||||||
ents = new ArrayList<>(entities[i]);
|
Entity[] entsArr = ents.toArray(new Entity[ents.size()]);
|
||||||
synchronized (BukkitQueue_0.adapter) {
|
synchronized (BukkitQueue_0.adapter) {
|
||||||
for (Entity entity : ents) {
|
for (Entity entity : entsArr) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ import com.sk89q.jnbt.ListTag;
|
|||||||
import com.sk89q.jnbt.StringTag;
|
import com.sk89q.jnbt.StringTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.internal.Constants;
|
import com.sk89q.worldedit.internal.Constants;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -110,9 +109,9 @@ public class BukkitChunk_1_8 extends CharFaweChunk<Chunk, BukkitQueue18R3> {
|
|||||||
if (!ents.isEmpty()) {
|
if (!ents.isEmpty()) {
|
||||||
char[] array = this.getIdArray(i);
|
char[] array = this.getIdArray(i);
|
||||||
if (array == null || entities[i] == null || entities[i].isEmpty()) continue;
|
if (array == null || entities[i] == null || entities[i].isEmpty()) continue;
|
||||||
ents = new ArrayList<>(entities[i]);
|
Entity[] entsArr = ents.toArray(new Entity[ents.size()]);
|
||||||
synchronized (BukkitQueue_0.adapter) {
|
synchronized (BukkitQueue_0.adapter) {
|
||||||
for (Entity entity : ents) {
|
for (Entity entity : entsArr) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -132,10 +131,13 @@ public class BukkitChunk_1_8 extends CharFaweChunk<Chunk, BukkitQueue18R3> {
|
|||||||
if (!entsToRemove.isEmpty()) {
|
if (!entsToRemove.isEmpty()) {
|
||||||
synchronized (BukkitQueue_0.adapter) {
|
synchronized (BukkitQueue_0.adapter) {
|
||||||
for (int i = 0; i < entities.length; i++) {
|
for (int i = 0; i < entities.length; i++) {
|
||||||
Collection<Entity> ents = new ArrayList<>(entities[i]);
|
Collection<Entity> ents = entities[i];
|
||||||
for (Entity entity : ents) {
|
if (ents.isEmpty()) {
|
||||||
if (entsToRemove.contains(entity.getUniqueID())) {
|
Entity[] entsArr = ents.toArray(new Entity[ents.size()]);
|
||||||
nmsWorld.removeEntity(entity);
|
for (Entity entity : entsArr) {
|
||||||
|
if (entsToRemove.contains(entity.getUniqueID())) {
|
||||||
|
nmsWorld.removeEntity(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ import com.sk89q.jnbt.Tag;
|
|||||||
import com.sk89q.worldedit.internal.Constants;
|
import com.sk89q.worldedit.internal.Constants;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -210,9 +209,9 @@ public class BukkitChunk_1_9 extends CharFaweChunk<Chunk, BukkitQueue_1_9_R1> {
|
|||||||
if (!ents.isEmpty()) {
|
if (!ents.isEmpty()) {
|
||||||
char[] array = this.getIdArray(i);
|
char[] array = this.getIdArray(i);
|
||||||
if (array == null || entities[i] == null || entities[i].isEmpty()) continue;
|
if (array == null || entities[i] == null || entities[i].isEmpty()) continue;
|
||||||
ents = new ArrayList<>(entities[i]);
|
Entity[] entsArr = ents.toArray(new Entity[ents.size()]);
|
||||||
synchronized (BukkitQueue_0.adapter) {
|
synchronized (BukkitQueue_0.adapter) {
|
||||||
for (Entity entity : ents) {
|
for (Entity entity : entsArr) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -232,10 +231,13 @@ public class BukkitChunk_1_9 extends CharFaweChunk<Chunk, BukkitQueue_1_9_R1> {
|
|||||||
if (!entsToRemove.isEmpty()) {
|
if (!entsToRemove.isEmpty()) {
|
||||||
synchronized (BukkitQueue_0.adapter) {
|
synchronized (BukkitQueue_0.adapter) {
|
||||||
for (int i = 0; i < entities.length; i++) {
|
for (int i = 0; i < entities.length; i++) {
|
||||||
Collection<Entity> ents = new ArrayList<>(entities[i]);
|
Collection<Entity> ents = entities[i];
|
||||||
for (Entity entity : ents) {
|
if (ents.isEmpty()) {
|
||||||
if (entsToRemove.contains(entity.getUniqueID())) {
|
Entity[] entsArr = ents.toArray(new Entity[ents.size()]);
|
||||||
nmsWorld.removeEntity(entity);
|
for (Entity entity : entsArr) {
|
||||||
|
if (entsToRemove.contains(entity.getUniqueID())) {
|
||||||
|
nmsWorld.removeEntity(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user