public void GrowTree(IBlockAccessor api, BlockPos pos, float sizeModifier = 1f, float vineGrowthChance = 0, float forestDensity = 0) { this.pos = pos; this.api = api; this.size = sizeModifier * config.sizeMultiplier; this.vineGrowthChance = vineGrowthChance; pos.Up(config.yOffset); TreeGenTrunk[] trunks = config.trunks; branchesByDepth.Clear(); branchesByDepth.Add(null); branchesByDepth.AddRange(config.branches); for (int i = 0; i < trunks.Length; i++) { TreeGenTrunk trunk = config.trunks[i]; if (rand.NextDouble() <= trunk.probability) { branchesByDepth[0] = trunk; growBranch( 0, pos, trunk.dx, 0f, trunk.dz, trunk.angleVert.nextFloat(), trunk.angleHori.nextFloat(), size * trunk.widthMultiplier, Math.Max(0, trunk.dieAt.nextFloat()) ); } } }
public void GrowTree(IBlockAccessor api, BlockPos pos, bool isShrubLayer, float sizeModifier = 1f, float vineGrowthChance = 0, float otherBlockChance = 1f, int treesInChunkGenerated = 0) { Random rnd = rand.Value; lcgrandTL.Value.InitPositionSeed(pos.X, pos.Z); this.api = api; this.size = sizeModifier * config.sizeMultiplier + config.sizeVar.nextFloat(1, rnd); this.vineGrowthChance = vineGrowthChance; this.otherBlockChance = otherBlockChance; pos.Up(config.yOffset); TreeGenTrunk[] trunks = config.trunks; branchesByDepth.Clear(); branchesByDepth.Add(null); branchesByDepth.AddRange(config.branches); forestFloor.ClearOutline(); TreeGenTrunk trunk = config.trunks[0]; float trunkHeight = Math.Max(0, trunk.dieAt.nextFloat(1, rnd)); float trunkWidthLoss = trunk.WidthLoss(rnd); for (int i = 0; i < trunks.Length; i++) { trunk = config.trunks[i]; if (rnd.NextDouble() <= trunk.probability) { branchesByDepth[0] = trunk; growBranch( rnd, 0, pos, trunk.dx, 0f, trunk.dz, trunk.angleVert.nextFloat(1, rnd), trunk.angleHori.nextFloat(1, rnd), size * trunk.widthMultiplier, trunkHeight, trunkWidthLoss, trunks.Length > 1 ); } } if (!isShrubLayer) { forestFloor.CreateForestFloor(api, config, pos, lcgrandTL.Value, treesInChunkGenerated); } }