Exemplo n.º 1
0
        public void GrowTallGrass(int value, int x, int y, int z, int pollPass)
        {
            int data = Terrain.ExtractData(value);

            if (TallGrassBlock.GetIsSmall(data) && Terrain.ExtractLight(base.SubsystemTerrain.Terrain.GetCellValueFast(x, y + 1, z)) >= 9)
            {
                int data2  = TallGrassBlock.SetIsSmall(data, isSmall: false);
                int value2 = Terrain.ReplaceData(value, data2);
                m_toReplace[new Point3(x, y, z)] = new Replacement
                {
                    Value         = value2,
                    RequiredValue = value
                };
            }
        }
Exemplo n.º 2
0
        public override BlockPlacementData GetPlacementValue(SubsystemTerrain subsystemTerrain, ComponentMiner componentMiner, int value, TerrainRaycastResult raycastResult)
        {
            BlockPlacementData result = default(BlockPlacementData);

            result.CellFace = raycastResult.CellFace;
            if (raycastResult.CellFace.Face == 4)
            {
                switch (Terrain.ExtractData(value))
                {
                case 0:
                    result.Value = Terrain.MakeBlockValue(19, 0, TallGrassBlock.SetIsSmall(0, isSmall: true));
                    break;

                case 1:
                    result.Value = Terrain.MakeBlockValue(20, 0, FlowerBlock.SetIsSmall(0, isSmall: true));
                    break;

                case 2:
                    result.Value = Terrain.MakeBlockValue(24, 0, FlowerBlock.SetIsSmall(0, isSmall: true));
                    break;

                case 3:
                    result.Value = Terrain.MakeBlockValue(25, 0, FlowerBlock.SetIsSmall(0, isSmall: true));
                    break;

                case 4:
                    result.Value = Terrain.MakeBlockValue(174, 0, RyeBlock.SetSize(RyeBlock.SetIsWild(0, isWild: false), 0));
                    break;

                case 5:
                    result.Value = Terrain.MakeBlockValue(174, 0, RyeBlock.SetSize(RyeBlock.SetIsWild(0, isWild: false), 0));
                    break;

                case 6:
                    result.Value = Terrain.MakeBlockValue(204, 0, CottonBlock.SetSize(CottonBlock.SetIsWild(0, isWild: false), 0));
                    break;

                case 7:
                    result.Value = Terrain.MakeBlockValue(131, 0, BasePumpkinBlock.SetSize(BasePumpkinBlock.SetIsDead(0, isDead: false), 0));
                    break;
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        public static int GenerateRandomPlantValue(Random random, int groundValue, int temperature, int humidity, int y)
        {
            switch (Terrain.ExtractContents(groundValue))
            {
            case 2:
            case 8:
                if (humidity >= 6)
                {
                    if (!(random.Float(0f, 1f) < (float)humidity / 60f))
                    {
                        break;
                    }
                    int result = Terrain.MakeBlockValue(19, 0, TallGrassBlock.SetIsSmall(0, isSmall: false));
                    if (!SubsystemWeather.IsPlaceFrozen(temperature, y))
                    {
                        float num = random.Float(0f, 1f);
                        if (num < 0.04f)
                        {
                            result = Terrain.MakeBlockValue(20);
                        }
                        else if (num < 0.07f)
                        {
                            result = Terrain.MakeBlockValue(24);
                        }
                        else if (num < 0.09f)
                        {
                            result = Terrain.MakeBlockValue(25);
                        }
                        else if (num < 0.17f)
                        {
                            result = Terrain.MakeBlockValue(174, 0, RyeBlock.SetIsWild(RyeBlock.SetSize(0, 7), isWild: true));
                        }
                        else if (num < 0.19f)
                        {
                            result = Terrain.MakeBlockValue(204, 0, CottonBlock.SetIsWild(CottonBlock.SetSize(0, 2), isWild: true));
                        }
                    }
                    return(result);
                }
                if (random.Float(0f, 1f) < 0.025f)
                {
                    if (random.Float(0f, 1f) < 0.2f)
                    {
                        return(Terrain.MakeBlockValue(99, 0, 0));
                    }
                    return(Terrain.MakeBlockValue(28, 0, 0));
                }
                break;

            case 7:
                if (humidity < 8 && random.Float(0f, 1f) < 0.01f)
                {
                    if (random.Float(0f, 1f) < 0.05f)
                    {
                        return(Terrain.MakeBlockValue(99, 0, 0));
                    }
                    return(Terrain.MakeBlockValue(28, 0, 0));
                }
                break;
            }
            return(0);
        }