mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-15 11:51:45 +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)
|
if (npc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
az().a();
|
NMS.updateAI(this);
|
||||||
Navigation navigation = getNavigation();
|
Navigation navigation = getNavigation();
|
||||||
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
|
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
|
||||||
motX = motY = motZ = 0;
|
motX = motY = motZ = 0;
|
||||||
@ -134,10 +134,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void moveOnCurrentHeading() {
|
private void moveOnCurrentHeading() {
|
||||||
getControllerMove().c();
|
|
||||||
getControllerLook().a();
|
|
||||||
getControllerJump().b();
|
|
||||||
|
|
||||||
// taken from EntityLiving update method
|
// taken from EntityLiving update method
|
||||||
if (bG) {
|
if (bG) {
|
||||||
/* boolean inLiquid = H() || J();
|
/* boolean inLiquid = H() || J();
|
||||||
|
@ -241,6 +241,7 @@ public class NMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void updateAI(EntityLiving entity) {
|
public static void updateAI(EntityLiving entity) {
|
||||||
|
entity.az().a();
|
||||||
entity.getNavigation().e();
|
entity.getNavigation().e();
|
||||||
entity.getControllerMove().c();
|
entity.getControllerMove().c();
|
||||||
entity.getControllerLook().a();
|
entity.getControllerLook().a();
|
||||||
|
@ -82,7 +82,11 @@ public class Util {
|
|||||||
if (type != null)
|
if (type != null)
|
||||||
return type;
|
return type;
|
||||||
for (EntityType check : EntityType.values()) {
|
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;
|
type = check;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user