Remove Vanilla Key

This commit is contained in:
Zoë
2022-07-11 13:49:55 -07:00
parent b1b91726ef
commit f26cedd613
19 changed files with 226 additions and 343 deletions
@@ -22,6 +22,6 @@ public class BiomeFactory implements ConfigFactory<BiomeTemplate, Biome> {
@Override
public Biome build(BiomeTemplate template, Platform platform) {
return new UserDefinedBiome(template.getVanilla(), template);
return new UserDefinedBiome(template);
}
}
@@ -21,7 +21,6 @@ import com.dfsek.terra.api.Platform;
import com.dfsek.terra.api.config.AbstractableTemplate;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.api.config.meta.Meta;
import com.dfsek.terra.api.world.biome.PlatformBiome;
@SuppressWarnings({ "FieldMayBeFinal", "unused" })
@@ -37,13 +36,11 @@ public class BiomeTemplate implements AbstractableTemplate, ValidatedConfigTempl
@Default
private List<String> extended = Collections.emptyList();
@Value("vanilla")
private @Meta PlatformBiome vanilla;
@Value("color")
@Final
@Default
private @Meta int color = 0;
@Value("tags")
@Default
private @Meta Set<@Meta String> tags = new HashSet<>();
@@ -77,8 +74,4 @@ public class BiomeTemplate implements AbstractableTemplate, ValidatedConfigTempl
public String getID() {
return id;
}
public PlatformBiome getVanilla() {
return vanilla;
}
}
@@ -7,6 +7,8 @@
package com.dfsek.terra.addons.biome;
import org.jetbrains.annotations.Nullable;
import java.util.Set;
import com.dfsek.terra.api.properties.Context;
@@ -18,7 +20,8 @@ import com.dfsek.terra.api.world.biome.PlatformBiome;
* Class representing a config-defined biome
*/
public class UserDefinedBiome implements Biome {
private final PlatformBiome vanilla;
private PlatformBiome platformBiome;
private final String id;
private final BiomeTemplate config;
private final int color;
@@ -26,8 +29,7 @@ public class UserDefinedBiome implements Biome {
private final Context context = new Context();
public UserDefinedBiome(PlatformBiome vanilla, BiomeTemplate config) {
this.vanilla = vanilla;
public UserDefinedBiome(BiomeTemplate config) {
this.id = config.getID();
this.config = config;
this.color = config.getColor();
@@ -41,14 +43,9 @@ public class UserDefinedBiome implements Biome {
return "{BIOME:" + getID() + "}";
}
/**
* Gets the Vanilla biomes to represent the custom biome.
*
* @return Collection of biomes to represent the custom biome.
*/
@Override
public PlatformBiome getPlatformBiome() {
return vanilla;
public @Nullable PlatformBiome getPlatformBiome() {
return platformBiome;
}
@Override
@@ -56,6 +53,15 @@ public class UserDefinedBiome implements Biome {
return color;
}
@Override
public void setPlatformBiome(PlatformBiome biome) {
if(platformBiome != null) {
throw new IllegalStateException("Platform biome already set");
}
this.platformBiome = biome;
}
@Override
public Set<String> getTags() {
return tags;