Problem Retrieving Blocks

Discussion in 'Plugin Development' started by savagesun, Jan 21, 2013.

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

    savagesun

    So, I'm trying to collect blocks in a certain radius from a clicked block, I'm using this method to collect the blocks:
    Code:
    private static ArrayList<Block> getBlocks(int radius, Block c) {
            ArrayList<Block> blocks = new ArrayList<Block>();
         
            for(int y = -radius; y <= radius; y++) {
                for(int z = -radius; z <= radius; z++) {
                    for(int x = -radius; x <= radius; x++) {
                        blocks.add(c.getRelative(x, y, z));
                        IOHelper.log(c.getRelative(x,y,z).getType().toString());
                    }
                }
            }
         
            blocks.add(c);//just incase..
         
            return blocks;
        }
    I'm using the IOHelper.log(string) to help me determine what blocks the method is actually collecting. I've noticed that regardless of what's around the block "c" I'll only receive Stone, Gravel, and Dirt. Am I not using getRelative correctly?

    EDIT: I now know that the search is off target. It's retrieving blocks from an area not centered around the block "c", but why?
     
  2. Offline

    savagesun

    Shameful bump
     
Thread Status:
Not open for further replies.

Share This Page