Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //class vars
- int side = -1;
- boolean onWall = false;
- long timer = 0;
- //in onLivingUpdate
- if (this.isCollidedHorizontally && !onWall) {
- if (worldObj.getBlockId((int)posX, (int)(posY - 1.5), (int)posZ) == 0 && rand.nextInt(4) > 2) {
- if (worldObj.getBlockId((int)posX-1, (int)posY, (int)posZ) == 0) {
- side = 1;
- } else if (worldObj.getBlockId((int)posX, (int)posY, (int)posZ-1) == 0) {
- side = 2;
- } else if (worldObj.getBlockId((int)posX+1, (int)posY, (int)posZ) == 0) {
- side = 3;
- } else if (worldObj.getBlockId((int)posX, (int)posY, (int)posZ+1) == 0) {
- side = 4;
- }
- //stick!, set onwall true, set timer
- onWall = true;
- timer = System.currentTimeMillis() + 5000;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement