mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-04 00:45:57 +00:00
functional events in FeatureGenerationAddon
This commit is contained in:
parent
7363a305af
commit
ec26e7b1b0
@ -6,7 +6,6 @@ import com.dfsek.terra.api.addon.TerraAddon;
|
|||||||
import com.dfsek.terra.api.addon.annotations.Addon;
|
import com.dfsek.terra.api.addon.annotations.Addon;
|
||||||
import com.dfsek.terra.api.addon.annotations.Author;
|
import com.dfsek.terra.api.addon.annotations.Author;
|
||||||
import com.dfsek.terra.api.addon.annotations.Version;
|
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.ConfigurationLoadEvent;
|
||||||
import com.dfsek.terra.api.event.events.config.pack.ConfigPackPreLoadEvent;
|
import com.dfsek.terra.api.event.events.config.pack.ConfigPackPreLoadEvent;
|
||||||
import com.dfsek.terra.api.injection.annotations.Inject;
|
import com.dfsek.terra.api.injection.annotations.Inject;
|
||||||
@ -16,22 +15,22 @@ import com.dfsek.terra.api.world.generator.GenerationStageProvider;
|
|||||||
@Addon("generation-stage-feature")
|
@Addon("generation-stage-feature")
|
||||||
@Version("1.0.0")
|
@Version("1.0.0")
|
||||||
@Author("Terra")
|
@Author("Terra")
|
||||||
public class FeatureGenerationAddon extends TerraAddon implements EventListener {
|
public class FeatureGenerationAddon extends TerraAddon {
|
||||||
@Inject
|
@Inject
|
||||||
private TerraPlugin main;
|
private TerraPlugin main;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
main.getEventManager().registerListener(this, this);
|
main.getEventManager()
|
||||||
}
|
.register(ConfigPackPreLoadEvent.class)
|
||||||
|
.then(event -> event.getPack().getOrCreateRegistry(GenerationStageProvider.class).register("FEATURE", pack -> new FeatureGenerationStage(main)));
|
||||||
|
|
||||||
public void onPackLoad(ConfigPackPreLoadEvent event) {
|
main.getEventManager()
|
||||||
event.getPack().getOrCreateRegistry(GenerationStageProvider.class).register("FEATURE", pack -> new FeatureGenerationStage(main));
|
.register(ConfigurationLoadEvent.class)
|
||||||
}
|
.then(event -> {
|
||||||
|
|
||||||
public void onBiomeLoad(ConfigurationLoadEvent event) {
|
|
||||||
if(event.is(TerraBiome.class)) {
|
if(event.is(TerraBiome.class)) {
|
||||||
event.getLoadedObject(TerraBiome.class).getContext().put(event.load(new BiomeFeaturesTemplate()).get());
|
event.getLoadedObject(TerraBiome.class).getContext().put(event.load(new BiomeFeaturesTemplate()).get());
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user