mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-10-26 05:50:08 +00:00
populator registration
This commit is contained in:
1 parent
6ca9ba029b
commit
719ea83bcd
4 files changed
+19
-3
No files matched your search
@@ -8,6 +8,8 @@ import com.dfsek.terra.api.addon.annotations.Version;
|
|||||||
import com.dfsek.terra.api.event.EventListener;
|
import com.dfsek.terra.api.event.EventListener;
|
||||||
import com.dfsek.terra.api.event.events.config.ConfigPackPreLoadEvent;
|
import com.dfsek.terra.api.event.events.config.ConfigPackPreLoadEvent;
|
||||||
import com.dfsek.terra.api.injection.annotations.Inject;
|
import com.dfsek.terra.api.injection.annotations.Inject;
|
||||||
|
import com.dfsek.terra.api.registry.exception.DuplicateEntryException;
|
||||||
|
import com.dfsek.terra.api.world.generator.BlockPopulatorProvider;
|
||||||
|
|
||||||
@Addon("core-flora-config")
|
@Addon("core-flora-config")
|
||||||
@Author("Terra")
|
@Author("Terra")
|
||||||
@@ -21,7 +23,8 @@ public class FloraAddon extends TerraAddon implements EventListener {
|
|||||||
main.getEventManager().registerListener(this, this);
|
main.getEventManager().registerListener(this, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPackLoad(ConfigPackPreLoadEvent event) {
|
public void onPackLoad(ConfigPackPreLoadEvent event) throws DuplicateEntryException {
|
||||||
event.getPack().registerConfigType(new FloraConfigType(event.getPack()), "FLORA", 2);
|
event.getPack().registerConfigType(new FloraConfigType(event.getPack()), "FLORA", 2);
|
||||||
|
event.getPack().getOrCreateRegistry(BlockPopulatorProvider.class).register("FLORA", pack -> new FloraPopulator(main));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,8 @@ import com.dfsek.terra.api.addon.annotations.Version;
|
|||||||
import com.dfsek.terra.api.event.EventListener;
|
import com.dfsek.terra.api.event.EventListener;
|
||||||
import com.dfsek.terra.api.event.events.config.ConfigPackPreLoadEvent;
|
import com.dfsek.terra.api.event.events.config.ConfigPackPreLoadEvent;
|
||||||
import com.dfsek.terra.api.injection.annotations.Inject;
|
import com.dfsek.terra.api.injection.annotations.Inject;
|
||||||
|
import com.dfsek.terra.api.registry.exception.DuplicateEntryException;
|
||||||
|
import com.dfsek.terra.api.world.generator.BlockPopulatorProvider;
|
||||||
|
|
||||||
|
|
||||||
@Addon("core-ore-config")
|
@Addon("core-ore-config")
|
||||||
@@ -22,7 +24,8 @@ public class OreAddon extends TerraAddon implements EventListener {
|
|||||||
main.getEventManager().registerListener(this, this);
|
main.getEventManager().registerListener(this, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPackLoad(ConfigPackPreLoadEvent event) {
|
public void onPackLoad(ConfigPackPreLoadEvent event) throws DuplicateEntryException {
|
||||||
event.getPack().registerConfigType(new OreConfigType(event.getPack()), "ORE", 1);
|
event.getPack().registerConfigType(new OreConfigType(event.getPack()), "ORE", 1);
|
||||||
|
event.getPack().getOrCreateRegistry(BlockPopulatorProvider.class).register("ORE", pack -> new OrePopulator(main));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,8 @@ import com.dfsek.terra.api.addon.annotations.Version;
|
|||||||
import com.dfsek.terra.api.event.EventListener;
|
import com.dfsek.terra.api.event.EventListener;
|
||||||
import com.dfsek.terra.api.event.events.config.ConfigPackPreLoadEvent;
|
import com.dfsek.terra.api.event.events.config.ConfigPackPreLoadEvent;
|
||||||
import com.dfsek.terra.api.injection.annotations.Inject;
|
import com.dfsek.terra.api.injection.annotations.Inject;
|
||||||
|
import com.dfsek.terra.api.registry.exception.DuplicateEntryException;
|
||||||
|
import com.dfsek.terra.api.world.generator.BlockPopulatorProvider;
|
||||||
|
|
||||||
@Addon("core-tree-config")
|
@Addon("core-tree-config")
|
||||||
@Author("Terra")
|
@Author("Terra")
|
||||||
@@ -21,7 +23,8 @@ public class TreeAddon extends TerraAddon implements EventListener {
|
|||||||
main.getEventManager().registerListener(this, this);
|
main.getEventManager().registerListener(this, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPackLoad(ConfigPackPreLoadEvent event) {
|
public void onPackLoad(ConfigPackPreLoadEvent event) throws DuplicateEntryException {
|
||||||
event.getPack().registerConfigType(new TreeConfigType(event.getPack()), "TREE", 2);
|
event.getPack().registerConfigType(new TreeConfigType(event.getPack()), "TREE", 2);
|
||||||
|
event.getPack().getOrCreateRegistry(BlockPopulatorProvider.class).register("TREE", pack -> new TreePopulator(main));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package com.dfsek.terra.api.world.generator;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.config.ConfigPack;
|
||||||
|
|
||||||
|
public interface BlockPopulatorProvider {
|
||||||
|
TerraBlockPopulator newInstance(ConfigPack pack);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user