Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- public class Neighbors implements Iterator
- {
- private byte cur;
- private World worldinstance;
- public Neighbors(World world)
- {
- cur=0;
- worldinstance = world;
- }
- public boolean hasNext()
- {
- return cur<6;
- }
- public Object next()
- {
- cur++;
- switch(cur)
- {
- case 1:
- return Block.blockList[worldinstance.getBlockId(x-1, y, z)]
- break;
- case 2:
- return Block.blockList[worldinstance.getBlockId(x+1, y, z)]
- break;
- case 3:
- return Block.blockList[worldinstance.getBlockId(x, y, z-1)]
- break;
- case 4:
- return Block.blockList[worldinstance.getBlockId(x, y, z+1)]
- break;
- case 5:
- return Block.blockList[worldinstance.getBlockId(x, y-1, z)]
- break;
- case 6:
- return Block.blockList[worldinstance.getBlockId(x, y+1, z)]
- break;
- }
- }
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement