mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-28 02:51:44 +01:00
Change NPC UUID version to 2 for Minecraft
This commit is contained in:
parent
651fbac979
commit
7008ffd013
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user