Add prioritised registration

This commit is contained in:
TomTom 2024-07-31 18:34:15 +02:00
parent e59911f6b0
commit 102c4ec5a1

View File

@ -1,6 +1,7 @@
package com.artillexstudios.axminions.integrations; package com.artillexstudios.axminions.integrations;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.joml.Math;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -13,6 +14,10 @@ public abstract class Integration<T extends Integrable> {
this.integrations.add(integration); this.integrations.add(integration);
} }
public void register(int priority, T integration) {
this.integrations.add(Math.clamp(0, integrations.size(), priority), integration);
}
public List<T> integrations() { public List<T> integrations() {
return this.view; return this.view;
} }