private bool CanSpawnAt(IBlockAccessor blockAccessor, EntityProperties type, BlockPos pos, Vec3d posAsVec, BaseSpawnConditions sc, float rain, float temp, float forestDensity, float shrubsDensity) { if (!api.World.BlockAccessor.IsValidPos(pos)) { return(false); } float?lightLevel = blockAccessor.GetLightLevel(pos, EnumLightLevelType.MaxLight); if (lightLevel == null) { return(false); } if (sc.MinLightLevel > lightLevel || sc.MaxLightLevel < lightLevel) { return(false); } if (sc.MinTemp > temp || sc.MaxTemp < temp) { return(false); } if (sc.MinRain > rain || sc.MaxRain < rain) { return(false); } if (sc.MinForest > forestDensity || sc.MaxForest < forestDensity) { return(false); } if (sc.MinShrubs > shrubsDensity || sc.MaxShrubs < shrubsDensity) { return(false); } if (sc.MinForestOrShrubs > Math.Max(forestDensity, shrubsDensity)) { return(false); } Block belowBlock = blockAccessor.GetBlock(pos.X, pos.Y - 1, pos.Z); if (!belowBlock.CanCreatureSpawnOn(blockAccessor, pos.DownCopy(), type, sc)) { return(false); } Block block = blockAccessor.GetBlock(pos); if (!block.WildCardMatch(sc.InsideBlockCodes)) { return(false); } Cuboidf collisionBox = type.SpawnCollisionBox.OmniNotDownGrowBy(0.1f); return(!IsColliding(collisionBox, posAsVec)); }