37 lines
1.3 KiB
Java
37 lines
1.3 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.mojang.datafixers.kinds.App
|
|
* com.mojang.datafixers.kinds.Applicative
|
|
* com.mojang.serialization.MapCodec
|
|
* com.mojang.serialization.codecs.RecordCodecBuilder
|
|
*/
|
|
package net.minecraft.world.entity.variant;
|
|
|
|
import com.mojang.datafixers.kinds.App;
|
|
import com.mojang.datafixers.kinds.Applicative;
|
|
import com.mojang.serialization.MapCodec;
|
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|
import net.minecraft.core.HolderSet;
|
|
import net.minecraft.core.RegistryCodecs;
|
|
import net.minecraft.core.registries.Registries;
|
|
import net.minecraft.world.entity.variant.SpawnCondition;
|
|
import net.minecraft.world.entity.variant.SpawnContext;
|
|
import net.minecraft.world.level.biome.Biome;
|
|
|
|
public record BiomeCheck(HolderSet<Biome> requiredBiomes) implements SpawnCondition
|
|
{
|
|
public static final MapCodec<BiomeCheck> MAP_CODEC = RecordCodecBuilder.mapCodec(i -> i.group((App)RegistryCodecs.homogeneousList(Registries.BIOME).fieldOf("biomes").forGetter(BiomeCheck::requiredBiomes)).apply((Applicative)i, BiomeCheck::new));
|
|
|
|
@Override
|
|
public boolean test(SpawnContext context) {
|
|
return this.requiredBiomes.contains(context.biome());
|
|
}
|
|
|
|
public MapCodec<BiomeCheck> codec() {
|
|
return MAP_CODEC;
|
|
}
|
|
}
|
|
|