mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-10 04:40:10 +07:00
Fixed #8890
This commit is contained in:
parent
6970a20f26
commit
5e18e08bdf
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user