From 1fa3b22c57dbce987af597c2d47a68faf8dba6e2 Mon Sep 17 00:00:00 2001 From: fullwall Date: Mon, 23 Oct 2023 18:32:34 +0800 Subject: [PATCH] Properly forward slime jump to move controller in 1.17+ --- .../v1_10_R1/util/PlayerControllerMove.java | 19 ++---- .../v1_11_R1/util/PlayerControllerMove.java | 16 ++--- .../v1_12_R1/util/PlayerControllerMove.java | 16 ++--- .../v1_13_R2/util/PlayerControllerMove.java | 16 ++--- .../v1_14_R1/util/PlayerControllerMove.java | 16 ++--- .../v1_15_R1/util/PlayerControllerMove.java | 16 ++--- .../nms/v1_16_R3/util/EntityMoveControl.java | 20 ++---- .../nms/v1_17_R1/util/EntityMoveControl.java | 25 ++++--- .../nms/v1_18_R2/util/EntityMoveControl.java | 23 +++---- .../nms/v1_19_R3/util/EntityMoveControl.java | 23 +++---- .../nms/v1_20_R2/entity/SlimeController.java | 10 ++- .../nms/v1_20_R2/util/EntityMoveControl.java | 66 +++++++++---------- .../v1_8_R3/util/PlayerControllerMove.java | 16 ++--- 13 files changed, 103 insertions(+), 179 deletions(-) diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/PlayerControllerMove.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/PlayerControllerMove.java index dfee30f5b..ab0347d0a 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/PlayerControllerMove.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/PlayerControllerMove.java @@ -86,9 +86,11 @@ public class PlayerControllerMove extends ControllerMove { float movement = (float) (this.e * speed.getValue()); this.a.l(movement); this.a.bg = movement; - if (shouldSlimeJump() || ((d2 >= NMS.getStepHeight(a.getBukkitEntity())) && (d0 * d0 + d1 * d1 < 1.0D))) { - this.h = cg(); + if (a instanceof EntitySlime && h-- <= 0) { + this.h = new Random().nextInt(20) + 10; this.h /= 3; + ((EntityInsentient) this.a).getControllerJump().a(); + } else if (d2 >= NMS.getStepHeight(a.getBukkitEntity()) && (d0 * d0 + d1 * d1) < 1.0D) { if (this.a instanceof EntityHumanNPC) { ((EntityHumanNPC) this.a).getControllerJump().a(); } else { @@ -114,16 +116,5 @@ public class PlayerControllerMove extends ControllerMove { @Override public double f() { - return this.d; - } - - private boolean shouldSlimeJump() { - if (!(this.a instanceof EntitySlime)) { - return false; - } - if (this.h-- <= 0) { - return true; - } - return false; - } + return thi } \ No newline at end of file diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/PlayerControllerMove.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/PlayerControllerMove.java index 7459f4b0e..34a47ddd0 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/PlayerControllerMove.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/PlayerControllerMove.java @@ -88,9 +88,11 @@ public class PlayerControllerMove extends ControllerMove { float movement = (float) (this.e * speed.getValue()); this.a.l(movement); this.a.bf = movement; - if (shouldSlimeJump() || ((d2 >= NMS.getStepHeight(a.getBukkitEntity())) && (d0 * d0 + d1 * d1 < 1.0D))) { - this.h = cg(); + if (a instanceof EntitySlime && h-- <= 0) { + this.h = new Random().nextInt(20) + 10; this.h /= 3; + ((EntityInsentient) this.a).getControllerJump().a(); + } else if (d2 >= NMS.getStepHeight(a.getBukkitEntity()) && (d0 * d0 + d1 * d1) < 1.0D) { if (this.a instanceof EntityHumanNPC) { ((EntityHumanNPC) this.a).getControllerJump().a(); } else { @@ -118,14 +120,4 @@ public class PlayerControllerMove extends ControllerMove { public double f() { return this.d; } - - private boolean shouldSlimeJump() { - if (!(this.a instanceof EntitySlime)) { - return false; - } - if (this.h-- <= 0) { - return true; - } - return false; - } } \ No newline at end of file diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/PlayerControllerMove.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/PlayerControllerMove.java index c869fc492..09c7eac9a 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/PlayerControllerMove.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/PlayerControllerMove.java @@ -51,9 +51,11 @@ public class PlayerControllerMove extends ControllerMove { float movement = (float) (this.e * speed.getValue()); this.a.k(movement); this.a.bg = movement; - if (shouldSlimeJump() || ((d2 >= NMS.getStepHeight(a.getBukkitEntity())) && (d0 * d0 + d1 * d1 < 1.0D))) { - this.h = cg(); + if (a instanceof EntitySlime && h-- <= 0) { + this.h = new Random().nextInt(20) + 10; this.h /= 3; + ((EntityInsentient) this.a).getControllerJump().a(); + } else if (d2 >= NMS.getStepHeight(a.getBukkitEntity()) && (d0 * d0 + d1 * d1) < 1.0D) { if (this.a instanceof EntityHumanNPC) { ((EntityHumanNPC) this.a).getControllerJump().a(); } else { @@ -118,14 +120,4 @@ public class PlayerControllerMove extends ControllerMove { public double f() { return this.d; } - - private boolean shouldSlimeJump() { - if (!(this.a instanceof EntitySlime)) { - return false; - } - if (this.h-- <= 0) { - return true; - } - return false; - } } \ No newline at end of file diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/PlayerControllerMove.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/PlayerControllerMove.java index 39d6acc55..afad6ca63 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/PlayerControllerMove.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/PlayerControllerMove.java @@ -53,9 +53,11 @@ public class PlayerControllerMove extends ControllerMove { float movement = (float) (this.e * speed.getValue()); this.a.o(movement); this.a.bj = movement; - if (shouldSlimeJump() || ((d2 >= NMS.getStepHeight(a.getBukkitEntity())) && (d0 * d0 + d1 * d1 < 1.0D))) { - this.h = cg(); + if (a instanceof EntitySlime && h-- <= 0) { + this.h = new Random().nextInt(20) + 10; this.h /= 3; + ((EntityInsentient) this.a).getControllerJump().a(); + } else if (d2 >= NMS.getStepHeight(a.getBukkitEntity()) && (d0 * d0 + d1 * d1) < 1.0D) { if (this.a instanceof EntityHumanNPC) { ((EntityHumanNPC) this.a).getControllerJump().a(); } else { @@ -120,14 +122,4 @@ public class PlayerControllerMove extends ControllerMove { public double f() { return this.d; } - - private boolean shouldSlimeJump() { - if (!(this.a instanceof EntitySlime)) { - return false; - } - if (this.h-- <= 0) { - return true; - } - return false; - } } \ No newline at end of file diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/PlayerControllerMove.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/PlayerControllerMove.java index ed3b4b0b1..33123c29a 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/PlayerControllerMove.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/PlayerControllerMove.java @@ -52,9 +52,11 @@ public class PlayerControllerMove extends ControllerMove { float movement = (float) (this.e * speed.getValue()); this.a.o(movement); this.a.bd = movement; - if (shouldSlimeJump() || ((d2 >= NMS.getStepHeight(a.getBukkitEntity())) && (d0 * d0 + d1 * d1 < 1.0D))) { - this.h = cg(); + if (a instanceof EntitySlime && h-- <= 0) { + this.h = new Random().nextInt(20) + 10; this.h /= 3; + ((EntityInsentient) this.a).getControllerJump().jump(); + } else if (d2 >= NMS.getStepHeight(a.getBukkitEntity()) && (d0 * d0 + d1 * d1) < 1.0D) { if (this.a instanceof EntityHumanNPC) { ((EntityHumanNPC) this.a).getControllerJump().jump(); } else { @@ -119,14 +121,4 @@ public class PlayerControllerMove extends ControllerMove { public double f() { return this.d; } - - private boolean shouldSlimeJump() { - if (!(this.a instanceof EntitySlime)) { - return false; - } - if (this.h-- <= 0) { - return true; - } - return false; - } } \ No newline at end of file diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/PlayerControllerMove.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/PlayerControllerMove.java index c593bad21..33a1c8bc2 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/PlayerControllerMove.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/PlayerControllerMove.java @@ -52,9 +52,11 @@ public class PlayerControllerMove extends ControllerMove { float movement = (float) (this.e * speed.getValue()); this.a.o(movement); this.a.bb = movement; - if (shouldSlimeJump() || ((d2 >= NMS.getStepHeight(a.getBukkitEntity())) && (d0 * d0 + d1 * d1 < 1.0D))) { - this.h = cg(); + if (a instanceof EntitySlime && h-- <= 0) { + this.h = new Random().nextInt(20) + 10; this.h /= 3; + ((EntityInsentient) this.a).getControllerJump().jump(); + } else if (d2 >= NMS.getStepHeight(a.getBukkitEntity()) && (d0 * d0 + d1 * d1) < 1.0D) { if (this.a instanceof EntityHumanNPC) { ((EntityHumanNPC) this.a).getControllerJump().jump(); } else { @@ -119,14 +121,4 @@ public class PlayerControllerMove extends ControllerMove { public double f() { return this.d; } - - private boolean shouldSlimeJump() { - if (!(this.a instanceof EntitySlime)) { - return false; - } - if (this.h-- <= 0) { - return true; - } - return false; - } } \ No newline at end of file diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/EntityMoveControl.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/EntityMoveControl.java index d666df8a8..2b194c2ff 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/EntityMoveControl.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/EntityMoveControl.java @@ -53,9 +53,13 @@ public class EntityMoveControl extends ControllerMove { float movement = (float) (this.e * speed.getValue()); this.a.q(movement); this.a.aT = movement; - if (shouldSlimeJump() || (d2 >= NMS.getStepHeight(a.getBukkitEntity()) && (d0 * d0 + d1 * d1) < 1.0D)) { - this.h = cg(); - this.h /= 3; + if (a instanceof EntitySlime && h-- <= 0) { + this.h = new Random().nextInt(20) + 10; + if (((EntitySlime) a).isAggressive()) { + this.h /= 3; + } + ai.getJumpControl().jump(); + } else if (d2 >= NMS.getStepHeight(a.getBukkitEntity()) && (d0 * d0 + d1 * d1) < 1.0D) { ai.getJumpControl().jump(); } } @@ -116,14 +120,4 @@ public class EntityMoveControl extends ControllerMove { public double f() { return this.d; } - - private boolean shouldSlimeJump() { - if (!(this.a instanceof EntitySlime)) { - return false; - } - if (this.h-- <= 0) { - return true; - } - return false; - } } \ No newline at end of file diff --git a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/EntityMoveControl.java b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/EntityMoveControl.java index 83fa4009f..a7247260d 100644 --- a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/EntityMoveControl.java +++ b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/EntityMoveControl.java @@ -86,16 +86,6 @@ public class EntityMoveControl extends MoveControl { this.moving = true; } - private boolean shouldJump() { - if (!(this.entity instanceof Slime)) { - return false; - } - if (this.jumpTicks-- <= 0) { - return true; - } - return false; - } - @Override public void tick() { this.entity.zza = 0; @@ -109,18 +99,27 @@ public class EntityMoveControl extends MoveControl { this.entity.zza = 0.0F; return; } + if (dXZ > 0.4) { float f = (float) (Mth.atan2(dZ, dX) * 57.2957763671875D) - 90.0F; this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F)); NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot()); } + AttributeInstance speed = this.entity.getAttribute(Attributes.MOVEMENT_SPEED); float movement = (float) (this.speed * speed.getValue()); this.entity.setSpeed(movement); this.entity.zza = movement; - if (shouldJump() || (dY >= NMS.getStepHeight(entity.getBukkitEntity()) && dXZ < 1.0D)) { - this.jumpTicks = jumpTicks(); - this.jumpTicks /= 3; + if (entity instanceof Slime && jumpTicks-- <= 0) { + this.jumpTicks = new Random().nextInt(20) + 10; + if (((Slime) entity).isAggressive()) { + this.jumpTicks /= 3; + } + ((Slime) entity).getJumpControl().jump(); + } else if (dY >= NMS.getStepHeight(entity.getBukkitEntity()) && dXZ < 0.4D) { + if (entity instanceof Mob) { + ((Mob) entity).getJumpControl().jump(); + } entity.setJumping(true); } } diff --git a/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/EntityMoveControl.java b/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/EntityMoveControl.java index ac0afcbce..356b1f619 100644 --- a/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/EntityMoveControl.java +++ b/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/EntityMoveControl.java @@ -85,16 +85,6 @@ public class EntityMoveControl extends MoveControl { this.moving = true; } - private boolean shouldJump() { - if (!(this.entity instanceof Slime)) { - return false; - } - if (this.jumpTicks-- <= 0) { - return true; - } - return false; - } - @Override public void tick() { this.entity.zza = 0; @@ -116,9 +106,16 @@ public class EntityMoveControl extends MoveControl { float movement = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue()); this.entity.setSpeed(movement); this.entity.zza = movement; - if (shouldJump() || (dY >= NMS.getStepHeight(entity.getBukkitEntity()) && dXZ < 0.4D)) { - this.jumpTicks = jumpTicks(); - this.jumpTicks /= 3; + if (entity instanceof Slime && jumpTicks-- <= 0) { + this.jumpTicks = new Random().nextInt(20) + 10; + if (((Slime) entity).isAggressive()) { + this.jumpTicks /= 3; + } + ((Slime) entity).getJumpControl().jump(); + } else if (dY >= NMS.getStepHeight(entity.getBukkitEntity()) && dXZ < 0.4D) { + if (entity instanceof Mob) { + ((Mob) entity).getJumpControl().jump(); + } entity.setJumping(true); } } diff --git a/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/EntityMoveControl.java b/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/EntityMoveControl.java index 4437ee62a..bcf1f99c5 100644 --- a/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/EntityMoveControl.java +++ b/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/EntityMoveControl.java @@ -85,16 +85,6 @@ public class EntityMoveControl extends MoveControl { this.moving = true; } - private boolean shouldJump() { - if (!(this.entity instanceof Slime)) - return false; - - if (this.jumpTicks-- <= 0) - return true; - - return false; - } - @Override public void tick() { this.entity.zza = 0; @@ -116,9 +106,16 @@ public class EntityMoveControl extends MoveControl { float movement = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue()); this.entity.setSpeed(movement); this.entity.zza = movement; - if (shouldJump() || (dY >= NMS.getStepHeight(entity.getBukkitEntity()) && dXZ < 0.4D)) { - this.jumpTicks = jumpTicks(); - this.jumpTicks /= 3; + if (entity instanceof Slime && jumpTicks-- <= 0) { + this.jumpTicks = new Random().nextInt(20) + 10; + if (((Slime) entity).isAggressive()) { + this.jumpTicks /= 3; + } + ((Slime) entity).getJumpControl().jump(); + } else if (dY >= NMS.getStepHeight(entity.getBukkitEntity()) && dXZ < 0.4D) { + if (entity instanceof Mob) { + ((Mob) entity).getJumpControl().jump(); + } entity.setJumping(true); } } diff --git a/v1_20_R2/src/main/java/net/citizensnpcs/nms/v1_20_R2/entity/SlimeController.java b/v1_20_R2/src/main/java/net/citizensnpcs/nms/v1_20_R2/entity/SlimeController.java index 117cdfcd7..0ea6a9909 100644 --- a/v1_20_R2/src/main/java/net/citizensnpcs/nms/v1_20_R2/entity/SlimeController.java +++ b/v1_20_R2/src/main/java/net/citizensnpcs/nms/v1_20_R2/entity/SlimeController.java @@ -16,7 +16,6 @@ import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.Util; import net.minecraft.core.BlockPos; - import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; @@ -48,7 +47,6 @@ public class SlimeController extends MobEntityController { public static class EntitySlimeNPC extends Slime implements NPCHolder { private final CitizensNPC npc; - private MoveControl oldMoveController; public EntitySlimeNPC(EntityType types, Level level) { @@ -67,17 +65,17 @@ public class SlimeController extends MobEntityController { @Override protected boolean canRide(Entity entity) { - if (npc != null && (entity instanceof Boat || entity instanceof AbstractMinecart)) { + if (npc != null && (entity instanceof Boat || entity instanceof AbstractMinecart)) return !npc.isProtected(); - } + return super.canRide(entity); } @Override public boolean causeFallDamage(float f, float f1, DamageSource damagesource) { - if (npc == null || !npc.isFlyable()) { + if (npc == null || !npc.isFlyable()) return super.causeFallDamage(f, f1, damagesource); - } + return false; } diff --git a/v1_20_R2/src/main/java/net/citizensnpcs/nms/v1_20_R2/util/EntityMoveControl.java b/v1_20_R2/src/main/java/net/citizensnpcs/nms/v1_20_R2/util/EntityMoveControl.java index 2755b8d1a..229cc66ad 100644 --- a/v1_20_R2/src/main/java/net/citizensnpcs/nms/v1_20_R2/util/EntityMoveControl.java +++ b/v1_20_R2/src/main/java/net/citizensnpcs/nms/v1_20_R2/util/EntityMoveControl.java @@ -54,10 +54,6 @@ public class EntityMoveControl extends MoveControl { return this.moving; } - protected int jumpTicks() { - return new Random().nextInt(20) + 10; - } - @Override protected float rotlerp(float f, float f1, float f2) { float f3 = Mth.wrapDegrees(f1 - f); @@ -85,42 +81,42 @@ public class EntityMoveControl extends MoveControl { this.moving = true; } - private boolean shouldJump() { - if (!(this.entity instanceof Slime)) - return false; - - if (this.jumpTicks-- <= 0) - return true; - - return false; - } - @Override public void tick() { this.entity.zza = 0; - if (this.moving) { - this.moving = false; - double dX = this.tx - this.entity.getX(); - double dZ = this.tz - this.entity.getZ(); - double dY = this.ty - this.entity.getY(); - double dXZ = Math.sqrt(dX * dX + dZ * dZ); - if (Math.abs(dY) < 1.0 && dXZ < 0.01) { - // this.entity.zza = 0.0F; - return; - } - if (dXZ > 0.4) { - float f = (float) Math.toDegrees(Mth.atan2(dZ, dX)) - 90.0F; - this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F)); - NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot()); - } - float movement = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue()); - this.entity.setSpeed(movement); - this.entity.zza = movement; - if (shouldJump() || (dY >= NMS.getStepHeight(entity.getBukkitEntity()) && dXZ < 0.4D)) { - this.jumpTicks = jumpTicks(); + if (!this.moving) + return; + + this.moving = false; + double dX = this.tx - this.entity.getX(); + double dZ = this.tz - this.entity.getZ(); + double dY = this.ty - this.entity.getY(); + double dXZ = Math.sqrt(dX * dX + dZ * dZ); + if (Math.abs(dY) < 1.0 && dXZ < 0.01) { + // this.entity.zza = 0.0F; + return; + } + + if (dXZ > 0.4) { + float f = (float) Math.toDegrees(Mth.atan2(dZ, dX)) - 90.0F; + this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F)); + NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot()); + } + + float movement = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue()); + this.entity.setSpeed(movement); + this.entity.zza = movement; + if (entity instanceof Slime && jumpTicks-- <= 0) { + this.jumpTicks = new Random().nextInt(20) + 10; + if (((Slime) entity).isAggressive()) { this.jumpTicks /= 3; - entity.setJumping(true); } + ((Slime) entity).getJumpControl().jump(); + } else if (dY >= NMS.getStepHeight(entity.getBukkitEntity()) && dXZ < 0.4D) { + if (entity instanceof Mob) { + ((Mob) entity).getJumpControl().jump(); + } + entity.setJumping(true); } } } \ No newline at end of file diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/PlayerControllerMove.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/PlayerControllerMove.java index 767c3c305..29c5a6a47 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/PlayerControllerMove.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/PlayerControllerMove.java @@ -86,9 +86,11 @@ public class PlayerControllerMove extends ControllerMove { float movement = (float) (this.e * speed.getValue()); this.a.k(movement); this.a.ba = movement; - if (shouldSlimeJump() || ((dY >= NMS.getStepHeight(a.getBukkitEntity())) && dXZ < 0.4)) { - this.h = cg(); + if (a instanceof EntitySlime && h-- <= 0) { + this.h = new Random().nextInt(20) + 10; this.h /= 3; + ((EntityInsentient) this.a).getControllerJump().a(); + } else if (dY >= NMS.getStepHeight(a.getBukkitEntity()) && (dXZ) < 0.4D) { if (this.a instanceof EntityHumanNPC) { ((EntityHumanNPC) this.a).getControllerJump().a(); } else { @@ -115,14 +117,4 @@ public class PlayerControllerMove extends ControllerMove { public double f() { return this.d; } - - private boolean shouldSlimeJump() { - if (!(this.a instanceof EntitySlime)) { - return false; - } - if (this.h-- <= 0) { - return true; - } - return false; - } } \ No newline at end of file