mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-29 19:41:50 +01:00
Set step height to 1 for all living NPCs
This commit is contained in:
parent
f897ab728d
commit
5b2e5323c3
@ -203,6 +203,9 @@ public class CitizensNPC extends AbstractNPC {
|
||||
LivingEntity entity = (LivingEntity) getEntity();
|
||||
entity.setRemoveWhenFarAway(false);
|
||||
entity.setCustomName(getFullName());
|
||||
if (NMS.getStepHeight(entity) < 1) {
|
||||
NMS.setStepHeight(NMS.getHandle(entity), 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -30,8 +30,9 @@ public abstract class MobEntityController extends AbstractEntityController {
|
||||
// entity.onGround isn't updated right away - we approximate here so
|
||||
// that things like pathfinding still work *immediately* after spawn.
|
||||
org.bukkit.Material beneath = at.getBlock().getRelative(BlockFace.DOWN).getType();
|
||||
if (beneath.isBlock())
|
||||
if (beneath.isBlock()) {
|
||||
entity.onGround = true;
|
||||
}
|
||||
return entity.getBukkitEntity();
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,6 @@ public class WolfController extends MobEntityController {
|
||||
public void bn() {
|
||||
super.bn();
|
||||
if (npc != null) {
|
||||
NMS.setStepHeight(this, 1);
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ public class NMS {
|
||||
}
|
||||
|
||||
private static Constructor<?> getCustomEntityConstructor(Class<?> clazz, EntityType type) throws SecurityException,
|
||||
NoSuchMethodException {
|
||||
NoSuchMethodException {
|
||||
Constructor<?> constructor = ENTITY_CONSTRUCTOR_CACHE.get(clazz);
|
||||
if (constructor == null) {
|
||||
constructor = clazz.getConstructor(World.class);
|
||||
@ -238,6 +238,10 @@ public class NMS {
|
||||
// return DEFAULT_SPEED;
|
||||
}
|
||||
|
||||
public static float getStepHeight(LivingEntity entity) {
|
||||
return NMS.getHandle(entity).X;
|
||||
}
|
||||
|
||||
public static void initNetworkManager(NetworkManager network) {
|
||||
if (NETWORK_CHANNEL == null || NETWORK_ADDRESS == null)
|
||||
return;
|
||||
@ -542,7 +546,6 @@ public class NMS {
|
||||
private static Field NETWORK_CHANNEL = getField(NetworkManager.class, "k");
|
||||
private static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0);
|
||||
private static Field PATHFINDING_RANGE = getField(Navigation.class, "e");
|
||||
|
||||
private static final Random RANDOM = Util.getFastRandom();
|
||||
// true field above false and three synchronised lists
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user