Skip to content

Commit

Permalink
Xbiomes were not working properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamHRLive committed Feb 11, 2025
1 parent 23ff34d commit f4440d7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.google.common.collect.Iterables;

import java.util.Arrays;
import java.util.EnumSet;
import java.util.Set;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -39,7 +38,18 @@ public String getDescription() {

@Override
public boolean isMet(PlacedSpawner spawner) {
return this.biomes.contains(spawner.getLocation().getBlock().getBiome());
String biomeName = spawner.getLocation().getBlock().getBiome().name();
XBiome resolvedBiome = getBiomeFromName(biomeName);
return resolvedBiome != null && this.biomes.contains(resolvedBiome);
}

private XBiome getBiomeFromName(String biomeName) {
for (XBiome xBiome : XBiome.values()) {
if (xBiome.name().equalsIgnoreCase(biomeName)) {
return xBiome;
}
}
return null;
}

private String getFriendlyBiomeName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,18 @@ public void saveSpawnerDataToFile() {

for (SpawnCondition spawnCondition : spawnerTier.getConditions()) {
if (spawnCondition instanceof SpawnConditionBiome) {
if (Arrays.stream(XBiome.values()).map(XBiome::getBiome).equals(((SpawnConditionBiome) spawnCondition).getBiomes())) {
Set<XBiome> allBiomes = Arrays.stream(XBiome.values()).collect(Collectors.toSet());
Set<XBiome> conditionBiomes = ((SpawnConditionBiome) spawnCondition).getBiomes();
if (allBiomes.equals(conditionBiomes)) {
currentSection2.set("Conditions.Biomes", "ALL");
} else {
currentSection2.set("Conditions.Biomes", String.join(", ", ((SpawnConditionBiome) spawnCondition).getBiomes().stream().map(XBiome::name).collect(Collectors.toSet())));
String biomesList = conditionBiomes.stream()
.map(XBiome::name)
.collect(Collectors.joining(", "));
currentSection2.set("Conditions.Biomes", biomesList);
}
}

if (spawnCondition instanceof SpawnConditionHeight) {
currentSection2.set("Conditions.Height", ((SpawnConditionHeight) spawnCondition).getMin() + ":" + ((SpawnConditionHeight) spawnCondition).getMax());
}
Expand Down

0 comments on commit f4440d7

Please sign in to comment.