protected override void OnProcessSurface(MCUtils.World world, int x, int y, int z, int pass, float mask) { if (random.NextDouble() <= chance && world.IsAir(x, y + 1, z)) { world.SetBlock(x, y + 1, z, "minecraft:torch"); } }
public override void ProcessSurface(MCUtils.World world, int x, int y, int z) { if (random.NextDouble() <= chance && world.IsAir(x, y + 1, z)) { world.SetBlock(x, y + 1, z, "minecraft:torch"); } }
private bool BuildStructure(string s, MCUtils.World world, int x, int y, int z) { if (!structureDatas.ContainsKey(s)) { RegisterStructure(s); } return(structureDatas[s].Generate(world, x, y, z, rand)); }
private void MakeLayer(MCUtils.World world, int x, int y, int z, string[] blocks) { for (int i = 0; i < blocks.Length; i++) { if (!string.IsNullOrWhiteSpace(blocks[i]) && !world.IsAir(x, y, z)) { world.SetBlock(x, y - i, z, blocks[i]); } } }
public override void ProcessSurface(MCUtils.World world, int x, int y, int z) { var id = maps["main"][x, z]; if (biomes.ContainsKey(id)) { biomes[id].RunGenerator(world, x, y, z); world.SetBiome(x, z, biomes[id].biomeID); } }
public override void ProcessBlock(MCUtils.World world, int x, int y, int z) { foreach (Ore o in ores) { if (random.NextDouble() * rarityMul < o.spawnsPerBlock) { SpawnOre(world, o, x, y, z); } } }
private void SpawnOre(MCUtils.World world, Ore ore, int x, int y, int z) { for (int i = 0; i < ore.veinSizeMax; i++) { int x1 = x + RandomRange(-1, 1); int y1 = y + RandomRange(-1, 1); int z1 = z + RandomRange(-1, 1); if (world.IsDefaultBlock(x1, y1, z1)) { world.SetBlock(x1, y1, z1, ore.block); } } }
protected override void OnProcessSurface(MCUtils.World world, int x, int y, int z, int pass, float mask) { //Place trees if (random.NextDouble() <= treesChance) { if (PlaceTree(world, x, y + 1, z)) { //A tree was placed, there is nothing left to do here return; } } //Place tall grass if (random.NextDouble() <= grassChance) { PlaceGrass(world, x, y + 1, z); } }
public override void ProcessSurface(MCUtils.World world, int x, int y, int z) { //Place grass on top & 3 layers of dirt below if (y > waterLevel + 1) { world.SetBlock(x, y, z, "minecraft:grass_block"); for (int i = 1; i < 4; i++) { world.SetBlock(x, y - i, z, "minecraft:dirt"); } } else { for (int i = 0; i < 4; i++) { world.SetBlock(x, y - i, z, "minecraft:gravel"); } } }
public override void ProcessBlock(MCUtils.World world, int x, int y, int z) { //Make flat bedrock if (y == 0) { if (world.IsDefaultBlock(x, 0, z)) { world.SetBlock(x, 0, z, "minecraft:bedrock"); } } //Fill the terrain with water up to the waterLevel if (y <= waterLevel) { if (world.IsAir(x, y, z)) { world.SetBlock(x, y, z, "minecraft:water"); } } }
public void RunGenerator(MCUtils.World world, int x, int y, int z) { if (world.GetBlock(x, y, z) != "minecraft:grass_block") { return; } foreach (var k in mainStructures.Keys) { if (rand.NextDouble() < mainStructures[k] && BuildStructure(k, world, x, y + 1, z)) { return; } } foreach (var k in decorStructures.Keys) { if (rand.NextDouble() < decorStructures[k] && BuildSingleBlock(k, world, x, y + 1, z)) { return; } } }
public override void ProcessSurface(MCUtils.World world, int x, int y, int z) { foreach (string map in maps.Keys) { byte mappedValue = maps[map][x, z]; if (mappedValue > 0) { MakeLayer(world, x, y, z, layers[mappedValue]); } } if (waterSurfaceMap != null) { for (byte y2 = waterSurfaceMap[x, z]; y2 > y; y2--) { world.SetBlock(x, y2, z, waterBlock); } } if (biomePostProcessor != null) { biomePostProcessor.ProcessSurface(world, x, y, z); } }
public override void ProcessBlock(MCUtils.World world, int x, int y, int z) { if (y == 0) { world.SetBlock(x, 0, z, "bedrock"); if (!flatBedrock) { if (random.NextDouble() < 0.75f) { world.SetBlock(x, 1, z, "bedrock"); } if (random.NextDouble() < 0.50f) { world.SetBlock(x, 2, z, "bedrock"); } if (random.NextDouble() < 0.25f) { world.SetBlock(x, 3, z, "bedrock"); } } } }
private bool PlaceTree(MCUtils.World world, int x, int y, int z) { var b = world.GetBlock(x, y - 1, z); if (b == null || !CanGrowPlant(b)) { return(false); } int bareTrunkHeight = random.Next(1, 4); int w = treeRadius; if (!world.IsAir(x, y + 1, z)) { return(false); } //if(IsObstructed(region, x, y+1, z, x, y+bareTrunkHeight, z) || IsObstructed(region, x-w, y+bareTrunkHeight, z-w, x+w, y+bareTrunkHeight+treeTopHeight, z+w)) return false; world.SetBlock(x, y - 1, z, "minecraft:dirt"); for (int i = 0; i <= bareTrunkHeight; i++) { world.SetBlock(x, y + i, z, "minecraft:oak_log"); } for (int ly = 0; ly < treeTopHeight; ly++) { for (int lz = 0; lz < 2 * treeRadius + 1; lz++) { for (int lx = 0; lx < 2 * treeRadius + 1; lx++) { int palette = blueprintOakTreeTop[ly, lz, lx]; if (palette > 0) { string block = palette == 1 ? "minecraft:oak_log" : "minecraft:oak_leaves"; world.SetBlock(x + lx - treeRadius, y + ly + bareTrunkHeight + 1, z + lz - treeRadius, block); } } } } return(true); }
public virtual void ProcessSurface(MCUtils.World world, int x, int y, int z) { }
public virtual void ProcessBlock(MCUtils.World world, int x, int y, int z) { }
private bool BuildSingleBlock(string s, MCUtils.World world, int x, int y, int z) { world.SetBlock(x, y, z, s); return(true); }
public virtual void OnFinish(MCUtils.World world) { }