20% improvement to cached chunk check performance

This commit is contained in:
leijurv 2018-08-28 21:10:41 -07:00
parent 23cbef102d
commit e553ee93b8

View File

@ -42,11 +42,18 @@ public enum PathingBlockType {
}
public static PathingBlockType fromBits(boolean b1, boolean b2) {
for (PathingBlockType type : values())
if (type.bits[0] == b1 && type.bits[1] == b2)
return type;
// This will never happen, but if it does, assume it's just AIR
if (b1) {
if (b2) {
return PathingBlockType.SOLID;
} else {
return PathingBlockType.AVOID;
}
} else {
if (b2) {
return PathingBlockType.WATER;
} else {
return PathingBlockType.AIR;
}
}
}
}