This commit is contained in:
Anuken 2023-08-03 02:56:38 -04:00
parent 6970a20f26
commit 5e18e08bdf

View File

@ -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];