Change NPC UUID version to 2 for Minecraft

This commit is contained in:
fullwall 2014-11-15 15:47:41 +08:00
parent 651fbac979
commit 7008ffd013
2 changed files with 224 additions and 224 deletions

View File

@ -32,15 +32,14 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
private final Entity target;
private final TargetNavigator targetNavigator;
public MCTargetStrategy(NPC npc, org.bukkit.entity.Entity target, boolean aggro,
NavigatorParameters params) {
public MCTargetStrategy(NPC npc, org.bukkit.entity.Entity target, boolean aggro, NavigatorParameters params) {
this.npc = npc;
this.parameters = params;
this.handle = ((CraftEntity) npc.getEntity()).getHandle();
this.target = ((CraftEntity) target).getHandle();
Navigation nav = NMS.getNavigation(this.handle);
this.targetNavigator = nav != null && !params.useNewPathfinder() ? new NavigationFieldWrapper(
nav) : new AStarTargeter();
this.targetNavigator = nav != null && !params.useNewPathfinder() ? new NavigationFieldWrapper(nav)
: new AStarTargeter();
this.aggro = aggro;
}
@ -127,10 +126,8 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
if (aggro && canAttack()) {
AttackStrategy strategy = parameters.attackStrategy();
if (strategy != null && strategy.handle((LivingEntity) handle.getBukkitEntity(), getTarget())) {
} else
if (strategy != parameters.defaultAttackStrategy()) {
parameters.defaultAttackStrategy().handle((LivingEntity) handle.getBukkitEntity(),
getTarget());
} else if (strategy != parameters.defaultAttackStrategy()) {
parameters.defaultAttackStrategy().handle((LivingEntity) handle.getBukkitEntity(), getTarget());
}
attackTicks = ATTACK_DELAY_TICKS;
}

View File

@ -61,7 +61,10 @@ public class HumanController extends AbstractEntityController {
UUID uuid = npc.getUniqueId();
if (uuid.version() == 4) { // clear version
uuid = new UUID(uuid.getMostSignificantBits() | 0x0000000000005000L, uuid.getLeastSignificantBits());
long msb = uuid.getMostSignificantBits();
msb &= ~0x0000000000004000L;
msb |= 0x0000000000002000L;
uuid = new UUID(msb, uuid.getLeastSignificantBits());
}
GameProfile profile = new GameProfile(uuid, coloredName);