From 2b113ee336cb4b6b8528836475c31738d58c8fd6 Mon Sep 17 00:00:00 2001 From: OakLoaf Date: Fri, 4 Jul 2025 18:10:12 +0100 Subject: [PATCH] Added scale packets --- .../me/lojosho/hibiscuscommons/nms/NMSPackets.java | 2 ++ .../hibiscuscommons/nms/v1_20_R4/NMSPackets.java | 14 ++++++++++++++ .../hibiscuscommons/nms/v1_21_R1/NMSPackets.java | 14 ++++++++++++++ .../hibiscuscommons/nms/v1_21_R2/NMSPackets.java | 14 ++++++++++++++ .../hibiscuscommons/nms/v1_21_R3/NMSPackets.java | 14 ++++++++++++++ .../hibiscuscommons/nms/v1_21_R4/NMSPackets.java | 14 ++++++++++++++ .../hibiscuscommons/nms/v1_21_R5/NMSPackets.java | 14 ++++++++++++++ 7 files changed, 86 insertions(+) diff --git a/common/src/main/java/me/lojosho/hibiscuscommons/nms/NMSPackets.java b/common/src/main/java/me/lojosho/hibiscuscommons/nms/NMSPackets.java index 5ae2311..a476db9 100644 --- a/common/src/main/java/me/lojosho/hibiscuscommons/nms/NMSPackets.java +++ b/common/src/main/java/me/lojosho/hibiscuscommons/nms/NMSPackets.java @@ -83,6 +83,8 @@ public interface NMSPackets { void sendEntityDestroyPacket(IntList entityIds, List sendTo); + void sendEntityScalePacket(int entityId, double scale, List sendTo); + void sendItemDisplayMetadata(int entityId, Vector3f translation, Vector3f scale, diff --git a/v1_20_R4/src/main/java/me/lojosho/hibiscuscommons/nms/v1_20_R4/NMSPackets.java b/v1_20_R4/src/main/java/me/lojosho/hibiscuscommons/nms/v1_20_R4/NMSPackets.java index e134953..df597b2 100644 --- a/v1_20_R4/src/main/java/me/lojosho/hibiscuscommons/nms/v1_20_R4/NMSPackets.java +++ b/v1_20_R4/src/main/java/me/lojosho/hibiscuscommons/nms/v1_20_R4/NMSPackets.java @@ -26,6 +26,8 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.level.GameType; @@ -328,6 +330,18 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. for (Player p : sendTo) sendPacket(p, packet); } + @Override + public void sendEntityScalePacket(int entityId, double scale, List sendTo) { + AttributeInstance attribute = new AttributeInstance( + Attributes.SCALE, + (ignored) -> {} + ); + attribute.setBaseValue(scale); + + ClientboundUpdateAttributesPacket packet = new ClientboundUpdateAttributesPacket(entityId, List.of(attribute)); + for (Player p : sendTo) sendPacket(p, packet); + } + @Override public void sendItemDisplayMetadata(int entityId, Vector3f translation, diff --git a/v1_21_R1/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R1/NMSPackets.java b/v1_21_R1/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R1/NMSPackets.java index d6b843a..a139b28 100644 --- a/v1_21_R1/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R1/NMSPackets.java +++ b/v1_21_R1/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R1/NMSPackets.java @@ -26,6 +26,8 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.level.GameType; @@ -327,6 +329,18 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. for (Player p : sendTo) sendPacket(p, packet); } + @Override + public void sendEntityScalePacket(int entityId, double scale, List sendTo) { + AttributeInstance attribute = new AttributeInstance( + Attributes.SCALE, + (ignored) -> {} + ); + attribute.setBaseValue(scale); + + ClientboundUpdateAttributesPacket packet = new ClientboundUpdateAttributesPacket(entityId, List.of(attribute)); + for (Player p : sendTo) sendPacket(p, packet); + } + @Override public void sendItemDisplayMetadata(int entityId, Vector3f translation, diff --git a/v1_21_R2/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R2/NMSPackets.java b/v1_21_R2/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R2/NMSPackets.java index 8598794..8192da0 100644 --- a/v1_21_R2/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R2/NMSPackets.java +++ b/v1_21_R2/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R2/NMSPackets.java @@ -27,6 +27,8 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.PositionMoveRotation; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.level.GameType; @@ -330,6 +332,18 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. for (Player p : sendTo) sendPacket(p, packet); } + @Override + public void sendEntityScalePacket(int entityId, double scale, List sendTo) { + AttributeInstance attribute = new AttributeInstance( + Attributes.SCALE, + (ignored) -> {} + ); + attribute.setBaseValue(scale); + + ClientboundUpdateAttributesPacket packet = new ClientboundUpdateAttributesPacket(entityId, List.of(attribute)); + for (Player p : sendTo) sendPacket(p, packet); + } + @Override public void sendItemDisplayMetadata(int entityId, Vector3f translation, diff --git a/v1_21_R3/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R3/NMSPackets.java b/v1_21_R3/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R3/NMSPackets.java index c281c3c..b414211 100644 --- a/v1_21_R3/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R3/NMSPackets.java +++ b/v1_21_R3/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R3/NMSPackets.java @@ -28,6 +28,8 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.PositionMoveRotation; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.level.GameType; @@ -334,6 +336,18 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. for (Player p : sendTo) sendPacket(p, packet); } + @Override + public void sendEntityScalePacket(int entityId, double scale, List sendTo) { + AttributeInstance attribute = new AttributeInstance( + Attributes.SCALE, + (ignored) -> {} + ); + attribute.setBaseValue(scale); + + ClientboundUpdateAttributesPacket packet = new ClientboundUpdateAttributesPacket(entityId, List.of(attribute)); + for (Player p : sendTo) sendPacket(p, packet); + } + @Override public void sendItemDisplayMetadata(int entityId, Vector3f translation, diff --git a/v1_21_R4/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R4/NMSPackets.java b/v1_21_R4/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R4/NMSPackets.java index 2afb9e1..c89328a 100644 --- a/v1_21_R4/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R4/NMSPackets.java +++ b/v1_21_R4/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R4/NMSPackets.java @@ -32,6 +32,8 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.PositionMoveRotation; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.level.GameType; @@ -335,6 +337,18 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. for (Player p : sendTo) sendPacket(p, packet); } + @Override + public void sendEntityScalePacket(int entityId, double scale, List sendTo) { + AttributeInstance attribute = new AttributeInstance( + Attributes.SCALE, + (ignored) -> {} + ); + attribute.setBaseValue(scale); + + ClientboundUpdateAttributesPacket packet = new ClientboundUpdateAttributesPacket(entityId, List.of(attribute)); + for (Player p : sendTo) sendPacket(p, packet); + } + @Override public void sendItemDisplayMetadata(int entityId, Vector3f translation, diff --git a/v1_21_R5/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R5/NMSPackets.java b/v1_21_R5/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R5/NMSPackets.java index 6225ad6..15a12ce 100644 --- a/v1_21_R5/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R5/NMSPackets.java +++ b/v1_21_R5/src/main/java/me/lojosho/hibiscuscommons/nms/v1_21_R5/NMSPackets.java @@ -29,6 +29,8 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.PositionMoveRotation; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.level.GameType; @@ -339,6 +341,18 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. for (Player p : sendTo) sendPacket(p, packet); } + @Override + public void sendEntityScalePacket(int entityId, double scale, List sendTo) { + AttributeInstance attribute = new AttributeInstance( + Attributes.SCALE, + (ignored) -> {} + ); + attribute.setBaseValue(scale); + + ClientboundUpdateAttributesPacket packet = new ClientboundUpdateAttributesPacket(entityId, List.of(attribute)); + for (Player p : sendTo) sendPacket(p, packet); + } + @Override public void sendItemDisplayMetadata(int entityId, Vector3f translation,