mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-09-24 13:22:50 +02: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 Entity target;
|
||||||
private final TargetNavigator targetNavigator;
|
private final TargetNavigator targetNavigator;
|
||||||
|
|
||||||
public MCTargetStrategy(NPC npc, org.bukkit.entity.Entity target, boolean aggro,
|
public MCTargetStrategy(NPC npc, org.bukkit.entity.Entity target, boolean aggro, NavigatorParameters params) {
|
||||||
NavigatorParameters params) {
|
|
||||||
this.npc = npc;
|
this.npc = npc;
|
||||||
this.parameters = params;
|
this.parameters = params;
|
||||||
this.handle = ((CraftEntity) npc.getEntity()).getHandle();
|
this.handle = ((CraftEntity) npc.getEntity()).getHandle();
|
||||||
this.target = ((CraftEntity) target).getHandle();
|
this.target = ((CraftEntity) target).getHandle();
|
||||||
Navigation nav = NMS.getNavigation(this.handle);
|
Navigation nav = NMS.getNavigation(this.handle);
|
||||||
this.targetNavigator = nav != null && !params.useNewPathfinder() ? new NavigationFieldWrapper(
|
this.targetNavigator = nav != null && !params.useNewPathfinder() ? new NavigationFieldWrapper(nav)
|
||||||
nav) : new AStarTargeter();
|
: new AStarTargeter();
|
||||||
this.aggro = aggro;
|
this.aggro = aggro;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,10 +126,8 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
|||||||
if (aggro && canAttack()) {
|
if (aggro && canAttack()) {
|
||||||
AttackStrategy strategy = parameters.attackStrategy();
|
AttackStrategy strategy = parameters.attackStrategy();
|
||||||
if (strategy != null && strategy.handle((LivingEntity) handle.getBukkitEntity(), getTarget())) {
|
if (strategy != null && strategy.handle((LivingEntity) handle.getBukkitEntity(), getTarget())) {
|
||||||
} else
|
} else if (strategy != parameters.defaultAttackStrategy()) {
|
||||||
if (strategy != parameters.defaultAttackStrategy()) {
|
parameters.defaultAttackStrategy().handle((LivingEntity) handle.getBukkitEntity(), getTarget());
|
||||||
parameters.defaultAttackStrategy().handle((LivingEntity) handle.getBukkitEntity(),
|
|
||||||
getTarget());
|
|
||||||
}
|
}
|
||||||
attackTicks = ATTACK_DELAY_TICKS;
|
attackTicks = ATTACK_DELAY_TICKS;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,10 @@ public class HumanController extends AbstractEntityController {
|
|||||||
|
|
||||||
UUID uuid = npc.getUniqueId();
|
UUID uuid = npc.getUniqueId();
|
||||||
if (uuid.version() == 4) { // clear version
|
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);
|
GameProfile profile = new GameProfile(uuid, coloredName);
|
||||||
|
Loading…
Reference in New Issue
Block a user