Use switches instead of ifs

This commit is contained in:
Andrew 2013-07-21 15:19:47 +12:00
parent 285f8f51fd
commit 3f85f0f45a

View File

@ -138,16 +138,18 @@ public enum DisguiseType {
private DisguiseType(EntityType newType, int... obj) { private DisguiseType(EntityType newType, int... obj) {
entityType = newType; entityType = newType;
int a = 0;
for (int i = 0; i < obj.length; i++) { for (int i = 0; i < obj.length; i++) {
int value = obj[i]; int value = obj[i];
if (a == 0) switch (i) {
case 0:
entityId = value; entityId = value;
else if (a == 1) case 1:
defaultId = value; defaultId = value;
else if (a == 2) case 2:
defaultData = value; defaultData = value;
a++; default:
break;
}
} }
} }
@ -168,7 +170,7 @@ public enum DisguiseType {
} }
public boolean isMob() { public boolean isMob() {
return entityType.isAlive(); return entityType.isAlive() && entityType != EntityType.PLAYER;
} }
public boolean isPlayer() { public boolean isPlayer() {