Esempio n. 1
0
 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");
     }
 }
Esempio n. 3
0
 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)
 {
     //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");
         }
     }
 }
Esempio n. 6
0
 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);
         }
     }
 }
 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");
             }
         }
     }
 }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
 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);
     }
 }
Esempio n. 10
0
 private bool BuildSingleBlock(string s, MCUtils.World world, int x, int y, int z)
 {
     world.SetBlock(x, y, z, s);
     return(true);
 }