private void DrawPrimitive( DrawSphere s, World w ) throws Exception
    {
        XMLBlockState blockType = new XMLBlockState(s.getType(), s.getColour(), null, s.getVariant());
        if (!blockType.isValid())
            throw new Exception("Unrecognised block type: " + s.getType().value());
 
        int radius = s.getRadius();
        for( int x = s.getX() - radius; x <= s.getX() + radius; x++ )
        {
            for( int y = s.getY() - radius; y <= s.getY() + radius; y++ )
            {
                for( int z = s.getZ() - radius; z <= s.getZ() + radius; z++ )
                {
                    if ((z - s.getZ()) * (z - s.getZ()) + (y - s.getY()) * (y - s.getY()) + (x - s.getX()) * (x - s.getX()) <= (radius*radius))
                    {
                        BlockPos pos = new BlockPos( x, y, z );
                        setBlockState( w, pos, blockType );
                        AxisAlignedBB aabb = new AxisAlignedBB(pos, new BlockPos(x+1, y+1, z+1));
                        clearEntities(w, aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ);
                    }
                }
            }
        }
    }
private void DrawPrimitive ( DrawSphere s , World w ) throws Exception { XMLBlockState blockType = new XMLBlockState ( s . getType ( ) , s . getColour ( ) , null , s . getVariant ( ) ) ; if ( ! blockType . isValid ( ) ) throw new Exception ( "Unrecognised block type: " + s . getType ( ) . value ( ) ) ; int radius = s . getRadius ( ) ; for ( int x = s . getX ( ) - radius ; x <= s . getX ( ) + radius ; x ++ ) { for ( int y = s . getY ( ) - radius ; y <= s . getY ( ) + radius ; y ++ ) { for ( int z = s . getZ ( ) - radius ; z <= s . getZ ( ) + radius ; z ++ ) { if ( ( z - s . getZ ( ) ) * ( z - s . getZ ( ) ) + ( y - s . getY ( ) ) * ( y - s . getY ( ) ) + ( x - s . getX ( ) ) * ( x - s . getX ( ) ) <= ( radius * radius ) ) { BlockPos pos = new BlockPos ( x , y , z ) ; setBlockState ( w , pos , blockType ) ; AxisAlignedBB aabb = new AxisAlignedBB ( pos , new BlockPos ( x + 1 , y + 1 , z + 1 ) ) ; clearEntities ( w , aabb . minX , aabb . minY , aabb . minZ , aabb . maxX , aabb . maxY , aabb . maxZ ) ; } } } } }
Draw a solid sphere made up of Minecraft blocks.
@param s Contains information about the sphere to be drawn.
@param w The world in which to draw.
@throws Exception Throws an exception if the block type is not recognised.