mirror of
https://github.com/xSquishyLiam/mc-GeyserModelEngine-plugin.git
synced 2025-12-19 14:59:19 +00:00
huh
This commit is contained in:
@@ -33,6 +33,7 @@ import static re.imc.geysermodelengine.model.ModelEntity.MODEL_ENTITIES;
|
|||||||
@Setter
|
@Setter
|
||||||
public class EntityTask {
|
public class EntityTask {
|
||||||
|
|
||||||
|
private static final String STOP_ANIMATION_PROPERTY = "anim_stop";
|
||||||
ModelEntity model;
|
ModelEntity model;
|
||||||
|
|
||||||
int tick = 0;
|
int tick = 0;
|
||||||
@@ -207,11 +208,11 @@ public class EntityTask {
|
|||||||
|
|
||||||
Vector3f scale = model.getActiveModel().getScale();
|
Vector3f scale = model.getActiveModel().getScale();
|
||||||
float average = (scale.x + scale.y + scale.z) / 3;
|
float average = (scale.x + scale.y + scale.z) / 3;
|
||||||
if (average == lastScale) return;
|
if (ignore) {
|
||||||
|
if (average == lastScale) return;
|
||||||
|
}
|
||||||
EntityUtils.sendCustomScale(player, model.getEntity().getEntityId(), average);
|
EntityUtils.sendCustomScale(player, model.getEntity().getEntityId(), average);
|
||||||
|
|
||||||
if (ignore) return;
|
|
||||||
lastScale = average;
|
lastScale = average;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,6 +229,8 @@ public class EntityTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setAnimationProperty(String currentAnimProperty) {
|
public void setAnimationProperty(String currentAnimProperty) {
|
||||||
|
model.getViewers().forEach(viewer -> viewer.sendActionBar("CURRENT P AN:" + currentAnimProperty));
|
||||||
|
|
||||||
this.lastAnimProperty = currentAnimProperty;
|
this.lastAnimProperty = currentAnimProperty;
|
||||||
this.currentAnimProperty = currentAnimProperty;
|
this.currentAnimProperty = currentAnimProperty;
|
||||||
}
|
}
|
||||||
@@ -258,8 +261,13 @@ public class EntityTask {
|
|||||||
|
|
||||||
|
|
||||||
if (ignore || !lastAnimProperty.equals(currentAnimProperty)) {
|
if (ignore || !lastAnimProperty.equals(currentAnimProperty)) {
|
||||||
updates.put("modelengine:" + lastAnimProperty, false);
|
if (animationCooldown.get() == 0) {
|
||||||
updates.put("modelengine:" + currentAnimProperty, true);
|
updates.put("modelengine:" + lastAnimProperty, false);
|
||||||
|
updates.put("modelengine:" + currentAnimProperty, true);
|
||||||
|
} else {
|
||||||
|
updates.put("modelengine:" + lastAnimProperty, false);
|
||||||
|
updates.put("modelengine:" + STOP_ANIMATION_PROPERTY, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (updates.isEmpty()) return;
|
if (updates.isEmpty()) return;
|
||||||
EntityUtils.sendBoolProperties(player, entity, updates);
|
EntityUtils.sendBoolProperties(player, entity, updates);
|
||||||
@@ -326,12 +334,13 @@ public class EntityTask {
|
|||||||
|
|
||||||
|
|
||||||
if (play) {
|
if (play) {
|
||||||
setAnimationProperty("modelengine:anim_stop");
|
setAnimationProperty(STOP_ANIMATION_PROPERTY);
|
||||||
model.getViewers().forEach(viewer -> updateEntityProperties(viewer, false));
|
model.getViewers().forEach(viewer -> updateEntityProperties(viewer, false));
|
||||||
currentAnimationPriority.set(p);
|
currentAnimationPriority.set(p);
|
||||||
|
|
||||||
String id = "animation." + activeModel.getBlueprint().getName().toLowerCase() + "." + animationProperty.getName().toLowerCase();
|
String id = "animation." + activeModel.getBlueprint().getName().toLowerCase() + "." + animationProperty.getName().toLowerCase();
|
||||||
lastAnimation = id;
|
lastAnimation = id;
|
||||||
|
model.getViewers().forEach(viewer -> viewer.sendActionBar("CURRENT AN:" + id));
|
||||||
|
|
||||||
animationCooldown.set((int) (animationProperty.getLength() * 20));
|
animationCooldown.set((int) (animationProperty.getLength() * 20));
|
||||||
playBedrockAnimation(id, model.getViewers(), looping, blendTime);
|
playBedrockAnimation(id, model.getViewers(), looping, blendTime);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class EntityHurtAnimationPacket implements WrapperPacket {
|
|||||||
public PacketContainer encode() {
|
public PacketContainer encode() {
|
||||||
PacketContainer packet = new PacketContainer(PacketType.Play.Server.HURT_ANIMATION);
|
PacketContainer packet = new PacketContainer(PacketType.Play.Server.HURT_ANIMATION);
|
||||||
packet.getIntegers().write(0, id);
|
packet.getIntegers().write(0, id);
|
||||||
packet.getFloat().write(0, 1f);
|
packet.getFloat().write(0, 5f);
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user