mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
flora addon impl
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
package com.dfsek.terra.addons.flora;
|
||||||
|
|
||||||
|
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-flora-config")
|
||||||
|
@Author("Terra")
|
||||||
|
@Version("0.1.0")
|
||||||
|
public class FloraAddon 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 FloraConfigType(event.getPack()), "FLORA", 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.dfsek.terra.addons.flora;
|
||||||
|
|
||||||
|
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 com.dfsek.terra.api.world.Flora;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class FloraConfigType implements ConfigType<FloraTemplate, Flora> {
|
||||||
|
private final FloraFactory factory = new FloraFactory();
|
||||||
|
private final ConfigPack pack;
|
||||||
|
|
||||||
|
public FloraConfigType(ConfigPack pack) {
|
||||||
|
this.pack = pack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FloraTemplate getTemplate(ConfigPack pack, TerraPlugin main) {
|
||||||
|
return new FloraTemplate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConfigFactory<FloraTemplate, Flora> getFactory() {
|
||||||
|
return factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<Flora> getTypeClass() {
|
||||||
|
return Flora.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Supplier<OpenRegistry<Flora>> registrySupplier() {
|
||||||
|
return pack.getRegistryFactory()::create;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user