Nothing Happens When Calling a Method

Discussion in 'Plugin Development' started by Jeff.Halbert, Jan 15, 2013.

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


    I created a method that will gather the (x,z) locations for all locations in the same biome I am standing in. y location never changes. But when I call the method, nothing happens. Nothing at all. Here is a link to the method...

    I'm not getting any errors from console. Any Ideas?
  2. Offline



    it's nice that you are trying to do like this. But just for your information:

    When i get it right you are trying to get all blocks around you which are in a specific radius to check whether they are in the same biome as the location is?

    Then it would be alot easier you will use the Point class ( ) and Rectangle class ( )
    You can create a list of all points around you in this specific radius and trying to get the type of biome.

    Simple and short example:

    2. // Your area to check
    3. Rectangle rectangle = new Rectangle((int)loc.getX()-rad, (int)loc.getZ()-rad, rad*2, rad*2);
    5. // Lists of points
    6. List<Point> biomePoints = new ArrayList<Point>();
    8. // Check until max z
    9. for ( int z = 0; z <= rectangle.getMaxY(); z++ ) {
    11. // Check until max x
    12. for ( int x = 0; x <= rectangle.getMaxX(); x++ ) {
    14. // Check whether its your biome
    15. Location actLoc = new Location(loc.getWorld(),x,0,z);
    16. if ( actLoc.getBlock().getBiome() == biome ) {
    18. // Save the point
    19. biomePoints.add(new Point(x, z));
    21. }
    23. }
    25. }
  3. Offline


    that would definitely been WAY more easier... the only issue is, I would be over lapping in every loop iteration... but still, way easier. Thanks man.

    But still, it doesn't explain why there is no result at all... still so lost....
  4. Offline


    First of all you are welcome. Could you explain what you are mean with overlapping?

    Edit: Here is the fix if you mean that ( i think that should work ):

    2. // Check until max z
    3. for (int z = (int) rectangle.getMinY(); z <= rectangle.getMaxY(); z++) {
    5. // Check until max x
    6. for (int x = (int) rectangle.getMinX(); x <= rectangle.getMaxX(); x++) {

    You could try to debug. Insert in every iteration loop a logger#info or out#println. This is what actually is also used in the professional programming and it will help you to go through the steps of your programm and understand whats going on there.
  5. Offline


    yeah... i'm going to have to do that.... just so i can see where i'm going wrong.
  6. Offline


    Tell me if get stuck on that.
Thread Status:
Not open for further replies.

Share This Page