mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 08:25:31 +00:00
functional events in FloraGenerationAddon
This commit is contained in:
parent
185df6e8a4
commit
d8a5951f6e
@ -5,7 +5,6 @@ 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.ConfigurationLoadEvent;
|
||||
import com.dfsek.terra.api.event.events.config.pack.ConfigPackPreLoadEvent;
|
||||
import com.dfsek.terra.api.injection.annotations.Inject;
|
||||
@ -15,24 +14,26 @@ import com.dfsek.terra.api.world.generator.GenerationStageProvider;
|
||||
@Addon("generation-stage-flora")
|
||||
@Version("1.0.0")
|
||||
@Author("Terra")
|
||||
public class FloraGenerationAddon extends TerraAddon implements EventListener {
|
||||
public class FloraGenerationAddon extends TerraAddon {
|
||||
|
||||
@Inject
|
||||
private TerraPlugin main;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
main.getEventManager().registerListener(this, this);
|
||||
}
|
||||
|
||||
public void onPackLoad(ConfigPackPreLoadEvent event) {
|
||||
main.getEventManager()
|
||||
.register(ConfigPackPreLoadEvent.class)
|
||||
.then(event -> {
|
||||
event.getPack().applyLoader(FloraLayer.class, FloraLayerLoader::new);
|
||||
event.getPack().getOrCreateRegistry(GenerationStageProvider.class).register("FLORA", pack -> new FloraGenerationStage(main));
|
||||
}
|
||||
});
|
||||
|
||||
public void onBiomeLoad(ConfigurationLoadEvent event) {
|
||||
main.getEventManager()
|
||||
.register(ConfigurationLoadEvent.class)
|
||||
.then(event -> {
|
||||
if(event.is(TerraBiome.class)) {
|
||||
event.getLoadedObject(TerraBiome.class).getContext().put(event.load(new BiomeFloraTemplate()).get());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user