mirror of
https://github.com/GeyserExtensionists/GeyserModelEngine.git
synced 2025-12-19 15:09:18 +00:00
fix some animations
This commit is contained in:
@@ -72,14 +72,14 @@ public class EntityTask {
|
|||||||
ActiveModel activeModel = model.getActiveModel();
|
ActiveModel activeModel = model.getActiveModel();
|
||||||
ModeledEntity modeledEntity = model.getModeledEntity();
|
ModeledEntity modeledEntity = model.getModeledEntity();
|
||||||
if (activeModel.isDestroyed() || activeModel.isRemoved() || !modeledEntity.getBase().isAlive()) {
|
if (activeModel.isDestroyed() || activeModel.isRemoved() || !modeledEntity.getBase().isAlive()) {
|
||||||
if (!activeModel.isRemoved() && hasAnimation("death")) {
|
if (!modeledEntity.getBase().isAlive() && hasAnimation("death")) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
removed = true;
|
removed = true;
|
||||||
entity.remove();
|
entity.remove();
|
||||||
}
|
}
|
||||||
}.runTaskLater(GeyserModelEngine.getInstance(), Math.min(Math.max(playAnimation("death", 999, 5f, true) - 3, 0), 200));
|
}.runTaskLater(GeyserModelEngine.getInstance(), Math.min(Math.max(playAnimation("death", 999) + 2, 0), 200));
|
||||||
} else {
|
} else {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -241,14 +241,15 @@ public class EntityTask {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
// i really dont know why crash
|
// i really dont know why crash
|
||||||
Optional<Player> player = model.getViewers().stream().findAny();
|
|
||||||
if (player.isEmpty()) return;
|
|
||||||
|
|
||||||
int toSend = 3;
|
int toSend = 3;
|
||||||
if (animationCooldown.get() == 0) {
|
if (animationCooldown.get() == 0) {
|
||||||
toSend = currentAnimProperty;
|
toSend = currentAnimProperty;
|
||||||
}
|
}
|
||||||
EntityUtils.sendVariant(player.get(), model.getEntity().getEntityId(), toSend);
|
for (Player viewer : model.getViewers()) {
|
||||||
|
EntityUtils.sendVariant(viewer, model.getEntity().getEntityId(), toSend);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEntityProperties(Player player, boolean ignore) {
|
public void updateEntityProperties(Player player, boolean ignore) {
|
||||||
@@ -344,6 +345,10 @@ public class EntityTask {
|
|||||||
setAnimationProperty(1);
|
setAnimationProperty(1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (animationProperty.getName().equalsIgnoreCase("spawn")) {
|
||||||
|
setAnimationProperty(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
boolean play = false;
|
boolean play = false;
|
||||||
if (currentAnimationPriority.get() < p) {
|
if (currentAnimationPriority.get() < p) {
|
||||||
@@ -367,7 +372,7 @@ public class EntityTask {
|
|||||||
|
|
||||||
String id = "animation." + activeModel.getBlueprint().getName().toLowerCase() + "." + animationProperty.getName().toLowerCase();
|
String id = "animation." + activeModel.getBlueprint().getName().toLowerCase() + "." + animationProperty.getName().toLowerCase();
|
||||||
lastAnimation = id;
|
lastAnimation = id;
|
||||||
animationCooldown.set((int) Math.min(Math.floor(animationProperty.getLength() * 20) - 4, 1));
|
animationCooldown.set((int) Math.max(Math.floor(animationProperty.getLength() * 20) - 5, 1));
|
||||||
|
|
||||||
playBedrockAnimation(id, model.getViewers(), looping, blendTime);
|
playBedrockAnimation(id, model.getViewers(), looping, blendTime);
|
||||||
setAnimationProperty(3);
|
setAnimationProperty(3);
|
||||||
|
|||||||
Reference in New Issue
Block a user