Radius around player (again) sets wrong place

Discussion in 'Plugin Development' started by Snowl, May 3, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Snowl

    When I do something like this:
    Code:
            int x = event.getBlock().getX();
            int y = event.getBlock().getY();
            int z = event.getBlock().getZ();
    
            int radius = 5;
    
            System.out.println(x);
    
            for(x=-radius;x<=radius;x++){
                for(y=-radius;y<=radius;y++){
                    for(z=-radius;z<=radius;z++){
                        if(x*x + y*y + z*z > radius*radius)
                        {
                            continue;
                        }
                        if (y>127 || y<0)
                        {
                            continue;
                        }
                        System.out.println(event.getPlayer().getWorld().getBlockAt(x, y, z).getType().toString());
                        break;
                    }
                }
            }
    x y and z always set to 5 (the radius)

    What's wrong with my code? :S
     
  2. Offline

    Jayjay110

    I think it is wrong because your saying only continue if y is greater than 127, and less than 0? that doesnt make sense at all? is it supposed to be the other way round?
     
Thread Status:
Not open for further replies.

Share This Page