mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-12 18:31:40 +01:00
Reuse code, match more entity types
This commit is contained in:
parent
7ed02943b7
commit
054fe89309
@ -116,7 +116,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
if (npc == null)
|
||||
return;
|
||||
|
||||
az().a();
|
||||
NMS.updateAI(this);
|
||||
Navigation navigation = getNavigation();
|
||||
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
|
||||
motX = motY = motZ = 0;
|
||||
@ -134,10 +134,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
}
|
||||
|
||||
private void moveOnCurrentHeading() {
|
||||
getControllerMove().c();
|
||||
getControllerLook().a();
|
||||
getControllerJump().b();
|
||||
|
||||
// taken from EntityLiving update method
|
||||
if (bG) {
|
||||
/* boolean inLiquid = H() || J();
|
||||
|
@ -241,6 +241,7 @@ public class NMS {
|
||||
}
|
||||
|
||||
public static void updateAI(EntityLiving entity) {
|
||||
entity.az().a();
|
||||
entity.getNavigation().e();
|
||||
entity.getControllerMove().c();
|
||||
entity.getControllerLook().a();
|
||||
|
@ -82,7 +82,11 @@ public class Util {
|
||||
if (type != null)
|
||||
return type;
|
||||
for (EntityType check : EntityType.values()) {
|
||||
if (check.name().matches(toMatch) || check.name().replace('_', '-').equalsIgnoreCase(toMatch)) {
|
||||
String name = check.name();
|
||||
if (name.matches(toMatch) || name.equalsIgnoreCase(toMatch)
|
||||
|| name.replace("_", "").equalsIgnoreCase(toMatch)
|
||||
|| name.replace('_', '-').equalsIgnoreCase(toMatch)
|
||||
|| name.replace('_', ' ').equalsIgnoreCase(toMatch) || name.startsWith(toMatch)) {
|
||||
type = check;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user