mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 02:25:57 +01:00
Fix players not jumping in newer minecraft versions
This commit is contained in:
parent
ee9c67fc0c
commit
20ea3e8723
@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_16_R3.util;
|
||||
import java.util.Random;
|
||||
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_16_R3.AttributeModifiable;
|
||||
import net.minecraft.server.v1_16_R3.ControllerMove;
|
||||
import net.minecraft.server.v1_16_R3.EntityInsentient;
|
||||
import net.minecraft.server.v1_16_R3.EntityLiving;
|
||||
|
@ -3,6 +3,9 @@ package net.citizensnpcs.nms.v1_17_R1.util;
|
||||
import java.util.Random;
|
||||
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@ -10,6 +13,8 @@ import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.monster.Slime;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
public class EntityMoveControl extends MoveControl {
|
||||
protected LivingEntity entity;
|
||||
@ -94,27 +99,32 @@ public class EntityMoveControl extends MoveControl {
|
||||
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;
|
||||
double dXYZ = Math.sqrt(dX * dX + dY * dY + dZ * dZ);
|
||||
if (dXYZ < 2.500000277905201E-7) {
|
||||
// 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());
|
||||
float f = (float) Math.toDegrees(Mth.atan2(dZ, dX)) - 90.0F;
|
||||
entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot());
|
||||
}
|
||||
this.entity.zza = (float) (this.speed * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
this.entity.zza = (float) (this.speed * entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
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);
|
||||
return;
|
||||
}
|
||||
BlockPos pos = entity.blockPosition();
|
||||
BlockState bs = entity.level.getBlockState(pos);
|
||||
VoxelShape vs = bs.getCollisionShape(entity.level, pos);
|
||||
if (dY >= entity.maxUpStep && dXZ < Math.max(1.0F, entity.getBbWidth())
|
||||
|| !vs.isEmpty() && entity.getY() < vs.max(Axis.Y) + pos.getY() && !bs.is(BlockTags.DOORS)
|
||||
&& !bs.is(BlockTags.FENCES)) {
|
||||
NMS.setShouldJump(entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1512,6 +1512,9 @@ public class NMSImpl implements NMSBridge {
|
||||
if (ai != null) {
|
||||
ai.getJumpControl().jump();
|
||||
}
|
||||
if (handle instanceof LivingEntity) {
|
||||
((LivingEntity) handle).setJumping(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,6 +3,9 @@ package net.citizensnpcs.nms.v1_18_R2.util;
|
||||
import java.util.Random;
|
||||
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@ -10,6 +13,8 @@ import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.monster.Slime;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
public class EntityMoveControl extends MoveControl {
|
||||
protected LivingEntity entity;
|
||||
@ -94,26 +99,32 @@ public class EntityMoveControl extends MoveControl {
|
||||
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)
|
||||
double dXYZ = Math.sqrt(dX * dX + dY * dY + dZ * dZ);
|
||||
if (dXYZ < 2.500000277905201E-7) {
|
||||
// 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());
|
||||
entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot());
|
||||
}
|
||||
this.entity.zza = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
this.entity.zza = (float) (this.speedMod * entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
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);
|
||||
return;
|
||||
}
|
||||
BlockPos pos = entity.blockPosition();
|
||||
BlockState bs = entity.level.getBlockState(pos);
|
||||
VoxelShape vs = bs.getCollisionShape(entity.level, pos);
|
||||
if (dY >= entity.maxUpStep && dXZ < Math.max(1.0F, entity.getBbWidth())
|
||||
|| !vs.isEmpty() && entity.getY() < vs.max(Axis.Y) + pos.getY() && !bs.is(BlockTags.DOORS)
|
||||
&& !bs.is(BlockTags.FENCES)) {
|
||||
NMS.setShouldJump(entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1519,7 +1519,12 @@ public class NMSImpl implements NMSBridge {
|
||||
if (handle == null)
|
||||
return;
|
||||
MobAI ai = MobAI.from(handle);
|
||||
ai.getJumpControl().jump();
|
||||
if (ai != null) {
|
||||
ai.getJumpControl().jump();
|
||||
}
|
||||
if (handle instanceof LivingEntity) {
|
||||
((LivingEntity) handle).setJumping(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,6 +3,9 @@ package net.citizensnpcs.nms.v1_19_R3.util;
|
||||
import java.util.Random;
|
||||
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@ -10,6 +13,8 @@ import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.monster.Slime;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
public class EntityMoveControl extends MoveControl {
|
||||
protected LivingEntity entity;
|
||||
@ -94,26 +99,32 @@ public class EntityMoveControl extends MoveControl {
|
||||
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)
|
||||
double dXYZ = Math.sqrt(dX * dX + dY * dY + dZ * dZ);
|
||||
if (dXYZ < 2.500000277905201E-7) {
|
||||
// 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());
|
||||
entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot());
|
||||
}
|
||||
this.entity.zza = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
this.entity.zza = (float) (this.speedMod * entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
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);
|
||||
return;
|
||||
}
|
||||
BlockPos pos = entity.blockPosition();
|
||||
BlockState bs = entity.level.getBlockState(pos);
|
||||
VoxelShape vs = bs.getCollisionShape(entity.level, pos);
|
||||
if (dY >= entity.maxUpStep() && dXZ < Math.max(1.0F, entity.getBbWidth())
|
||||
|| !vs.isEmpty() && entity.getY() < vs.max(Axis.Y) + pos.getY() && !bs.is(BlockTags.DOORS)
|
||||
&& !bs.is(BlockTags.FENCES)) {
|
||||
NMS.setShouldJump(entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -308,7 +308,6 @@ import net.minecraft.world.entity.ai.attributes.AttributeMap;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.FlyingMoveControl;
|
||||
import net.minecraft.world.entity.ai.control.JumpControl;
|
||||
import net.minecraft.world.entity.ai.control.LookControl;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.ai.goal.GoalSelector;
|
||||
@ -1663,10 +1662,11 @@ public class NMSImpl implements NMSBridge {
|
||||
Entity handle = getHandle(entity);
|
||||
if (handle == null)
|
||||
return;
|
||||
if (handle instanceof Mob) {
|
||||
JumpControl controller = ((Mob) handle).getJumpControl();
|
||||
controller.jump();
|
||||
} else {
|
||||
MobAI ai = MobAI.from(handle);
|
||||
if (ai != null) {
|
||||
ai.getJumpControl().jump();
|
||||
}
|
||||
if (handle instanceof LivingEntity) {
|
||||
((LivingEntity) handle).setJumping(true);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,9 @@ package net.citizensnpcs.nms.v1_20_R4.util;
|
||||
import java.util.Random;
|
||||
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@ -10,6 +13,8 @@ import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.monster.Slime;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
public class EntityMoveControl extends MoveControl {
|
||||
protected LivingEntity entity;
|
||||
@ -92,27 +97,31 @@ public class EntityMoveControl extends MoveControl {
|
||||
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)
|
||||
double dXYZ = Math.sqrt(dX * dX + dY * dY + dZ * dZ);
|
||||
if (dXYZ < 2.500000277905201E-7) {
|
||||
// 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());
|
||||
entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot());
|
||||
}
|
||||
this.entity.zza = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
this.entity.zza = (float) (this.speedMod * entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
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);
|
||||
return;
|
||||
}
|
||||
BlockPos pos = entity.blockPosition();
|
||||
BlockState bs = entity.level().getBlockState(pos);
|
||||
VoxelShape vs = bs.getCollisionShape(entity.level(), pos);
|
||||
if (dY >= entity.maxUpStep() && dXZ < Math.max(1.0F, entity.getBbWidth()) || !vs.isEmpty()
|
||||
&& entity.getY() < vs.max(Axis.Y) + pos.getY() && !bs.is(BlockTags.DOORS) && !bs.is(BlockTags.FENCES)) {
|
||||
NMS.setShouldJump(entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
}
|
@ -305,7 +305,6 @@ import net.minecraft.world.entity.ai.attributes.AttributeMap;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.FlyingMoveControl;
|
||||
import net.minecraft.world.entity.ai.control.JumpControl;
|
||||
import net.minecraft.world.entity.ai.control.LookControl;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.ai.goal.GoalSelector;
|
||||
@ -1662,10 +1661,11 @@ public class NMSImpl implements NMSBridge {
|
||||
Entity handle = getHandle(entity);
|
||||
if (handle == null)
|
||||
return;
|
||||
if (handle instanceof Mob) {
|
||||
JumpControl controller = ((Mob) handle).getJumpControl();
|
||||
controller.jump();
|
||||
} else {
|
||||
MobAI ai = MobAI.from(handle);
|
||||
if (ai != null) {
|
||||
ai.getJumpControl().jump();
|
||||
}
|
||||
if (handle instanceof LivingEntity) {
|
||||
((LivingEntity) handle).setJumping(true);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,9 @@ package net.citizensnpcs.nms.v1_21_R1.util;
|
||||
import java.util.Random;
|
||||
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@ -10,6 +13,8 @@ import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.monster.Slime;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
public class EntityMoveControl extends MoveControl {
|
||||
protected LivingEntity entity;
|
||||
@ -92,27 +97,31 @@ public class EntityMoveControl extends MoveControl {
|
||||
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)
|
||||
double dXYZ = Math.sqrt(dX * dX + dY * dY + dZ * dZ);
|
||||
if (dXYZ < 2.500000277905201E-7) {
|
||||
// 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());
|
||||
entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot());
|
||||
}
|
||||
this.entity.zza = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
this.entity.zza = (float) (this.speedMod * entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
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);
|
||||
return;
|
||||
}
|
||||
BlockPos pos = entity.blockPosition();
|
||||
BlockState bs = entity.level().getBlockState(pos);
|
||||
VoxelShape vs = bs.getCollisionShape(entity.level(), pos);
|
||||
if (dY >= entity.maxUpStep() && dXZ < Math.max(1.0F, entity.getBbWidth()) || !vs.isEmpty()
|
||||
&& entity.getY() < vs.max(Axis.Y) + pos.getY() && !bs.is(BlockTags.DOORS) && !bs.is(BlockTags.FENCES)) {
|
||||
NMS.setShouldJump(entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
}
|
@ -306,7 +306,6 @@ import net.minecraft.world.entity.ai.attributes.AttributeMap;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.FlyingMoveControl;
|
||||
import net.minecraft.world.entity.ai.control.JumpControl;
|
||||
import net.minecraft.world.entity.ai.control.LookControl;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.ai.goal.GoalSelector;
|
||||
@ -1641,10 +1640,11 @@ public class NMSImpl implements NMSBridge {
|
||||
Entity handle = getHandle(entity);
|
||||
if (handle == null)
|
||||
return;
|
||||
if (handle instanceof Mob) {
|
||||
JumpControl controller = ((Mob) handle).getJumpControl();
|
||||
controller.jump();
|
||||
} else {
|
||||
MobAI ai = MobAI.from(handle);
|
||||
if (ai != null) {
|
||||
ai.getJumpControl().jump();
|
||||
}
|
||||
if (handle instanceof LivingEntity) {
|
||||
((LivingEntity) handle).setJumping(true);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package net.citizensnpcs.nms.v1_8_R3.util;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.citizensnpcs.nms.v1_8_R3.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_8_R3.ControllerMove;
|
||||
import net.minecraft.server.v1_8_R3.EntityInsentient;
|
||||
@ -86,12 +85,8 @@ public class PlayerControllerMove extends ControllerMove {
|
||||
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 {
|
||||
((EntityInsentient) this.a).getControllerJump().a();
|
||||
}
|
||||
} else if (dY > NMS.getStepHeight(a.getBukkitEntity()) && dXZ < 0.4D) {
|
||||
NMS.setShouldJump(a.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user