Advertisement
Guest User

Untitled

a guest
Dec 4th, 2015
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1.     //SWIMMING CODE:::     Java Field Reflection errors -_-
  2.     if(entity instanceof EntityLivingBase)
  3.         {
  4.             EntityLivingBase elb = (EntityLivingBase)entity;
  5.             Class elb_class = elb.getClass();
  6.             boolean jumping = false;
  7.             try {
  8.                 Field field = elb.getClass().getDeclaredField("isJumping"); //erroring
  9.                 field.setAccessible(true);
  10.                 jumping = field.getBoolean(elb);
  11.             } catch (Exception e) {
  12.                 //Removed e.printstacktrace because it was causing major lag. This
  13.                 //Means that something is going wrong and I think it's because it can't find "isJumping"
  14.                 //isJumping is a protected boolean value.
  15.             }
  16.            
  17.             if(jumping)
  18.             {
  19.                 //Swimming code that works (if -if(jumping)- is taken away it auto-jumps)
  20.                 BloodLiquidEEP bloodLiquidProps = BloodLiquidEEP.get(elb);
  21.                 bloodLiquidProps.checkIsInLiquid();
  22.                 if(bloodLiquidProps.getIsInLiquid())
  23.                 {
  24.                     elb.motionY += 0.03999999910593033D;
  25.                 }
  26.                 else
  27.                 {
  28.                     if(elb.onGround)
  29.                     {
  30.                         elb.setJumping(true);
  31.                     }
  32.                 }
  33.             }
  34.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement