getType error?

Discussion in 'Plugin Development' started by BasBloem, Feb 5, 2011.

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

    BasBloem

    Hello, I am trying to make some camera plugin, where you can set a center of a camera, and then it will copy it to the 'screen'.
    But in the copying part it won't copy for example Dirt and Cloth etc.
    It only copies the flowers and torches and all blocks that don't use the whole block(Graphicaly)
    Here is my current code:(The for loop to check for the blocks in the area)
    Code:
    //sX and sZ is the position of the camera
    //watchX and watchY and watchZ is the position of the screen
    
    for(int i=0;i<10;i++){
              for(int e=0;e<10;e++){
                        int onThisY = player.getWorld().getHighestBlockYAt(sX+e, sZ+i);
                        Block change = player.getWorld().getBlockAt(plugin.watchX-5+e,plugin.watchY,plugin.watchZ-5+i);
                        change.setTypeId(player.getWorld().getBlockTypeIdAt(sX+e, onThisY, sZ+i));
              }
    }
    Can anyone explain what I am doing wrong?
    I already tried setType and get it from the block instead of using the getBlockTypeIdAt function.

    Cheers!
     
  2. Offline

    mjmr89

    You could try checking to see if the highest block your camera is looking at is something like a torch, flowers, whatever (a bigass list of ors in an if statement) and if that block is one of those things, it subtracts one from onThisY so that its getting the block under the flower or torch or whatever Then again, if you have a torch on the wall with air under it you may be a bit SOL. Even without these checks, it should still see all dirt or stone or whatever that only has air on top of it.
     
  3. Offline

    BasBloem

    Well, it's not really any deal that a flower is on top, but where I can clearly see that a dirt block is on top(No flowers)
    It just ignores it? :/
     
  4. Offline

    mjmr89

    You know what - I think I remember that getHighestBlockYAt works oddly and would perfectly explain this behavior as normal. It gets the top AIR (or torch/flower/whatever) block! So you just need to do onThisY = gethighestblockyat(whatever) - 1
     
  5. Offline

    BasBloem

    Seriously? Lol xD
    Thanks, I'll test it out now :D
     
Thread Status:
Not open for further replies.

Share This Page