mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-10-25 21:40:08 +00:00
structure addon work
This commit is contained in:
1 parent
72f0b07a38
commit
f0e3b1aa1d
3 files changed
+41
-2
No files matched your search
+18
@@ -0,0 +1,18 @@
|
|||||||
|
package com.dfsek.terra.addons.structure;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.properties.Properties;
|
||||||
|
import com.dfsek.terra.api.structure.ConfiguredStructure;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class BiomeStructures implements Properties {
|
||||||
|
private final Set<ConfiguredStructure> structures;
|
||||||
|
|
||||||
|
public BiomeStructures(Set<ConfiguredStructure> structures) {
|
||||||
|
this.structures = structures;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<ConfiguredStructure> getStructures() {
|
||||||
|
return structures;
|
||||||
|
}
|
||||||
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
package com.dfsek.terra.addons.structure;
|
||||||
|
|
||||||
|
import com.dfsek.tectonic.annotations.Default;
|
||||||
|
import com.dfsek.tectonic.annotations.Value;
|
||||||
|
import com.dfsek.tectonic.loading.object.ObjectTemplate;
|
||||||
|
import com.dfsek.terra.api.structure.ConfiguredStructure;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class BiomeStructuresTemplate implements ObjectTemplate<BiomeStructures> {
|
||||||
|
@Value("structures")
|
||||||
|
@Default
|
||||||
|
private Set<ConfiguredStructure> structures = Collections.emptySet();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BiomeStructures get() {
|
||||||
|
return new BiomeStructures(structures);
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-2
@@ -39,8 +39,9 @@ public class StructurePopulator implements TerraGenerationStage, Chunkified {
|
|||||||
for(ConfiguredStructure conf : config.getRegistry(TerraStructure.class).entries()) {
|
for(ConfiguredStructure conf : config.getRegistry(TerraStructure.class).entries()) {
|
||||||
Vector3 spawn = conf.getSpawn().getNearestSpawn(cx + 8, cz + 8, world.getSeed());
|
Vector3 spawn = conf.getSpawn().getNearestSpawn(cx + 8, cz + 8, world.getSeed());
|
||||||
|
|
||||||
//if(!((UserDefinedBiome) provider.getBiome(spawn)).getConfig().getStructures().contains(conf))
|
if(!provider.getBiome(spawn).getContext().get(BiomeStructures.class).getStructures().contains(conf)) {
|
||||||
// continue;
|
continue;
|
||||||
|
}
|
||||||
Random random = new Random(PopulationUtil.getCarverChunkSeed(FastMath.floorDiv(spawn.getBlockX(), 16), FastMath.floorDiv(spawn.getBlockZ(), 16), world.getSeed()));
|
Random random = new Random(PopulationUtil.getCarverChunkSeed(FastMath.floorDiv(spawn.getBlockX(), 16), FastMath.floorDiv(spawn.getBlockZ(), 16), world.getSeed()));
|
||||||
conf.getStructure().get(random).generate(spawn.setY(conf.getSpawnStart().get(random)), world, chunk, random, Rotation.fromDegrees(90 * random.nextInt(4)));
|
conf.getStructure().get(random).generate(spawn.setY(conf.getSpawnStart().get(random)), world, chunk, random, Rotation.fromDegrees(90 * random.nextInt(4)));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user