Solved Trouble setting Y value for a new location

Discussion in 'Plugin Development' started by Musaddict, Aug 3, 2013.

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

    Musaddict

    Ok, se here's a snippet of my code:

    Code:java
    1. Block block1 = new Location(loc.getWorld(), blockX, (double) 256, blockZ).getBlock();
    2. Block block2 = new Location(loc.getWorld(), blockX, (double) 256, (blockZ + maxZ)).getBlock();
    3. Block block3 = new Location(loc.getWorld(), (blockX+maxX), (double) 256, blockZ).getBlock();
    4. Block block4 = new Location(loc.getWorld(), (blockX+maxX), (double) 256, (blockZ + maxZ)).getBlock();
    5.  
    6. CSPlugin.Log("block1 " + block1.getLocation());
    7. CSPlugin.Log("block2 " + block2.getLocation());
    8. CSPlugin.Log("block3 " + block3.getLocation());
    9. CSPlugin.Log("block4 " + block4.getLocation());


    • blockX is the base X value
    • blockZ is the base Z value
    • maxX is an added X value
    • maxZ is an added Z value
    essentially, i'm creating four locations in a square, all locations should have a height of 256. Only problem? All of the values are being entered properly into the location, but the Y value (256) is saving as 0...
    Here's what's printed to the console immediately after I create the location:

    Code:
    block1 Location{world=CraftWorld{name=world}, x=-400.00, y=0.0, z=-137.0, pitch=0.0, yaw=0.0}
    block2 Location{world=CraftWorld{name=world}, x=-400.00, y=0.0, z=-115.0, pitch=0.0, yaw=0.0}
    block1 Location{world=CraftWorld{name=world}, x=-381.00, y=0.0, z=-137.0, pitch=0.0, yaw=0.0}
    block1 Location{world=CraftWorld{name=world}, x=-381.00, y=0.0, z=-115.0, pitch=0.0, yaw=0.0}
    
    It's printing that Y is 0, even though I'm setting it to 256 immediately before... Any ideas?
    .
    .
    Edit: I also tried assigning 256 to a variable, and plugging that in instead (to match the X and Z), and that did not work either.

    0-255, not 1-256. Got it. Works with 255.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
Thread Status:
Not open for further replies.

Share This Page