mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-22 05:02:34 +00:00
Untangle the Genetics Analyst from the other modules
This commit is contained in:
1 parent
5ecb465d01
commit
60395a0ec7
184 files changed
+1391
-1014
No files matched your search
@@ -0,0 +1,36 @@
|
||||
package binnie.genetics.api;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public class GeneticsApi {
|
||||
private static Collection<IAnalystPagePlugin> analystPagePlugins = new ArrayList<>();
|
||||
private static Collection<IProducePlugin> producePlugins = new ArrayList<>();
|
||||
|
||||
public static void registerAnalystPagePlugin(IAnalystPagePlugin<?> analystPageFactory) {
|
||||
analystPagePlugins.add(analystPageFactory);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T extends IIndividual> IAnalystPagePlugin<T> getAnalystPagePlugin(T individual) {
|
||||
for (IAnalystPagePlugin plugin : analystPagePlugins) {
|
||||
if (plugin.handles(individual)) {
|
||||
//noinspection unchecked
|
||||
return plugin;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void registerProducePlugin(IProducePlugin producePlugin) {
|
||||
producePlugins.add(producePlugin);
|
||||
}
|
||||
|
||||
public static Collection<IProducePlugin> getProducePlugins() {
|
||||
return Collections.unmodifiableCollection(producePlugins);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user