Skip to content

Commit

Permalink
Variant helper for biomes added
Browse files Browse the repository at this point in the history
Added:
 - Variant helper function to return a fish that can only spawn in certain biomes
  • Loading branch information
dragonflame86 committed Jun 3, 2024
1 parent 56a460b commit f0e43ec
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import net.minecraft.world.LocalDifficulty
import net.minecraft.world.ServerWorldAccess
import net.minecraft.world.World
import net.minecraft.world.WorldAccess
import net.minecraft.world.biome.Biome
import software.bernie.geckolib.animatable.GeoEntity
import software.bernie.geckolib.core.animatable.GeoAnimatable
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache
Expand Down Expand Up @@ -452,5 +453,13 @@ open class HybridAquaticFishEntity(
val modelID : Identifier,
val textureID : Identifier,
val spawnCondition: (WorldAccess, SpawnReason, BlockPos, SpawnReason, ) -> Boolean
)
) {
companion object {
fun biomeVariant(animationID: Identifier, modelID: Identifier, textureID: Identifier, biomes : TagKey<Biome>): FishVariant {
return FishVariant(animationID, modelID, textureID) { world, _, pos, _ ->
world.getBiome(pos).isIn(biomes)
}
}
}
}
}

0 comments on commit f0e43ec

Please sign in to comment.