[Fix] DataPack Biomes from other mods are loaded after the WorldStem was first built. Our Biomes-Sources would not recognize that change (#16)
This commit is contained in:
parent
3b0f609776
commit
a73bd23ddf
3 changed files with 39 additions and 2 deletions
|
@ -0,0 +1,26 @@
|
|||
package org.betterx.worlds.together.biomesource;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public interface BiomeSourceFromRegistry {
|
||||
Registry<Biome> getBiomeRegistry();
|
||||
Set<Holder<Biome>> possibleBiomes();
|
||||
|
||||
default boolean sameRegistryButDifferentBiomes(BiomeSourceFromRegistry other) {
|
||||
if (other.getBiomeRegistry() == getBiomeRegistry()) {
|
||||
Set<Holder<Biome>> mySet = this.possibleBiomes();
|
||||
Set<Holder<Biome>> otherSet = other.possibleBiomes();
|
||||
if (otherSet.size() != mySet.size()) return true;
|
||||
for (Holder<Biome> b : mySet) {
|
||||
if (!otherSet.contains(b))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package org.betterx.worlds.together.chunkgenerator;
|
||||
|
||||
import org.betterx.worlds.together.biomesource.BiomeSourceFromRegistry;
|
||||
import org.betterx.worlds.together.biomesource.BiomeSourceWithConfig;
|
||||
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
|
@ -28,8 +29,14 @@ public interface EnforceableChunkGenerator<G extends ChunkGenerator> {
|
|||
if (one == two) return false;
|
||||
|
||||
if (one instanceof BiomeSourceWithConfig<?, ?> ba && two instanceof BiomeSourceWithConfig<?, ?> bb) {
|
||||
return !ba.getTogetherConfig().couldSetWithoutRepair(bb.getTogetherConfig());
|
||||
if (!ba.getTogetherConfig().couldSetWithoutRepair(bb.getTogetherConfig()))
|
||||
return true;
|
||||
}
|
||||
if (one instanceof BiomeSourceFromRegistry ba && two instanceof BiomeSourceFromRegistry bb) {
|
||||
if (ba.sameRegistryButDifferentBiomes(bb))
|
||||
return true;
|
||||
}
|
||||
|
||||
return !one.getClass().isAssignableFrom(two.getClass()) && !two.getClass().isAssignableFrom(one.getClass());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue