This commit is contained in:
Zoë
2022-07-14 19:50:25 -07:00
parent 04c6363469
commit 1003304fde
45 changed files with 189 additions and 221 deletions

View File

@@ -7,8 +7,6 @@
package com.dfsek.terra.addons.biome;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;
import java.util.Set;
@@ -21,14 +19,12 @@ import com.dfsek.terra.api.world.biome.PlatformBiome;
* Class representing a config-defined biome
*/
public class UserDefinedBiome implements Biome {
private PlatformBiome platformBiome;
private final String id;
private final BiomeTemplate config;
private final int color;
private final Set<String> tags;
private final Context context = new Context();
private PlatformBiome platformBiome;
public UserDefinedBiome(BiomeTemplate config) {
this.id = config.getID();
@@ -49,20 +45,20 @@ public class UserDefinedBiome implements Biome {
return Optional.ofNullable(platformBiome);
}
@Override
public int getColor() {
return color;
}
@Override
public void setPlatformBiome(PlatformBiome biome) {
if(platformBiome != null) {
throw new IllegalStateException("Platform biome already set");
}
this.platformBiome = biome;
}
@Override
public int getColor() {
return color;
}
@Override
public Set<String> getTags() {
return tags;

View File

@@ -12,6 +12,6 @@ public class StructureGenerationStage implements GenerationStage {
@Override
public void populate(ProtoWorld world) {
}
}

View File

@@ -8,8 +8,6 @@
package com.dfsek.terra.api.world.biome;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;
import java.util.Set;
@@ -29,6 +27,11 @@ public interface Biome extends PropertyHolder, StringIdentifiable {
*/
Optional<PlatformBiome> getPlatformBiome();
/**
* Sets the platform biome this custom biome delegates to.
*/
void setPlatformBiome(PlatformBiome biome);
/**
* Get the color of this biome.
*
@@ -42,9 +45,4 @@ public interface Biome extends PropertyHolder, StringIdentifiable {
* @return A {@link Set} of String tags this biome holds.
*/
Set<String> getTags();
/**
* Sets the platform biome this custom biome delegates to.
*/
void setPlatformBiome(PlatformBiome biome);
}

View File

@@ -27,7 +27,7 @@ public class InternalAddon implements BaseAddon {
private static final Version VERSION = Versions.getVersion(1, 0, 0);
public InternalAddon() {
}
@Override

View File

@@ -84,7 +84,7 @@ public class BootstrapAddonLoader implements BootstrapBaseAddon<BootstrapBaseAdd
Path bootstrapFolder = addonsFolder.resolve("bootstrap");
Files.createDirectories(bootstrapFolder);
logger.debug("Loading bootstrap addons from {}", bootstrapFolder);
try(Stream<Path> bootstrapAddons = Files.walk(bootstrapFolder, 1, FileVisitOption.FOLLOW_LINKS)) {
return bootstrapAddons.filter(path -> path.toFile().isFile())
.filter(path -> path.toFile().canRead())
@@ -96,7 +96,7 @@ public class BootstrapAddonLoader implements BootstrapBaseAddon<BootstrapBaseAdd
throw new UncheckedIOException(e);
}
}
@Override
public String getID() {
return "BOOTSTRAP";