This commit is contained in:
zimzaza4
2024-07-21 14:57:49 +08:00
parent 4cfea799df
commit 5535527f84
3 changed files with 10 additions and 11 deletions

View File

@@ -210,7 +210,6 @@ public class EntityTask {
EntityUtils.sendCustomScale(player, model.getEntity().getEntityId(), average); EntityUtils.sendCustomScale(player, model.getEntity().getEntityId(), average);
if (ignore) return;
lastScale = average; lastScale = average;
} }
@@ -222,7 +221,6 @@ public class EntityTask {
EntityUtils.sendCustomColor(player, model.getEntity().getEntityId(), color); EntityUtils.sendCustomColor(player, model.getEntity().getEntityId(), color);
if (ignore) return;
lastColor = color; lastColor = color;
} }
@@ -338,8 +336,6 @@ 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;
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);
} }

View File

@@ -3,19 +3,22 @@ package re.imc.geysermodelengine.packet;
import com.comphenix.protocol.PacketType; import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketContainer;
public class EntityHurtAnimationPacket implements WrapperPacket { public class EntityHurtPacket implements WrapperPacket {
private final int id; private final int id;
public EntityHurtAnimationPacket(int id) { public EntityHurtPacket(int id) {
this.id = id; this.id = id;
} }
@Override @Override
public PacketContainer encode() { public PacketContainer encode() {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.HURT_ANIMATION); PacketContainer packet = new PacketContainer(PacketType.Play.Server.DAMAGE_EVENT);
packet.getIntegers().write(0, id); packet.getIntegers().write(0, id);
packet.getFloat().write(0, 5f); packet.getIntegers().write(1,0);
packet.getIntegers().write(2, 0);
packet.getIntegers().write(3, 0);
packet.getBooleans().write(0, false);
return packet; return packet;
} }
} }

View File

@@ -54,12 +54,12 @@ public class PacketEntity {
public void sendSpawnPacket(Collection<Player> players) { public void sendSpawnPacket(Collection<Player> players) {
EntitySpawnPacket packet = new EntitySpawnPacket(id, uuid, type, location); EntitySpawnPacket packet = new EntitySpawnPacket(id, uuid, type, location);
EntityMetadataPacket metadataPacket = new EntityMetadataPacket(id); // EntityMetadataPacket metadataPacket = new EntityMetadataPacket(id);
players.forEach(player -> { players.forEach(player -> {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet.encode()); ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet.encode());
}); });
players.forEach(player -> ProtocolLibrary.getProtocolManager().sendServerPacket(player, metadataPacket.encode())); // players.forEach(player -> ProtocolLibrary.getProtocolManager().sendServerPacket(player, metadataPacket.encode()));
} }
public void sendLocationPacket(Collection<Player> players) { public void sendLocationPacket(Collection<Player> players) {
@@ -69,7 +69,7 @@ public class PacketEntity {
} }
public void sendHurtPacket(Collection<Player> players) { public void sendHurtPacket(Collection<Player> players) {
EntityHurtAnimationPacket packet = new EntityHurtAnimationPacket(id); EntityHurtPacket packet = new EntityHurtPacket(id);
players.forEach(player -> ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet.encode())); players.forEach(player -> ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet.encode()));
} }