populator registration

This commit is contained in:
dfsek
2021-07-08 09:54:18 -07:00
parent 6ca9ba029b
commit 719ea83bcd
4 changed files with 19 additions and 3 deletions

View File

@@ -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.events.config.ConfigPackPreLoadEvent;
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")
@Author("Terra")
@@ -21,7 +23,8 @@ public class TreeAddon extends TerraAddon implements EventListener {
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().getOrCreateRegistry(BlockPopulatorProvider.class).register("TREE", pack -> new TreePopulator(main));
}
}