mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-10 09:46:24 +00:00
generify BootstrapBaseAddon
This commit is contained in:
@@ -5,12 +5,12 @@ import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import java.nio.file.Path;
|
||||
|
||||
|
||||
public interface BootstrapBaseAddon extends BaseAddon {
|
||||
public interface BootstrapBaseAddon<T extends BaseAddon> extends BaseAddon {
|
||||
/**
|
||||
* Load all the relevant addons in the specified path.
|
||||
* @param addonsFolder Path containing addons.
|
||||
* @param parent
|
||||
* @return Loaded addons
|
||||
*/
|
||||
Iterable<BaseAddon> loadAddons(Path addonsFolder, ClassLoader parent);
|
||||
Iterable<T> loadAddons(Path addonsFolder, ClassLoader parent);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ dependencies {
|
||||
"shadedApi"(project(":common:api:util"))
|
||||
"shadedApi"(project(":common:api:noise"))
|
||||
"shadedApi"(project(":common:api:registry"))
|
||||
"shadedApi"(project(":common:api:addons"))
|
||||
|
||||
"shadedApi"("com.dfsek:Paralithic:0.5.0")
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.dfsek.terra.api;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.addon.TerraAddon;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.config.PluginConfig;
|
||||
@@ -47,7 +48,7 @@ public interface Platform extends LoaderRegistrar {
|
||||
|
||||
CheckedRegistry<ConfigPack> getConfigRegistry();
|
||||
|
||||
Registry<TerraAddon> getAddons();
|
||||
Registry<BaseAddon> getAddons();
|
||||
|
||||
ItemHandle getItemHandle();
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.dfsek.terra.api.addon.annotations.Version;
|
||||
/**
|
||||
* Represents an entry point for an com.dfsek.terra.addon. Implementations must be annotated with {@link Addon}.
|
||||
*/
|
||||
public abstract class TerraAddon {
|
||||
public abstract class TerraAddon implements BaseAddon {
|
||||
/**
|
||||
* Invoked immediately after an com.dfsek.terra.addon is loaded.
|
||||
*/
|
||||
@@ -50,4 +50,9 @@ public abstract class TerraAddon {
|
||||
// .dfsek.terra.addon loader.
|
||||
return addon.value();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return getName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dfsek.terra.api.event.functional;
|
||||
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.addon.TerraAddon;
|
||||
import com.dfsek.terra.api.event.EventHandler;
|
||||
import com.dfsek.terra.api.event.events.Event;
|
||||
@@ -7,7 +8,7 @@ import com.dfsek.terra.api.util.reflection.TypeKey;
|
||||
|
||||
|
||||
public interface FunctionalEventHandler extends EventHandler {
|
||||
<T extends Event> EventContext<T> register(TerraAddon addon, Class<T> clazz);
|
||||
<T extends Event> EventContext<T> register(BaseAddon addon, Class<T> clazz);
|
||||
|
||||
<T extends Event> EventContext<T> register(TerraAddon addon, TypeKey<T> clazz);
|
||||
<T extends Event> EventContext<T> register(BaseAddon addon, TypeKey<T> clazz);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user