Skip to content

Commit

Permalink
use teleport forcererifierer more often
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 10, 2021
1 parent ab23a96 commit a268d5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Expand Up @@ -845,8 +845,15 @@ public void teleport(Location location) {
if (isCitizensNPC()) {
getDenizenNPC().getCitizen().teleport(location, TeleportCause.PLUGIN);
}
else if (isFake) {
NMSHandler.getEntityHelper().snapPositionTo(entity, location.toVector());
NMSHandler.getEntityHelper().look(entity, location.getYaw(), location.getPitch());
}
else {
entity.teleport(location);
if (entity.getWorld().equals(location.getWorld())) { // Force the teleport through (for things like mounts)
NMSHandler.getEntityHelper().teleport(entity, location.toVector());
}
}
}

Expand Down
@@ -1,6 +1,5 @@
package com.denizenscript.denizen.utilities.entity;
import com.denizenscript.denizen.Denizen;
import com.denizenscript.denizen.nms.NMSHandler;
import com.denizenscript.denizen.objects.EntityTag;
import org.bukkit.Location;
import org.bukkit.scheduler.BukkitRunnable;
Expand Down Expand Up @@ -64,13 +63,7 @@ public void run() {
goal.setYaw(attachLoc.getYaw());
goal.setPitch(attachLoc.getPitch());
}
if (attached.isFake) {
NMSHandler.getEntityHelper().snapPositionTo(attached.getBukkitEntity(), goal.toVector());
NMSHandler.getEntityHelper().look(attached.getBukkitEntity(), goal.getYaw(), goal.getPitch());
}
else {
attached.teleport(goal);
}
attached.teleport(goal);
}
}
};
Expand Down

0 comments on commit a268d5d

Please sign in to comment.