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 .