コード例 #1
0
ファイル: BlockSoil.cs プロジェクト: bitcynth/vssurvivalmod
        private bool isAppropriateClimateToGrow(IWorldAccessor world, BlockPos pos, AssetLocation blockCode, ClimateCondition climate)
        {
            ICoreServerAPI api       = (ICoreServerAPI)world.Api;
            int            mapheight = api.WorldManager.MapSizeY;

            BlockLayers layers = getBlockLayers(world);
            BlockLayer  bl     = layers.GetBlockLayerForNextGrowthStage(world, blockCode);

            //Check climate conditions to see whether the soil can grow to the next stage
            return(
                climate.Temperature >= bl.MinTemp && climate.Temperature <= bl.MaxTemp &&
                climate.Rainfall >= bl.MinRain && climate.Rainfall <= bl.MaxRain &&
                climate.Fertility >= bl.MinFertility && climate.Fertility <= bl.MaxFertility &&
                (float)pos.Y / mapheight <= bl.MaxY
                );
        }