Advertisement
Nuparu00

Climable

Nov 27th, 2017
552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. @Override
  2.     public void onUpdate()
  3.     {
  4.         super.onUpdate();
  5.  
  6.         if (!this.worldObj.isRemote)
  7.         {
  8.             this.setBesideClimbableBlock(this.isCollidedHorizontally);
  9.         }
  10.     }
  11.     public boolean isOnLadder()
  12.     {
  13.         return this.isBesideClimbableBlock();
  14.     }
  15.  
  16.     protected void entityInit()
  17.     {
  18.         super.entityInit();
  19.         this.dataWatcher.addObject(16, new Byte((byte)0));
  20.     }
  21.         public double getMountedYOffset()
  22.     {
  23.         return (double)(this.height * 0.5F);
  24.     }
  25.  
  26.      public boolean isBesideClimbableBlock()
  27.     {
  28.         return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
  29.     }
  30.     public void setBesideClimbableBlock(boolean p_70839_1_)
  31.     {
  32.         byte b0 = this.dataWatcher.getWatchableObjectByte(16);
  33.  
  34.         if (p_70839_1_)
  35.         {
  36.             b0 = (byte)(b0 | 1);
  37.         }
  38.         else
  39.         {
  40.             b0 = (byte)(b0 & -2);
  41.         }
  42.  
  43.         this.dataWatcher.updateObject(16, Byte.valueOf(b0));
  44.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement