smooth display motion via teleport_duration=1 (no desync)

This commit is contained in:
SashegDev
2026-09-17 09:18:53 +00:00
parent 3e00c57fa7
commit fa81d144ba
8 changed files with 18 additions and 0 deletions
@@ -356,6 +356,7 @@ public class BlackKnifeListener implements Listener {
d.setViewRange(64);
});
EntityTracker.mark(disp);
EntityTracker.smooth(disp);
Vector vel = new Vector(0, -0.35 - Math.random() * 0.1, 0);
vel.add(new Vector((Math.random() - 0.5) * 0.08, 0, (Math.random() - 0.5) * 0.08));
new BukkitRunnable() {
@@ -381,6 +382,7 @@ public class BlackKnifeListener implements Listener {
d.setViewRange(64);
});
EntityTracker.mark(shard);
EntityTracker.smooth(shard);
new BukkitRunnable() {
@Override public void run() {
if (!shard.isValid()) { cancel(); return; }
@@ -26,6 +26,7 @@ public class DiamondAttack {
d.setViewRange(64);
});
EntityTracker.mark(crystal);
EntityTracker.smooth(crystal);
p.getWorld().playSound(spawn, Sound.BLOCK_AMETHYST_BLOCK_PLACE, 1f, 0.9f);
p.getWorld().playSound(spawn, Sound.BLOCK_AMETHYST_BLOCK_CHIME, 1f, 1.5f);
Vector vel = dir.clone().multiply(1.5);
@@ -53,6 +54,7 @@ public class DiamondAttack {
s.setViewRange(64);
});
EntityTracker.mark(shard);
EntityTracker.smooth(shard);
Vector sv = d.clone().multiply(0.4);
new BukkitRunnable() {
@Override public void run() {
@@ -125,6 +127,7 @@ public class DiamondAttack {
s.setViewRange(64);
});
EntityTracker.mark(shard);
EntityTracker.smooth(shard);
Vector sv = d.clone().multiply(0.4);
new BukkitRunnable() {
@Override public void run() {
@@ -48,6 +48,7 @@ public class DiamondTripleAttack {
d.setTransformation(new org.bukkit.util.Transformation(new org.joml.Vector3f(-0.45f, -0.45f, -0.45f), new org.joml.AxisAngle4f(), new org.joml.Vector3f(0.9f, 0.9f, 0.9f), new org.joml.AxisAngle4f()));
});
EntityTracker.mark(shard);
EntityTracker.smooth(shard);
BlackKnifePlugin plugin = BlackKnifePlugin.getPlugin(BlackKnifePlugin.class);
Vector initDir = target.clone().subtract(spawn).toVector().normalize().multiply(1.4);
new BukkitRunnable() {
@@ -18,6 +18,10 @@ public class EntityTracker {
tracked.remove(e.getUniqueId());
}
public static void smooth(Display e) {
try { e.setTeleportDuration(1); } catch (Exception ignored) {}
}
public static int cleanup(BlackKnifePlugin plugin) {
int count = 0;
for (var world : plugin.getServer().getWorlds()) {
@@ -55,6 +55,7 @@ public class GrenadeAttack {
new org.joml.AxisAngle4f()));
});
EntityTracker.mark(nade);
EntityTracker.smooth(nade);
p.getWorld().playSound(spawn, Sound.ENTITY_SNOWBALL_THROW, 1f, 0.7f);
BlackKnifePlugin plugin = BlackKnifePlugin.getPlugin(BlackKnifePlugin.class);
@@ -40,6 +40,7 @@ public class LungeAttack {
d.setViewRange(64);
});
EntityTracker.mark(catalyst);
EntityTracker.smooth(catalyst);
p.getWorld().playSound(start, Sound.BLOCK_SCULK_CATALYST_BLOOM, 1f, 0.7f);
double catSpeed = 3.0;
@@ -154,6 +155,7 @@ public class LungeAttack {
new org.joml.AxisAngle4f()));
});
EntityTracker.mark(sword);
EntityTracker.smooth(sword);
new BukkitRunnable() {
long hold = 5;
boolean launched = false;
@@ -222,6 +224,7 @@ public class LungeAttack {
new org.joml.AxisAngle4f()));
});
EntityTracker.mark(sword);
EntityTracker.smooth(sword);
p.getWorld().playSound(gazePoint, Sound.ENTITY_PLAYER_ATTACK_SWEEP, 1f, 0.5f);
p.getWorld().playSound(gazePoint, Sound.BLOCK_ANVIL_LAND, 0.6f, 1.4f);
Vector vel = new Vector(0, -1.2, 0);
@@ -370,6 +373,7 @@ public class LungeAttack {
new org.joml.AxisAngle4f()));
});
EntityTracker.mark(sword);
EntityTracker.smooth(sword);
Vector vel = new Vector(0, -fallSpeed, 0);
p.getWorld().playSound(spawn, Sound.ENTITY_PLAYER_ATTACK_SWEEP, 0.6f, 0.7f);
new BukkitRunnable() {
@@ -463,6 +467,7 @@ public class LungeAttack {
new org.joml.AxisAngle4f()));
});
EntityTracker.mark(sword);
EntityTracker.smooth(sword);
spawn.getWorld().playSound(spawn, Sound.ENTITY_PLAYER_ATTACK_SWEEP, 0.8f, 0.5f);
new BukkitRunnable() {
@@ -34,6 +34,7 @@ public class PhantomBarrageAttack {
d.setTransformation(new org.bukkit.util.Transformation(new org.joml.Vector3f(-0.35f,-0.35f,-0.35f),new org.joml.AxisAngle4f(),new org.joml.Vector3f(0.7f,0.7f,0.7f),new org.joml.AxisAngle4f()));
});
EntityTracker.mark(orb);
EntityTracker.smooth(orb);
new BukkitRunnable() {
int ticks = 0;
Location cur = spawn.clone();
@@ -169,6 +169,7 @@ public class SwoonHandler implements Listener {
d.getPersistentDataContainer().set(SWOONED, PersistentDataType.BYTE, (byte) 1);
});
EntityTracker.mark(td);
EntityTracker.smooth(td);
displays.put(tp.getUniqueId(), td);
}