mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 22:31:52 +00:00
ore addon impl
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
package com.dfsek.terra.addons.ore;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.TerraPlugin;
|
||||||
|
import com.dfsek.terra.api.addon.TerraAddon;
|
||||||
|
import com.dfsek.terra.api.addon.annotations.Addon;
|
||||||
|
import com.dfsek.terra.api.addon.annotations.Author;
|
||||||
|
import com.dfsek.terra.api.addon.annotations.Version;
|
||||||
|
import com.dfsek.terra.api.event.EventListener;
|
||||||
|
import com.dfsek.terra.api.event.events.config.ConfigPackPreLoadEvent;
|
||||||
|
import com.dfsek.terra.api.injection.annotations.Inject;
|
||||||
|
|
||||||
|
|
||||||
|
@Addon("core-ore-config")
|
||||||
|
@Author("Terra")
|
||||||
|
@Version("1.0.0")
|
||||||
|
public class OreAddon extends TerraAddon implements EventListener {
|
||||||
|
@Inject
|
||||||
|
private TerraPlugin main;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
main.getEventManager().registerListener(this, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPackLoad(ConfigPackPreLoadEvent event) {
|
||||||
|
event.getPack().registerConfigType(new OreConfigType(event.getPack()), "ORE", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.dfsek.terra.addons.ore;
|
||||||
|
|
||||||
|
import com.dfsek.terra.addons.ore.ores.Ore;
|
||||||
|
import com.dfsek.terra.api.TerraPlugin;
|
||||||
|
import com.dfsek.terra.api.config.ConfigFactory;
|
||||||
|
import com.dfsek.terra.api.config.ConfigPack;
|
||||||
|
import com.dfsek.terra.api.config.ConfigType;
|
||||||
|
import com.dfsek.terra.api.registry.OpenRegistry;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class OreConfigType implements ConfigType<OreTemplate, Ore> {
|
||||||
|
private final OreFactory factory = new OreFactory();
|
||||||
|
private final ConfigPack pack;
|
||||||
|
|
||||||
|
public OreConfigType(ConfigPack pack) {
|
||||||
|
this.pack = pack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OreTemplate getTemplate(ConfigPack pack, TerraPlugin main) {
|
||||||
|
return new OreTemplate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConfigFactory<OreTemplate, Ore> getFactory() {
|
||||||
|
return factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<Ore> getTypeClass() {
|
||||||
|
return Ore.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Supplier<OpenRegistry<Ore>> registrySupplier() {
|
||||||
|
return pack.getRegistryFactory()::create;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user