Advertisement
Corosus

Untitled

Aug 9th, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. //class vars
  2.            int side = -1;
  3.            boolean onWall = false;
  4.            long timer = 0;
  5.            
  6.            //in onLivingUpdate
  7.            if (this.isCollidedHorizontally && !onWall) {
  8.                if (worldObj.getBlockId((int)posX, (int)(posY - 1.5), (int)posZ) == 0 && rand.nextInt(4) > 2) {
  9.                    
  10.                    if (worldObj.getBlockId((int)posX-1, (int)posY, (int)posZ) == 0) {
  11.                        side = 1;
  12.                    } else if (worldObj.getBlockId((int)posX, (int)posY, (int)posZ-1) == 0) {
  13.                        side = 2;
  14.                    } else if (worldObj.getBlockId((int)posX+1, (int)posY, (int)posZ) == 0) {
  15.                        side = 3;
  16.                    } else if (worldObj.getBlockId((int)posX, (int)posY, (int)posZ+1) == 0) {
  17.                        side = 4;
  18.                    }  
  19.                    
  20.                        
  21.                    
  22.                    //stick!, set onwall true, set timer
  23.                    onWall = true;
  24.                    timer = System.currentTimeMillis() + 5000;
  25.                }
  26.            }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement