Fixed crash with assume abstract BiomeSources

This commit is contained in:
Frank 2022-07-08 17:02:39 +02:00
parent 92ff27f2f8
commit 5fd087d8b7
2 changed files with 6 additions and 6 deletions

View file

@ -3,17 +3,17 @@ package org.betterx.worlds.together.biomesource;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeSource;
import java.util.Set;
public interface BiomeSourceFromRegistry {
public interface BiomeSourceFromRegistry<T extends BiomeSource> {
Registry<Biome> getBiomeRegistry();
Set<Holder<Biome>> possibleBiomes();
default boolean sameRegistryButDifferentBiomes(BiomeSourceFromRegistry other) {
default <R extends BiomeSource> boolean sameRegistryButDifferentBiomes(BiomeSourceFromRegistry<R> other) {
if (other.getBiomeRegistry() == getBiomeRegistry()) {
Set<Holder<Biome>> mySet = this.possibleBiomes();
Set<Holder<Biome>> otherSet = other.possibleBiomes();
Set<Holder<Biome>> mySet = ((T) this).possibleBiomes();
Set<Holder<Biome>> otherSet = ((R) other).possibleBiomes();
if (otherSet.size() != mySet.size()) return true;
for (Holder<Biome> b : mySet) {
if (!otherSet.contains(b))