public bool SetTile(int x, int y, int z, byte type) { if (x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.depth || type < 0 || !Blocks.blockNames.ContainsValue(type)) { return(false); } //Handle basic physics tiles if (Blocks.BasicPhysics(type)) { /*if (Blocks.AffectedByGravity(type)) * { * Program.server.physics.SandGravelFall(x, y, z, type); * return true; * } * if (Blocks.AffectedBySponges(type) && Program.server.physics.FindSponge(x, y, z)) * { * return false; * }*/ Program.server.physics.Queue(x, y, z, type); } //Handle sponge deletion if (GetTile(x, y, z) == Blocks.sponge && type == 0) { Program.server.physics.DeleteSponge(x, y, z); } this.blocks[(y * this.depth + z) * this.width + x] = type; Player.GlobalBlockchange((short)x, (short)y, (short)z, Blocks.ConvertType(type)); return(true); }
public void DeleteSponge(int x, int y, int z) { for (int dx = -3; dx <= 3; dx++) { for (int dy = -3; dy <= 3; dy++) { for (int dz = -3; dz <= 3; dz++) { if (Blocks.BasicPhysics(world.GetTile(x + dx, y + dy, z + dz)) && world.GetTile(x + dx, y + dy, z + dz) != Blocks.air) { Queue(x + dx, y + dy, z + dz, world.GetTile(x + dx, y + dy, z + dz)); } } } } }
public void AirCheck(int x, int y, int z) { if (Blocks.BasicPhysics(world.GetTile(x + 1, y, z)) && world.GetTile(x + 1, y, z) != Blocks.air) { Queue(x + 1, y, z, world.GetTile(x + 1, y, z)); } if (Blocks.BasicPhysics(world.GetTile(x - 1, y, z)) && world.GetTile(x - 1, y, z) != Blocks.air) { Queue(x - 1, y, z, world.GetTile(x - 1, y, z)); } if (Blocks.BasicPhysics(world.GetTile(x, y, z + 1)) && world.GetTile(x, y, z + 1) != Blocks.air) { Queue(x, y, z + 1, world.GetTile(x, y, z + 1)); } if (Blocks.BasicPhysics(world.GetTile(x, y, z - 1)) && world.GetTile(x, y, z - 1) != Blocks.air) { Queue(x, y, z - 1, world.GetTile(x, y, z - 1)); } if (Blocks.BasicPhysics(world.GetTile(x, y + 1, z)) && world.GetTile(x, y + 1, z) != Blocks.air) { Queue(x, y + 1, z, world.GetTile(x, y + 1, z)); } }