Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //SWIMMING CODE::: Java Field Reflection errors -_-
- if(entity instanceof EntityLivingBase)
- {
- EntityLivingBase elb = (EntityLivingBase)entity;
- Class elb_class = elb.getClass();
- boolean jumping = false;
- try {
- Field field = elb.getClass().getDeclaredField("isJumping"); //erroring
- field.setAccessible(true);
- jumping = field.getBoolean(elb);
- } catch (Exception e) {
- //Removed e.printstacktrace because it was causing major lag. This
- //Means that something is going wrong and I think it's because it can't find "isJumping"
- //isJumping is a protected boolean value.
- }
- if(jumping)
- {
- //Swimming code that works (if -if(jumping)- is taken away it auto-jumps)
- BloodLiquidEEP bloodLiquidProps = BloodLiquidEEP.get(elb);
- bloodLiquidProps.checkIsInLiquid();
- if(bloodLiquidProps.getIsInLiquid())
- {
- elb.motionY += 0.03999999910593033D;
- }
- else
- {
- if(elb.onGround)
- {
- elb.setJumping(true);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement