This commit is contained in:
dfsek
2021-07-22 18:25:53 -07:00
parent ad9cc1afcb
commit 6ea11de2fd
7 changed files with 25 additions and 20 deletions

View File

@@ -21,6 +21,6 @@ public class BufferedEntity implements BufferedItem {
@Override
public void paste(Vector3 origin, World world) {
Entity entity = world.spawnEntity(origin.clone().add(0.5, 0, 0.5), type);
main.getEventManager().callEvent(new EntitySpawnEvent(entity.world().getGenerator().getConfigPack(), entity));
main.getEventManager().callEvent(new EntitySpawnEvent(entity.world().getConfig().getPack(), entity));
}
}

View File

@@ -33,7 +33,7 @@ public class BufferedLootApplication implements BufferedItem {
}
Container container = (Container) data;
LootPopulateEvent event = new LootPopulateEvent(container, table, world.getGenerator().getConfigPack(), structure);
LootPopulateEvent event = new LootPopulateEvent(container, table, world.getConfig().getPack(), structure);
main.getEventManager().callEvent(event);
if(event.isCancelled()) return;

View File

@@ -16,6 +16,8 @@ public interface WorldConfig {
BiomeProvider getProvider();
ConfigPack getPack();
int elevationBlend();
boolean disableTrees();

View File

@@ -9,6 +9,7 @@ import com.dfsek.terra.api.vector.Vector3;
import com.dfsek.terra.api.world.Chunk;
import com.dfsek.terra.api.world.World;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
import com.dfsek.terra.api.world.generator.TerraChunkGenerator;
public class DummyWorld implements World {
@Override
@@ -56,6 +57,11 @@ public class DummyWorld implements World {
return 0;
}
@Override
public TerraChunkGenerator getGenerator() {
throw new UnsupportedOperationException("Cannot get generator of DummyWorld");
}
@Override
public BiomeProvider getBiomeProvider() {
throw new UnsupportedOperationException("Cannot get biome provider of DummyWorld");

View File

@@ -1,6 +1,7 @@
package com.dfsek.terra.config.pack;
import com.dfsek.terra.api.TerraPlugin;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.api.config.WorldConfig;
import com.dfsek.terra.api.registry.Registry;
import com.dfsek.terra.api.world.World;
@@ -54,6 +55,11 @@ public class WorldConfigImpl implements WorldConfig {
return provider;
}
@Override
public ConfigPack getPack() {
return pack;
}
@Override
public int elevationBlend() {
return pack.getTemplate().getElevationBlend();