This commit is contained in:
zimzaza4
2024-07-07 04:14:06 +08:00
parent 140b8cafd1
commit 191e94df0f
5 changed files with 44 additions and 25 deletions

View File

@@ -110,7 +110,7 @@ public class EntityTask {
spawnAnimationPlayed = true;
}
if (tick > 1 && tick % 5 == 0) {
if (tick % 5 == 0) {
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
if (FloodgateApi.getInstance().isFloodgatePlayer(onlinePlayer.getUniqueId())) {
@@ -134,9 +134,10 @@ public class EntityTask {
*/
}
} else {
entity.sendEntityDestroyPacket(Collections.singletonList(onlinePlayer));
viewers.remove(onlinePlayer);
if (viewers.contains(onlinePlayer)) {
entity.sendEntityDestroyPacket(Collections.singletonList(onlinePlayer));
viewers.remove(onlinePlayer);
}
}
}
}
@@ -212,18 +213,16 @@ public class EntityTask {
}
public void sendEntityData(Player player, int delay) {
// System.out.println("TYPE: " + "modelengine:" + model.getActiveModel().getBlueprint().getName().toLowerCase());
PlayerUtils.setCustomEntity(player, model.getEntity().getEntityId(), "modelengine:" + model.getActiveModel().getBlueprint().getName().toLowerCase());
model.getEntity().sendSpawnPacket(Collections.singletonList(player));
Bukkit.getScheduler().runTaskLaterAsynchronously(GeyserModelEngine.getInstance(), () -> {
// PlayerUtils.sendCustomSkin(player, model.getEntity(), model.getActiveModel().getBlueprint().getName());
if (looping) {
playBedrockAnimation(lastAnimation, Set.of(player), looping, 0f);
}
sendHitBox(player);
sendScale(player, true);
model.getEntity().sendSpawnPacket(Collections.singletonList(player));
Bukkit.getScheduler().runTaskLaterAsynchronously(GeyserModelEngine.getInstance(), () -> {
if (looping) {
playBedrockAnimation(lastAnimation, Set.of(player), looping, 0f);
}
sendHitBox(player);
sendScale(player, true);
updateVisibility(player, true);
@@ -411,9 +410,6 @@ public class EntityTask {
if (player.isDead()) {
return false;
}
if (player.getWorld() != entity.getWorld()) {
return false;
}
if (GeyserModelEngine.getInstance().getJoinedPlayer() != null && GeyserModelEngine.getInstance().getJoinedPlayer().getIfPresent(player) != null) {
return false;
}