mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 00:15:35 +00:00
load platform addons
This commit is contained in:
parent
8fc3977236
commit
46b918f9be
@ -118,6 +118,10 @@ public abstract class AbstractPlatform implements Platform {
|
||||
return eventManager;
|
||||
}
|
||||
|
||||
protected Optional<BaseAddon> platformAddon() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Profiler getProfiler() {
|
||||
return profiler;
|
||||
@ -192,6 +196,11 @@ public abstract class AbstractPlatform implements Platform {
|
||||
|
||||
addonRegistry.register(internalAddon.getID(), internalAddon);
|
||||
|
||||
platformAddon().ifPresent(baseAddon -> {
|
||||
baseAddon.initialize();
|
||||
addonRegistry.register(baseAddon.getID(), baseAddon);
|
||||
});
|
||||
|
||||
BootstrapAddonLoader bootstrapAddonLoader = new BootstrapAddonLoader(this);
|
||||
|
||||
Path addonsFolder = getDataFolder().toPath().resolve("addons");
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.dfsek.terra.fabric;
|
||||
|
||||
import com.dfsek.tectonic.exception.ConfigException;
|
||||
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
@ -29,10 +32,7 @@ import com.dfsek.terra.fabric.event.BiomeRegistrationEvent;
|
||||
import com.dfsek.terra.fabric.util.FabricUtil;
|
||||
|
||||
|
||||
@Addon("terra-fabric")
|
||||
@Author("Terra")
|
||||
@Version("1.0.0")
|
||||
public final class FabricAddon extends TerraAddon {
|
||||
public final class FabricAddon implements BaseAddon {
|
||||
private final PlatformImpl terraFabricPlugin;
|
||||
private final Map<ConfigPack, Pair<PreLoadCompatibilityOptions, PostLoadCompatibilityOptions>> templates = new HashMap<>();
|
||||
|
||||
@ -118,4 +118,9 @@ public final class FabricAddon extends TerraAddon {
|
||||
public Map<ConfigPack, Pair<PreLoadCompatibilityOptions, PostLoadCompatibilityOptions>> getTemplates() {
|
||||
return templates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return "terra-fabric";
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,9 @@ package com.dfsek.terra.fabric;
|
||||
|
||||
import com.dfsek.tectonic.exception.LoadException;
|
||||
import com.dfsek.tectonic.loading.TypeRegistry;
|
||||
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.Identifier;
|
||||
@ -10,6 +13,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import com.dfsek.terra.AbstractPlatform;
|
||||
@ -54,6 +58,11 @@ public class PlatformImpl extends AbstractPlatform {
|
||||
return succeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Optional<BaseAddon> platformAddon() {
|
||||
return Optional.of(new FabricAddon(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String platformName() {
|
||||
return "Fabric";
|
||||
|
Loading…
x
Reference in New Issue
Block a user