Reuse code, match more entity types

This commit is contained in:
fullwall 2012-10-30 11:02:25 +08:00
parent 7ed02943b7
commit 054fe89309
3 changed files with 7 additions and 6 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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;
}