Fixed #8890
This commit is contained in:
@@ -229,6 +229,12 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
|
||||
if(type == null) throw new RuntimeException("Cannot remove a null entity!");
|
||||
if(position != -1 && position < array.size){
|
||||
|
||||
//rarely the entity index is wrong; fallback to slow implementation
|
||||
if(array.items[position] != type){
|
||||
remove(type);
|
||||
return;
|
||||
}
|
||||
|
||||
//swap head with current
|
||||
if(array.size > 1){
|
||||
var head = array.items[array.size - 1];
|
||||
|
||||
Reference in New Issue
Block a user