mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Cleanup, return the navigation destination from NMS.getDestination in case external plugins miss the timing to get it
This commit is contained in:
parent
81d54bba57
commit
69acf89ff9
@ -4,7 +4,6 @@ import java.lang.reflect.Method;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import net.citizensnpcs.trait.TrackTargetedByTrait;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -117,6 +116,7 @@ import net.citizensnpcs.trait.Controllable;
|
|||||||
import net.citizensnpcs.trait.CurrentLocation;
|
import net.citizensnpcs.trait.CurrentLocation;
|
||||||
import net.citizensnpcs.trait.HologramTrait.HologramRenderer;
|
import net.citizensnpcs.trait.HologramTrait.HologramRenderer;
|
||||||
import net.citizensnpcs.trait.ShopTrait;
|
import net.citizensnpcs.trait.ShopTrait;
|
||||||
|
import net.citizensnpcs.trait.TrackTargetedByTrait;
|
||||||
import net.citizensnpcs.trait.versioned.SnowmanTrait;
|
import net.citizensnpcs.trait.versioned.SnowmanTrait;
|
||||||
import net.citizensnpcs.util.ChunkCoord;
|
import net.citizensnpcs.util.ChunkCoord;
|
||||||
import net.citizensnpcs.util.Messages;
|
import net.citizensnpcs.util.Messages;
|
||||||
@ -449,35 +449,23 @@ public class EventListen implements Listener {
|
|||||||
public void onEntityTarget(EntityTargetEvent event) {
|
public void onEntityTarget(EntityTargetEvent event) {
|
||||||
final Entity targeted = event.getTarget();
|
final Entity targeted = event.getTarget();
|
||||||
NPC npc = plugin.getNPCRegistry().getNPC(targeted);
|
NPC npc = plugin.getNPCRegistry().getNPC(targeted);
|
||||||
final Entity cause = event.getEntity();
|
final Entity targeter = event.getEntity();
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
final EntityTargetNPCEvent targetNPCEvent = new EntityTargetNPCEvent(event, npc);
|
final EntityTargetNPCEvent targetNPCEvent = new EntityTargetNPCEvent(event, npc);
|
||||||
targetNPCEvent.setCancelled(!npc.data().get(NPC.Metadata.TARGETABLE, !npc.isProtected()));
|
targetNPCEvent.setCancelled(!npc.data().get(NPC.Metadata.TARGETABLE, !npc.isProtected()));
|
||||||
Bukkit.getPluginManager().callEvent(targetNPCEvent);
|
Bukkit.getPluginManager().callEvent(targetNPCEvent);
|
||||||
if (targetNPCEvent.isCancelled()) {
|
if (targetNPCEvent.isCancelled()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else {
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(cause instanceof Mob)) {
|
if (event.isCancelled() || !(targeter instanceof Mob))
|
||||||
return;
|
return;
|
||||||
}
|
npc.getOrAddTrait(TrackTargetedByTrait.class).add(targeter.getUniqueId());
|
||||||
final TrackTargetedByTrait beTargetedBy = npc.getOrAddTrait(TrackTargetedByTrait.class);
|
} else if (targeter instanceof Mob) {
|
||||||
beTargetedBy.add(cause.getUniqueId());
|
final NPC prev = plugin.getNPCRegistry().getNPC(((Mob) targeter).getTarget());
|
||||||
}
|
if (prev == null)
|
||||||
} else {
|
|
||||||
if (cause instanceof Mob) {
|
|
||||||
final LivingEntity previousTarget = ((Mob) cause).getTarget();
|
|
||||||
if (previousTarget == null) { // normally it is impossible
|
|
||||||
return;
|
return;
|
||||||
}
|
prev.getOrAddTrait(TrackTargetedByTrait.class).remove(targeter.getUniqueId());
|
||||||
final NPC previousAsNPC = plugin.getNPCRegistry().getNPC(previousTarget);
|
|
||||||
if (previousAsNPC != null) {
|
|
||||||
final TrackTargetedByTrait beTargetedBy = previousAsNPC.getOrAddTrait(TrackTargetedByTrait.class);
|
|
||||||
beTargetedBy.remove(cause.getUniqueId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +219,6 @@ public class Settings {
|
|||||||
MAX_NPC_SKIN_RETRIES(
|
MAX_NPC_SKIN_RETRIES(
|
||||||
"How many times to try load NPC skins (due to Minecraft rate-limiting skin requests, should rarely be less than 5",
|
"How many times to try load NPC skins (due to Minecraft rate-limiting skin requests, should rarely be less than 5",
|
||||||
"npc.skins.max-retries", -1),
|
"npc.skins.max-retries", -1),
|
||||||
MAX_TEXT_RANGE("The maximum range in blocks for chatting", "npc.chat.options.max-text-range", 500),
|
|
||||||
MAXIMUM_ASTAR_ITERATIONS("The maximum number of blocks to check when pathfinding",
|
MAXIMUM_ASTAR_ITERATIONS("The maximum number of blocks to check when pathfinding",
|
||||||
"npc.pathfinding.maximum-new-pathfinder-iterations", "npc.pathfinding.new-finder.maximum-iterations",
|
"npc.pathfinding.maximum-new-pathfinder-iterations", "npc.pathfinding.new-finder.maximum-iterations",
|
||||||
1024),
|
1024),
|
||||||
|
@ -18,7 +18,6 @@ import java.util.Objects;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import net.citizensnpcs.trait.TrackTargetedByTrait;
|
|
||||||
import org.bukkit.Art;
|
import org.bukkit.Art;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -166,6 +165,7 @@ import net.citizensnpcs.trait.SkinLayers;
|
|||||||
import net.citizensnpcs.trait.SkinLayers.Layer;
|
import net.citizensnpcs.trait.SkinLayers.Layer;
|
||||||
import net.citizensnpcs.trait.SkinTrait;
|
import net.citizensnpcs.trait.SkinTrait;
|
||||||
import net.citizensnpcs.trait.SlimeSize;
|
import net.citizensnpcs.trait.SlimeSize;
|
||||||
|
import net.citizensnpcs.trait.TrackTargetedByTrait;
|
||||||
import net.citizensnpcs.trait.WitherTrait;
|
import net.citizensnpcs.trait.WitherTrait;
|
||||||
import net.citizensnpcs.trait.WolfModifiers;
|
import net.citizensnpcs.trait.WolfModifiers;
|
||||||
import net.citizensnpcs.trait.shop.StoredShops;
|
import net.citizensnpcs.trait.shop.StoredShops;
|
||||||
@ -3420,9 +3420,9 @@ public class NPCCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!targetable) {
|
if (!targetable) {
|
||||||
final TrackTargetedByTrait trackTargetedByTrait = npc.getTraitNullable(TrackTargetedByTrait.class);
|
final TrackTargetedByTrait trait = npc.getTraitNullable(TrackTargetedByTrait.class);
|
||||||
if (trackTargetedByTrait != null) { // may not be targeted by anything so prevent possible garbages
|
if (trait != null) {
|
||||||
trackTargetedByTrait.clearTargets();
|
trait.clearTargets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Messaging.sendTr(sender, targetable ? Messages.TARGETABLE_SET : Messages.TARGETABLE_UNSET, npc.getName());
|
Messaging.sendTr(sender, targetable ? Messages.TARGETABLE_SET : Messages.TARGETABLE_UNSET, npc.getName());
|
||||||
|
@ -25,7 +25,6 @@ import net.citizensnpcs.trait.Anchors;
|
|||||||
import net.citizensnpcs.trait.ArmorStandTrait;
|
import net.citizensnpcs.trait.ArmorStandTrait;
|
||||||
import net.citizensnpcs.trait.AttributeTrait;
|
import net.citizensnpcs.trait.AttributeTrait;
|
||||||
import net.citizensnpcs.trait.BatTrait;
|
import net.citizensnpcs.trait.BatTrait;
|
||||||
import net.citizensnpcs.trait.TrackTargetedByTrait;
|
|
||||||
import net.citizensnpcs.trait.BoundingBoxTrait;
|
import net.citizensnpcs.trait.BoundingBoxTrait;
|
||||||
import net.citizensnpcs.trait.ClickRedirectTrait;
|
import net.citizensnpcs.trait.ClickRedirectTrait;
|
||||||
import net.citizensnpcs.trait.CommandTrait;
|
import net.citizensnpcs.trait.CommandTrait;
|
||||||
@ -64,6 +63,7 @@ import net.citizensnpcs.trait.SkinTrait;
|
|||||||
import net.citizensnpcs.trait.SleepTrait;
|
import net.citizensnpcs.trait.SleepTrait;
|
||||||
import net.citizensnpcs.trait.SlimeSize;
|
import net.citizensnpcs.trait.SlimeSize;
|
||||||
import net.citizensnpcs.trait.SneakTrait;
|
import net.citizensnpcs.trait.SneakTrait;
|
||||||
|
import net.citizensnpcs.trait.TrackTargetedByTrait;
|
||||||
import net.citizensnpcs.trait.VillagerProfession;
|
import net.citizensnpcs.trait.VillagerProfession;
|
||||||
import net.citizensnpcs.trait.WitherTrait;
|
import net.citizensnpcs.trait.WitherTrait;
|
||||||
import net.citizensnpcs.trait.WolfModifiers;
|
import net.citizensnpcs.trait.WolfModifiers;
|
||||||
@ -104,7 +104,6 @@ public class CitizensTraitFactory implements TraitFactory {
|
|||||||
registerTrait(TraitInfo.create(ItemFrameTrait.class));
|
registerTrait(TraitInfo.create(ItemFrameTrait.class));
|
||||||
registerTrait(TraitInfo.create(LookClose.class));
|
registerTrait(TraitInfo.create(LookClose.class));
|
||||||
registerTrait(TraitInfo.create(PaintingTrait.class));
|
registerTrait(TraitInfo.create(PaintingTrait.class));
|
||||||
registerTrait(TraitInfo.create(TrackTargetedByTrait.class));
|
|
||||||
registerTrait(TraitInfo.create(MirrorTrait.class).optInToStats());
|
registerTrait(TraitInfo.create(MirrorTrait.class).optInToStats());
|
||||||
registerTrait(TraitInfo.create(MountTrait.class));
|
registerTrait(TraitInfo.create(MountTrait.class));
|
||||||
registerTrait(TraitInfo.create(MobType.class).asDefaultTrait());
|
registerTrait(TraitInfo.create(MobType.class).asDefaultTrait());
|
||||||
@ -141,6 +140,7 @@ public class CitizensTraitFactory implements TraitFactory {
|
|||||||
registerTrait(TraitInfo.create(SlimeSize.class));
|
registerTrait(TraitInfo.create(SlimeSize.class));
|
||||||
registerTrait(TraitInfo.create(Spawned.class));
|
registerTrait(TraitInfo.create(Spawned.class));
|
||||||
registerTrait(TraitInfo.create(Text.class));
|
registerTrait(TraitInfo.create(Text.class));
|
||||||
|
registerTrait(TraitInfo.create(TrackTargetedByTrait.class));
|
||||||
registerTrait(TraitInfo.create(Waypoints.class).optInToStats());
|
registerTrait(TraitInfo.create(Waypoints.class).optInToStats());
|
||||||
registerTrait(TraitInfo.create(WitherTrait.class));
|
registerTrait(TraitInfo.create(WitherTrait.class));
|
||||||
registerTrait(TraitInfo.create(WoolColor.class));
|
registerTrait(TraitInfo.create(WoolColor.class));
|
||||||
|
@ -1,54 +1,64 @@
|
|||||||
package net.citizensnpcs.trait;
|
package net.citizensnpcs.trait;
|
||||||
|
|
||||||
import net.citizensnpcs.api.trait.Trait;
|
|
||||||
import net.citizensnpcs.api.trait.TraitName;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Mob;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Mob;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.trait.Trait;
|
||||||
|
import net.citizensnpcs.api.trait.TraitName;
|
||||||
|
|
||||||
@TraitName("tracktargetedby")
|
@TraitName("tracktargetedby")
|
||||||
public class TrackTargetedByTrait extends Trait {
|
public class TrackTargetedByTrait extends Trait {
|
||||||
private Set<UUID> beTargetedBy;
|
private Set<UUID> targetedBy;
|
||||||
|
|
||||||
public TrackTargetedByTrait() {
|
public TrackTargetedByTrait() {
|
||||||
super("tracktargetedby");
|
super("tracktargetedby");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void add(UUID uuid) {
|
||||||
|
if (targetedBy == null) {
|
||||||
|
targetedBy = new HashSet<>();
|
||||||
|
}
|
||||||
|
targetedBy.add(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearTargets() {
|
||||||
|
if (targetedBy == null)
|
||||||
|
return;
|
||||||
|
targetedBy = null;
|
||||||
|
if (!SUPPORTS_GET_ENTITY)
|
||||||
|
return;
|
||||||
|
for (UUID uuid : targetedBy) {
|
||||||
|
final Entity entity = Bukkit.getEntity(uuid);
|
||||||
|
if (entity instanceof Mob) {
|
||||||
|
if (entity.isValid()) {
|
||||||
|
((Mob) entity).setTarget(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDespawn() {
|
public void onDespawn() {
|
||||||
clearTargets();
|
clearTargets();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only for internal use
|
|
||||||
public void add(UUID uuid) {
|
|
||||||
if (beTargetedBy == null) {
|
|
||||||
beTargetedBy = new HashSet<>();
|
|
||||||
}
|
|
||||||
beTargetedBy.add(uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only for internal use
|
|
||||||
public void remove(UUID uuid) {
|
public void remove(UUID uuid) {
|
||||||
if (beTargetedBy != null) {
|
if (targetedBy != null) {
|
||||||
beTargetedBy.remove(uuid);
|
targetedBy.remove(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearTargets() {
|
private static boolean SUPPORTS_GET_ENTITY = true;
|
||||||
if (beTargetedBy != null) {
|
static {
|
||||||
for (UUID entityUUID : beTargetedBy) {
|
try {
|
||||||
final Entity entity = Bukkit.getEntity(entityUUID);
|
Bukkit.class.getMethod("getEntity", UUID.class);
|
||||||
if (entity instanceof Mob) {
|
} catch (NoSuchMethodException e) {
|
||||||
if (entity.isValid()) {
|
SUPPORTS_GET_ENTITY = false;
|
||||||
((Mob) entity).setTarget(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
beTargetedBy = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
|
||||||
import net.citizensnpcs.Settings.Setting;
|
|
||||||
import net.citizensnpcs.api.util.Messaging;
|
import net.citizensnpcs.api.util.Messaging;
|
||||||
import net.citizensnpcs.api.util.SpigotUtil;
|
import net.citizensnpcs.api.util.SpigotUtil;
|
||||||
import net.citizensnpcs.util.Messages;
|
import net.citizensnpcs.util.Messages;
|
||||||
@ -94,12 +93,10 @@ public class TextBasePrompt extends StringPrompt {
|
|||||||
text.toggleTalkClose();
|
text.toggleTalkClose();
|
||||||
} else if (input.equalsIgnoreCase("range")) {
|
} else if (input.equalsIgnoreCase("range")) {
|
||||||
try {
|
try {
|
||||||
double range = Math.min(Math.max(0, Double.parseDouble(parts[1])), Setting.MAX_TEXT_RANGE.asDouble());
|
double range = Math.max(0, Double.parseDouble(parts[1]));
|
||||||
text.setRange(range);
|
text.setRange(range);
|
||||||
Messaging.sendTr(sender, Messages.TEXT_EDITOR_RANGE_SET, range);
|
Messaging.sendTr(sender, Messages.TEXT_EDITOR_RANGE_SET, range);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
|
||||||
Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_RANGE);
|
|
||||||
} catch (ArrayIndexOutOfBoundsException e) {
|
|
||||||
Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_RANGE);
|
Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_RANGE);
|
||||||
}
|
}
|
||||||
} else if (input.equalsIgnoreCase("item")) {
|
} else if (input.equalsIgnoreCase("item")) {
|
||||||
|
@ -464,9 +464,24 @@ public class NMSImpl implements NMSBridge {
|
|||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||||
if (controller == null || !controller.a())
|
if (controller == null)
|
||||||
return null;
|
return null;
|
||||||
|
if (controller.a())
|
||||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||||
|
NavigationAbstract nav = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||||
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getNavigation() : null;
|
||||||
|
if (isNavigationFinished(nav))
|
||||||
|
return null;
|
||||||
|
Vec3D vec = nav.k().a(handle);
|
||||||
|
return new Location(entity.getWorld(), vec.x, vec.y, vec.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.bg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -481,14 +496,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle((LivingEntity) entity).aQ;
|
return getHandle((LivingEntity) entity).aQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.bg;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -680,14 +687,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.bf;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -700,6 +699,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle(entity).width;
|
return getHandle(entity).width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.bf;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getYaw(org.bukkit.entity.Entity entity) {
|
public float getYaw(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity).yaw;
|
return getHandle(entity).yaw;
|
||||||
|
@ -484,9 +484,24 @@ public class NMSImpl implements NMSBridge {
|
|||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||||
if (controller == null || !controller.a())
|
if (controller == null)
|
||||||
return null;
|
return null;
|
||||||
|
if (controller.a())
|
||||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||||
|
NavigationAbstract nav = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||||
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getNavigation() : null;
|
||||||
|
if (isNavigationFinished(nav))
|
||||||
|
return null;
|
||||||
|
Vec3D vec = nav.k().a(handle);
|
||||||
|
return new Location(entity.getWorld(), vec.x, vec.y, vec.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.bf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -501,14 +516,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle((LivingEntity) entity).aP;
|
return getHandle((LivingEntity) entity).aP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.bf;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -716,14 +723,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.be;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -736,6 +735,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle(entity).width;
|
return getHandle(entity).width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.be;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getYaw(org.bukkit.entity.Entity entity) {
|
public float getYaw(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity).yaw;
|
return getHandle(entity).yaw;
|
||||||
|
@ -485,9 +485,24 @@ public class NMSImpl implements NMSBridge {
|
|||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||||
if (controller == null || !controller.b())
|
if (controller == null)
|
||||||
return null;
|
return null;
|
||||||
|
if (controller.b())
|
||||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||||
|
NavigationAbstract nav = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||||
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getNavigation() : null;
|
||||||
|
if (isNavigationFinished(nav))
|
||||||
|
return null;
|
||||||
|
Vec3D vec = nav.l().a(handle);
|
||||||
|
return new Location(entity.getWorld(), vec.x, vec.y, vec.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.bg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -502,14 +517,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle((LivingEntity) entity).aP;
|
return getHandle((LivingEntity) entity).aP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.bg;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -718,14 +725,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.be;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -738,6 +737,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return entity.getWidth();
|
return entity.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.be;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getYaw(org.bukkit.entity.Entity entity) {
|
public float getYaw(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity).yaw;
|
return getHandle(entity).yaw;
|
||||||
|
@ -514,9 +514,24 @@ public class NMSImpl implements NMSBridge {
|
|||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||||
if (controller == null || !controller.b())
|
if (controller == null)
|
||||||
return null;
|
return null;
|
||||||
|
if (controller.b())
|
||||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||||
|
NavigationAbstract nav = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||||
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getNavigation() : null;
|
||||||
|
if (isNavigationFinished(nav))
|
||||||
|
return null;
|
||||||
|
Vec3D vec = nav.m().a(handle);
|
||||||
|
return new Location(entity.getWorld(), vec.x, vec.y, vec.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.bj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -531,14 +546,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle((LivingEntity) entity).aS;
|
return getHandle((LivingEntity) entity).aS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.bj;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -747,14 +754,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.bh;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -767,6 +766,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return entity.getWidth();
|
return entity.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.bh;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getYaw(org.bukkit.entity.Entity entity) {
|
public float getYaw(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity).yaw;
|
return getHandle(entity).yaw;
|
||||||
|
@ -556,9 +556,24 @@ public class NMSImpl implements NMSBridge {
|
|||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||||
if (controller == null || !controller.b())
|
if (controller == null)
|
||||||
return null;
|
return null;
|
||||||
|
if (controller.b())
|
||||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||||
|
NavigationAbstract nav = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||||
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getNavigation() : null;
|
||||||
|
if (isNavigationFinished(nav))
|
||||||
|
return null;
|
||||||
|
Vec3D vec = nav.l().a(handle);
|
||||||
|
return new Location(entity.getWorld(), vec.x, vec.y, vec.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.bd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -573,14 +588,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle((LivingEntity) entity).aM;
|
return getHandle((LivingEntity) entity).aM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.bd;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -798,14 +805,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.bb;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -818,6 +817,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return entity.getWidth();
|
return entity.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.bb;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getYaw(org.bukkit.entity.Entity entity) {
|
public float getYaw(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity).yaw;
|
return getHandle(entity).yaw;
|
||||||
|
@ -571,9 +571,24 @@ public class NMSImpl implements NMSBridge {
|
|||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||||
if (controller == null || !controller.b())
|
if (controller == null)
|
||||||
return null;
|
return null;
|
||||||
|
if (controller.b())
|
||||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||||
|
NavigationAbstract nav = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||||
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getNavigation() : null;
|
||||||
|
if (isNavigationFinished(nav))
|
||||||
|
return null;
|
||||||
|
Vec3D vec = nav.k().a(handle);
|
||||||
|
return new Location(entity.getWorld(), vec.x, vec.y, vec.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -588,14 +603,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle((LivingEntity) entity).aK;
|
return getHandle((LivingEntity) entity).aK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.bb;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -813,14 +820,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.aZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -833,6 +832,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return entity.getWidth();
|
return entity.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.aZ;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getYaw(org.bukkit.entity.Entity entity) {
|
public float getYaw(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity).yaw;
|
return getHandle(entity).yaw;
|
||||||
|
@ -584,11 +584,24 @@ public class NMSImpl implements NMSBridge {
|
|||||||
@Override
|
@Override
|
||||||
public Location getDestination(org.bukkit.entity.Entity entity) {
|
public Location getDestination(org.bukkit.entity.Entity entity) {
|
||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
MobAI ai = MobAI.from(handle);
|
||||||
: handle instanceof MobAI ? ((MobAI) handle).getMoveControl() : null;
|
if (ai == null)
|
||||||
if (controller == null || !controller.b())
|
|
||||||
return null;
|
return null;
|
||||||
|
ControllerMove controller = ai.getMoveControl();
|
||||||
|
if (controller.b())
|
||||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||||
|
if (isNavigationFinished(ai.getNavigation()))
|
||||||
|
return null;
|
||||||
|
Vec3D vec = ai.getNavigation().k().a(handle);
|
||||||
|
return new Location(entity.getWorld(), vec.x, vec.y, vec.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.aT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -603,14 +616,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle((LivingEntity) entity).getHeadRotation();
|
return getHandle((LivingEntity) entity).getHeadRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.aT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -836,14 +841,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.aR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -856,6 +853,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return entity.getWidth();
|
return entity.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.aR;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getYaw(org.bukkit.entity.Entity entity) {
|
public float getYaw(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity).yaw;
|
return getHandle(entity).yaw;
|
||||||
|
@ -594,12 +594,25 @@ public class NMSImpl implements NMSBridge {
|
|||||||
@Override
|
@Override
|
||||||
public Location getDestination(org.bukkit.entity.Entity entity) {
|
public Location getDestination(org.bukkit.entity.Entity entity) {
|
||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
MoveControl controller = handle instanceof Mob ? ((Mob) handle).getMoveControl()
|
MobAI ai = MobAI.from(handle);
|
||||||
: handle instanceof MobAI ? ((MobAI) handle).getMoveControl() : null;
|
if (ai == null)
|
||||||
if (controller == null || !controller.hasWanted())
|
|
||||||
return null;
|
return null;
|
||||||
|
MoveControl controller = ai.getMoveControl();
|
||||||
|
if (controller.hasWanted())
|
||||||
return new Location(entity.getWorld(), controller.getWantedX(), controller.getWantedY(),
|
return new Location(entity.getWorld(), controller.getWantedX(), controller.getWantedY(),
|
||||||
controller.getWantedZ());
|
controller.getWantedZ());
|
||||||
|
if (ai.getNavigation().isDone())
|
||||||
|
return null;
|
||||||
|
Vec3 vec = ai.getNavigation().getPath().getNextEntityPos(handle);
|
||||||
|
return new Location(entity.getWorld(), vec.x(), vec.y(), vec.z());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity);
|
||||||
|
return handle.zza;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -614,14 +627,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle((org.bukkit.entity.LivingEntity) entity).getYHeadRot();
|
return getHandle((org.bukkit.entity.LivingEntity) entity).getYHeadRot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity);
|
|
||||||
return handle.zza;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
||||||
ServerLevel server = (ServerLevel) getHandle(entity).level;
|
ServerLevel server = (ServerLevel) getHandle(entity).level;
|
||||||
@ -838,14 +843,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity);
|
|
||||||
return handle.xxa;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
||||||
ServerLevel server = (ServerLevel) getHandle(entity).level;
|
ServerLevel server = (ServerLevel) getHandle(entity).level;
|
||||||
@ -858,6 +855,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return entity.getWidth();
|
return entity.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity);
|
||||||
|
return handle.xxa;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getYaw(org.bukkit.entity.Entity entity) {
|
public float getYaw(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity).getYRot();
|
return getHandle(entity).getYRot();
|
||||||
|
@ -600,12 +600,25 @@ public class NMSImpl implements NMSBridge {
|
|||||||
@Override
|
@Override
|
||||||
public Location getDestination(org.bukkit.entity.Entity entity) {
|
public Location getDestination(org.bukkit.entity.Entity entity) {
|
||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
MoveControl controller = handle instanceof Mob ? ((Mob) handle).getMoveControl()
|
MobAI ai = MobAI.from(handle);
|
||||||
: handle instanceof MobAI ? ((MobAI) handle).getMoveControl() : null;
|
if (ai == null)
|
||||||
if (controller == null || !controller.hasWanted())
|
|
||||||
return null;
|
return null;
|
||||||
|
MoveControl controller = ai.getMoveControl();
|
||||||
|
if (controller.hasWanted())
|
||||||
return new Location(entity.getWorld(), controller.getWantedX(), controller.getWantedY(),
|
return new Location(entity.getWorld(), controller.getWantedX(), controller.getWantedY(),
|
||||||
controller.getWantedZ());
|
controller.getWantedZ());
|
||||||
|
if (ai.getNavigation().isDone())
|
||||||
|
return null;
|
||||||
|
Vec3 vec = ai.getNavigation().getPath().getNextEntityPos(handle);
|
||||||
|
return new Location(entity.getWorld(), vec.x(), vec.y(), vec.z());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity);
|
||||||
|
return handle.zza;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -620,14 +633,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle((org.bukkit.entity.LivingEntity) entity).getYHeadRot();
|
return getHandle((org.bukkit.entity.LivingEntity) entity).getYHeadRot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity);
|
|
||||||
return handle.zza;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
||||||
ServerLevel server = (ServerLevel) getHandle(entity).level;
|
ServerLevel server = (ServerLevel) getHandle(entity).level;
|
||||||
@ -845,14 +850,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity);
|
|
||||||
return handle.xxa;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
||||||
ServerLevel server = (ServerLevel) getHandle(entity).level;
|
ServerLevel server = (ServerLevel) getHandle(entity).level;
|
||||||
@ -865,6 +862,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return entity.getWidth();
|
return entity.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity);
|
||||||
|
return handle.xxa;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getYaw(org.bukkit.entity.Entity entity) {
|
public float getYaw(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity).getYRot();
|
return getHandle(entity).getYRot();
|
||||||
|
@ -645,11 +645,24 @@ public class NMSImpl implements NMSBridge {
|
|||||||
public Location getDestination(org.bukkit.entity.Entity entity) {
|
public Location getDestination(org.bukkit.entity.Entity entity) {
|
||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
MobAI ai = MobAI.from(handle);
|
MobAI ai = MobAI.from(handle);
|
||||||
MoveControl controller = ai != null ? ai.getMoveControl() : null;
|
if (ai == null)
|
||||||
if (controller == null || !controller.hasWanted())
|
|
||||||
return null;
|
return null;
|
||||||
|
MoveControl controller = ai.getMoveControl();
|
||||||
|
if (controller.hasWanted())
|
||||||
return new Location(entity.getWorld(), controller.getWantedX(), controller.getWantedY(),
|
return new Location(entity.getWorld(), controller.getWantedX(), controller.getWantedY(),
|
||||||
controller.getWantedZ());
|
controller.getWantedZ());
|
||||||
|
if (ai.getNavigation().isDone())
|
||||||
|
return null;
|
||||||
|
Vec3 vec = ai.getNavigation().getPath().getNextEntityPos(handle);
|
||||||
|
return new Location(entity.getWorld(), vec.x(), vec.y(), vec.z());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);
|
||||||
|
return handle.zza;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -664,14 +677,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle((org.bukkit.entity.LivingEntity) entity).getYHeadRot();
|
return getHandle((org.bukkit.entity.LivingEntity) entity).getYHeadRot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);
|
|
||||||
return handle.zza;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
||||||
ServerLevel server = (ServerLevel) getHandle(entity).level;
|
ServerLevel server = (ServerLevel) getHandle(entity).level;
|
||||||
@ -894,14 +899,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);
|
|
||||||
return handle.xxa;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
||||||
ServerLevel server = (ServerLevel) getHandle(entity).level;
|
ServerLevel server = (ServerLevel) getHandle(entity).level;
|
||||||
@ -914,6 +911,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return entity.getWidth();
|
return entity.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);
|
||||||
|
return handle.xxa;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getYaw(org.bukkit.entity.Entity entity) {
|
public float getYaw(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity).getYRot();
|
return getHandle(entity).getYRot();
|
||||||
|
@ -673,11 +673,24 @@ public class NMSImpl implements NMSBridge {
|
|||||||
public Location getDestination(org.bukkit.entity.Entity entity) {
|
public Location getDestination(org.bukkit.entity.Entity entity) {
|
||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
MobAI ai = MobAI.from(handle);
|
MobAI ai = MobAI.from(handle);
|
||||||
MoveControl controller = ai != null ? ai.getMoveControl() : null;
|
if (ai == null)
|
||||||
if (controller == null || !controller.hasWanted())
|
|
||||||
return null;
|
return null;
|
||||||
|
MoveControl controller = ai.getMoveControl();
|
||||||
|
if (controller.hasWanted())
|
||||||
return new Location(entity.getWorld(), controller.getWantedX(), controller.getWantedY(),
|
return new Location(entity.getWorld(), controller.getWantedX(), controller.getWantedY(),
|
||||||
controller.getWantedZ());
|
controller.getWantedZ());
|
||||||
|
if (ai.getNavigation().isDone())
|
||||||
|
return null;
|
||||||
|
Vec3 vec = ai.getNavigation().getPath().getNextEntityPos(handle);
|
||||||
|
return new Location(entity.getWorld(), vec.x(), vec.y(), vec.z());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);
|
||||||
|
return handle.zza;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -692,14 +705,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle((org.bukkit.entity.LivingEntity) entity).getYHeadRot();
|
return getHandle((org.bukkit.entity.LivingEntity) entity).getYHeadRot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);
|
|
||||||
return handle.zza;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
||||||
ServerLevel server = (ServerLevel) getHandle(entity).level();
|
ServerLevel server = (ServerLevel) getHandle(entity).level();
|
||||||
@ -923,6 +928,11 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getWidth(org.bukkit.entity.Entity entity) {
|
||||||
|
return entity.getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
||||||
if (!entity.getType().isAlive())
|
if (!entity.getType().isAlive())
|
||||||
@ -931,11 +941,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return handle.xxa;
|
return handle.xxa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getWidth(org.bukkit.entity.Entity entity) {
|
|
||||||
return entity.getWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getYaw(org.bukkit.entity.Entity entity) {
|
public float getYaw(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity).getYRot();
|
return getHandle(entity).getYRot();
|
||||||
|
@ -661,11 +661,24 @@ public class NMSImpl implements NMSBridge {
|
|||||||
public Location getDestination(org.bukkit.entity.Entity entity) {
|
public Location getDestination(org.bukkit.entity.Entity entity) {
|
||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
MobAI ai = MobAI.from(handle);
|
MobAI ai = MobAI.from(handle);
|
||||||
MoveControl controller = ai != null ? ai.getMoveControl() : null;
|
if (ai == null)
|
||||||
if (controller == null || !controller.hasWanted())
|
|
||||||
return null;
|
return null;
|
||||||
|
MoveControl controller = ai.getMoveControl();
|
||||||
|
if (controller.hasWanted())
|
||||||
return new Location(entity.getWorld(), controller.getWantedX(), controller.getWantedY(),
|
return new Location(entity.getWorld(), controller.getWantedX(), controller.getWantedY(),
|
||||||
controller.getWantedZ());
|
controller.getWantedZ());
|
||||||
|
if (ai.getNavigation().isDone())
|
||||||
|
return null;
|
||||||
|
Vec3 vec = ai.getNavigation().getPath().getNextEntityPos(handle);
|
||||||
|
return new Location(entity.getWorld(), vec.x(), vec.y(), vec.z());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);
|
||||||
|
return handle.zza;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -680,14 +693,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle((org.bukkit.entity.LivingEntity) entity).getYHeadRot();
|
return getHandle((org.bukkit.entity.LivingEntity) entity).getYHeadRot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);
|
|
||||||
return handle.zza;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
||||||
ServerLevel server = (ServerLevel) getHandle(entity).level();
|
ServerLevel server = (ServerLevel) getHandle(entity).level();
|
||||||
@ -911,6 +916,11 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getWidth(org.bukkit.entity.Entity entity) {
|
||||||
|
return entity.getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
||||||
if (!entity.getType().isAlive())
|
if (!entity.getType().isAlive())
|
||||||
@ -919,11 +929,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return handle.xxa;
|
return handle.xxa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getWidth(org.bukkit.entity.Entity entity) {
|
|
||||||
return entity.getWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getYaw(org.bukkit.entity.Entity entity) {
|
public float getYaw(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity).getYRot();
|
return getHandle(entity).getYRot();
|
||||||
|
@ -219,6 +219,7 @@ import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
|
|||||||
import net.minecraft.server.v1_8_R3.ReportedException;
|
import net.minecraft.server.v1_8_R3.ReportedException;
|
||||||
import net.minecraft.server.v1_8_R3.ScoreboardTeam;
|
import net.minecraft.server.v1_8_R3.ScoreboardTeam;
|
||||||
import net.minecraft.server.v1_8_R3.ScoreboardTeamBase.EnumNameTagVisibility;
|
import net.minecraft.server.v1_8_R3.ScoreboardTeamBase.EnumNameTagVisibility;
|
||||||
|
import net.minecraft.server.v1_8_R3.Vec3D;
|
||||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -418,9 +419,24 @@ public class NMSImpl implements NMSBridge {
|
|||||||
Entity handle = getHandle(entity);
|
Entity handle = getHandle(entity);
|
||||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||||
if (controller == null || !controller.a())
|
if (controller == null)
|
||||||
return null;
|
return null;
|
||||||
|
if (controller.a())
|
||||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||||
|
NavigationAbstract nav = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||||
|
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getNavigation() : null;
|
||||||
|
if (isNavigationFinished(nav))
|
||||||
|
return null;
|
||||||
|
Vec3D vec = nav.j().a(handle);
|
||||||
|
return new Location(entity.getWorld(), vec.a, vec.b, vec.c);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.ba;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -435,14 +451,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle((LivingEntity) entity).aK;
|
return getHandle((LivingEntity) entity).aK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.ba;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
public EntityPacketTracker getPacketTracker(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -624,14 +632,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
|
||||||
if (!entity.getType().isAlive())
|
|
||||||
return Float.NaN;
|
|
||||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
|
||||||
return handle.aZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
public Collection<org.bukkit.entity.Player> getViewingPlayers(org.bukkit.entity.Entity entity) {
|
||||||
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
WorldServer server = (WorldServer) NMSImpl.getHandle(entity).getWorld();
|
||||||
@ -644,6 +644,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return getHandle(entity).width;
|
return getHandle(entity).width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getXZMovement(org.bukkit.entity.Entity entity) {
|
||||||
|
if (!entity.getType().isAlive())
|
||||||
|
return Float.NaN;
|
||||||
|
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
|
||||||
|
return handle.aZ;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getYaw(org.bukkit.entity.Entity entity) {
|
public float getYaw(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity).yaw;
|
return getHandle(entity).yaw;
|
||||||
|
Loading…
Reference in New Issue
Block a user