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 a476db9..4fdd474 100644 --- a/common/src/main/java/me/lojosho/hibiscuscommons/nms/NMSPackets.java +++ b/common/src/main/java/me/lojosho/hibiscuscommons/nms/NMSPackets.java @@ -97,5 +97,10 @@ public interface NMSPackets { void sendToastPacket(Player player, ItemStack icon, Component title, Component description); + void sendInvisibleParticleCloud(int entityId, Location location, UUID uuid, List sendTo); + + // The mask here is for is the armorstand is on fire or not. + void sendInvisibleArmorstand(int entityId, Location location, UUID uuid, byte mask, List sendTo); + Object createMountPacket(int entityId, int[] passengerIds); } 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 0ff338a..69c143f 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 @@ -57,10 +57,16 @@ import java.util.stream.Collectors; public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons.nms.NMSPackets { private static ServerLevel level = MinecraftServer.getServer().overworld(); + private static final Map CLOUD_EFFECT_INVISIBLE_DATA_VALUES = Map.of(0, (byte) 0x20, 8, 0f); // For cloud effects private static Entity fakeNmsEntity = new ArmorStand(net.minecraft.world.entity.EntityType.ARMOR_STAND, level); @Override @SuppressWarnings("unchecked") public void sendSharedEntityData(int entityId, Map dataValues, List sendTo) { + ClientboundSetEntityDataPacket packet = getSharedEntityPacket(entityId, dataValues); + for (Player player : sendTo) sendPacket(player, packet); + } + + private ClientboundSetEntityDataPacket getSharedEntityPacket(int entityId, Map dataValues) { List> nmsDataValues = dataValues.entrySet().stream().map(entry -> { int index = entry.getKey(); Number value = entry.getValue(); @@ -73,8 +79,7 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. }; }).collect(Collectors.toList()); - ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(entityId, nmsDataValues); - for (Player player : sendTo) sendPacket(player, packet); + return new ClientboundSetEntityDataPacket(entityId, nmsDataValues); } @Override @@ -467,4 +472,40 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. fakeNmsEntity.passengers = ImmutableList.of(); return packet; } + @Override + public void sendInvisibleParticleCloud(int entityId, Location location, UUID uuid, List sendTo) { + net.minecraft.world.entity.EntityType nmsEntityType = net.minecraft.world.entity.EntityType.AREA_EFFECT_CLOUD; + double x = location.getX(); + double y = location.getY(); + double z = location.getZ(); + float yaw = location.getYaw(); + float pitch = location.getPitch(); + Vec3 velocity = Vec3.ZERO; + float headYaw = 0f; + + ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(entityId, uuid, x, y, z, yaw, pitch, nmsEntityType, 0, velocity, headYaw); + ClientboundSetEntityDataPacket dataPacket = getSharedEntityPacket(entityId, CLOUD_EFFECT_INVISIBLE_DATA_VALUES); + + ClientboundBundlePacket bundlePacket = new ClientboundBundlePacket(List.of(spawnPacket, dataPacket)); + for (Player p : sendTo) sendPacket(p, bundlePacket); + } + + public void sendInvisibleArmorstand(int entityId, Location location, UUID uuid, byte mask, List sendTo) { + net.minecraft.world.entity.EntityType nmsEntityType = net.minecraft.world.entity.EntityType.ARMOR_STAND; + double x = location.getX(); + double y = location.getY(); + double z = location.getZ(); + float yaw = location.getYaw(); + float pitch = location.getPitch(); + Vec3 velocity = Vec3.ZERO; + float headYaw = 0f; + + final ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(entityId, uuid, x, y, z, yaw, pitch, nmsEntityType, 0, velocity, headYaw); + + final Map dataValues = Map.of(0, mask, 15, (byte) 0x10); + final ClientboundSetEntityDataPacket dataPacket = getSharedEntityPacket(entityId, dataValues); + + ClientboundBundlePacket bundlePacket = new ClientboundBundlePacket(List.of(spawnPacket, dataPacket)); + for (Player p : sendTo) sendPacket(p, bundlePacket); + } } 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 2c1076e..d8e043f 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 @@ -59,10 +59,16 @@ import java.util.stream.Collectors; public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons.nms.NMSPackets { private static ServerLevel level = MinecraftServer.getServer().overworld(); + private static final Map CLOUD_EFFECT_INVISIBLE_DATA_VALUES = Map.of(0, (byte) 0x20, 8, 0f); // For cloud effects private static Entity fakeNmsEntity = new ArmorStand(net.minecraft.world.entity.EntityType.ARMOR_STAND, level); @Override @SuppressWarnings("unchecked") public void sendSharedEntityData(int entityId, Map dataValues, List sendTo) { + ClientboundSetEntityDataPacket packet = getSharedEntityPacket(entityId, dataValues); + for (Player player : sendTo) sendPacket(player, packet); + } + + private ClientboundSetEntityDataPacket getSharedEntityPacket(int entityId, Map dataValues) { List> nmsDataValues = dataValues.entrySet().stream().map(entry -> { int index = entry.getKey(); Number value = entry.getValue(); @@ -75,8 +81,7 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. }; }).collect(Collectors.toList()); - ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(entityId, nmsDataValues); - for (Player player : sendTo) sendPacket(player, packet); + return new ClientboundSetEntityDataPacket(entityId, nmsDataValues); } @Override @@ -469,4 +474,40 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. fakeNmsEntity.passengers = ImmutableList.of(); return packet; } + @Override + public void sendInvisibleParticleCloud(int entityId, Location location, UUID uuid, List sendTo) { + net.minecraft.world.entity.EntityType nmsEntityType = net.minecraft.world.entity.EntityType.AREA_EFFECT_CLOUD; + double x = location.getX(); + double y = location.getY(); + double z = location.getZ(); + float yaw = location.getYaw(); + float pitch = location.getPitch(); + Vec3 velocity = Vec3.ZERO; + float headYaw = 0f; + + ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(entityId, uuid, x, y, z, yaw, pitch, nmsEntityType, 0, velocity, headYaw); + ClientboundSetEntityDataPacket dataPacket = getSharedEntityPacket(entityId, CLOUD_EFFECT_INVISIBLE_DATA_VALUES); + + ClientboundBundlePacket bundlePacket = new ClientboundBundlePacket(List.of(spawnPacket, dataPacket)); + for (Player p : sendTo) sendPacket(p, bundlePacket); + } + + public void sendInvisibleArmorstand(int entityId, Location location, UUID uuid, byte mask, List sendTo) { + net.minecraft.world.entity.EntityType nmsEntityType = net.minecraft.world.entity.EntityType.ARMOR_STAND; + double x = location.getX(); + double y = location.getY(); + double z = location.getZ(); + float yaw = location.getYaw(); + float pitch = location.getPitch(); + Vec3 velocity = Vec3.ZERO; + float headYaw = 0f; + + final ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(entityId, uuid, x, y, z, yaw, pitch, nmsEntityType, 0, velocity, headYaw); + + final Map dataValues = Map.of(0, mask, 15, (byte) 0x10); + final ClientboundSetEntityDataPacket dataPacket = getSharedEntityPacket(entityId, dataValues); + + ClientboundBundlePacket bundlePacket = new ClientboundBundlePacket(List.of(spawnPacket, dataPacket)); + for (Player p : sendTo) sendPacket(p, bundlePacket); + } } 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 5a0bf0b..7d9ffc6 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 @@ -60,10 +60,16 @@ import java.util.stream.Collectors; public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons.nms.NMSPackets { private static ServerLevel level = MinecraftServer.getServer().overworld(); + private static final Map CLOUD_EFFECT_INVISIBLE_DATA_VALUES = Map.of(0, (byte) 0x20, 8, 0f); // For cloud effects private static Entity fakeNmsEntity = new ArmorStand(net.minecraft.world.entity.EntityType.ARMOR_STAND, level); @Override @SuppressWarnings("unchecked") public void sendSharedEntityData(int entityId, Map dataValues, List sendTo) { + ClientboundSetEntityDataPacket packet = getSharedEntityPacket(entityId, dataValues); + for (Player player : sendTo) sendPacket(player, packet); + } + + private ClientboundSetEntityDataPacket getSharedEntityPacket(int entityId, Map dataValues) { List> nmsDataValues = dataValues.entrySet().stream().map(entry -> { int index = entry.getKey(); Number value = entry.getValue(); @@ -76,8 +82,7 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. }; }).collect(Collectors.toList()); - ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(entityId, nmsDataValues); - for (Player player : sendTo) sendPacket(player, packet); + return new ClientboundSetEntityDataPacket(entityId, nmsDataValues); } @Override @@ -467,4 +472,40 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. fakeNmsEntity.passengers = ImmutableList.of(); return packet; } + @Override + public void sendInvisibleParticleCloud(int entityId, Location location, UUID uuid, List sendTo) { + net.minecraft.world.entity.EntityType nmsEntityType = net.minecraft.world.entity.EntityType.AREA_EFFECT_CLOUD; + double x = location.getX(); + double y = location.getY(); + double z = location.getZ(); + float yaw = location.getYaw(); + float pitch = location.getPitch(); + Vec3 velocity = Vec3.ZERO; + float headYaw = 0f; + + ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(entityId, uuid, x, y, z, yaw, pitch, nmsEntityType, 0, velocity, headYaw); + ClientboundSetEntityDataPacket dataPacket = getSharedEntityPacket(entityId, CLOUD_EFFECT_INVISIBLE_DATA_VALUES); + + ClientboundBundlePacket bundlePacket = new ClientboundBundlePacket(List.of(spawnPacket, dataPacket)); + for (Player p : sendTo) sendPacket(p, bundlePacket); + } + + public void sendInvisibleArmorstand(int entityId, Location location, UUID uuid, byte mask, List sendTo) { + net.minecraft.world.entity.EntityType nmsEntityType = net.minecraft.world.entity.EntityType.ARMOR_STAND; + double x = location.getX(); + double y = location.getY(); + double z = location.getZ(); + float yaw = location.getYaw(); + float pitch = location.getPitch(); + Vec3 velocity = Vec3.ZERO; + float headYaw = 0f; + + final ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(entityId, uuid, x, y, z, yaw, pitch, nmsEntityType, 0, velocity, headYaw); + + final Map dataValues = Map.of(0, mask, 15, (byte) 0x10); + final ClientboundSetEntityDataPacket dataPacket = getSharedEntityPacket(entityId, dataValues); + + ClientboundBundlePacket bundlePacket = new ClientboundBundlePacket(List.of(spawnPacket, dataPacket)); + for (Player p : sendTo) sendPacket(p, bundlePacket); + } } 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 5548c47..dc537aa 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 @@ -60,10 +60,16 @@ import java.util.stream.Collectors; public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons.nms.NMSPackets { private static ServerLevel level = MinecraftServer.getServer().overworld(); + private static final Map CLOUD_EFFECT_INVISIBLE_DATA_VALUES = Map.of(0, (byte) 0x20, 8, 0f); // For cloud effects private static Entity fakeNmsEntity = new ArmorStand(net.minecraft.world.entity.EntityType.ARMOR_STAND, level); @Override @SuppressWarnings("unchecked") public void sendSharedEntityData(int entityId, Map dataValues, List sendTo) { + ClientboundSetEntityDataPacket packet = getSharedEntityPacket(entityId, dataValues); + for (Player player : sendTo) sendPacket(player, packet); + } + + private ClientboundSetEntityDataPacket getSharedEntityPacket(int entityId, Map dataValues) { List> nmsDataValues = dataValues.entrySet().stream().map(entry -> { int index = entry.getKey(); Number value = entry.getValue(); @@ -76,8 +82,7 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. }; }).collect(Collectors.toList()); - ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(entityId, nmsDataValues); - for (Player player : sendTo) sendPacket(player, packet); + return new ClientboundSetEntityDataPacket(entityId, nmsDataValues); } @Override @@ -502,4 +507,41 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. fakeNmsEntity.passengers = ImmutableList.of(); return packet; } + + @Override + public void sendInvisibleParticleCloud(int entityId, Location location, UUID uuid, List sendTo) { + net.minecraft.world.entity.EntityType nmsEntityType = net.minecraft.world.entity.EntityType.AREA_EFFECT_CLOUD; + double x = location.getX(); + double y = location.getY(); + double z = location.getZ(); + float yaw = location.getYaw(); + float pitch = location.getPitch(); + Vec3 velocity = Vec3.ZERO; + float headYaw = 0f; + + ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(entityId, uuid, x, y, z, yaw, pitch, nmsEntityType, 0, velocity, headYaw); + ClientboundSetEntityDataPacket dataPacket = getSharedEntityPacket(entityId, CLOUD_EFFECT_INVISIBLE_DATA_VALUES); + + ClientboundBundlePacket bundlePacket = new ClientboundBundlePacket(List.of(spawnPacket, dataPacket)); + for (Player p : sendTo) sendPacket(p, bundlePacket); + } + + public void sendInvisibleArmorstand(int entityId, Location location, UUID uuid, byte mask, List sendTo) { + net.minecraft.world.entity.EntityType nmsEntityType = net.minecraft.world.entity.EntityType.ARMOR_STAND; + double x = location.getX(); + double y = location.getY(); + double z = location.getZ(); + float yaw = location.getYaw(); + float pitch = location.getPitch(); + Vec3 velocity = Vec3.ZERO; + float headYaw = 0f; + + final ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(entityId, uuid, x, y, z, yaw, pitch, nmsEntityType, 0, velocity, headYaw); + + final Map dataValues = Map.of(0, mask, 15, (byte) 0x10); + final ClientboundSetEntityDataPacket dataPacket = getSharedEntityPacket(entityId, dataValues); + + ClientboundBundlePacket bundlePacket = new ClientboundBundlePacket(List.of(spawnPacket, dataPacket)); + for (Player p : sendTo) sendPacket(p, bundlePacket); + } } 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 cd4fa45..8073da9 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 @@ -60,10 +60,16 @@ import java.util.stream.Collectors; public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons.nms.NMSPackets { private static ServerLevel level = MinecraftServer.getServer().overworld(); + private static final Map CLOUD_EFFECT_INVISIBLE_DATA_VALUES = Map.of(0, (byte) 0x20, 8, 0f); // For cloud effects private static Entity fakeNmsEntity = new ArmorStand(net.minecraft.world.entity.EntityType.ARMOR_STAND, level); @Override @SuppressWarnings("unchecked") public void sendSharedEntityData(int entityId, Map dataValues, List sendTo) { + ClientboundSetEntityDataPacket packet = getSharedEntityPacket(entityId, dataValues); + for (Player player : sendTo) sendPacket(player, packet); + } + + private ClientboundSetEntityDataPacket getSharedEntityPacket(int entityId, Map dataValues) { List> nmsDataValues = dataValues.entrySet().stream().map(entry -> { int index = entry.getKey(); Number value = entry.getValue(); @@ -76,8 +82,7 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. }; }).collect(Collectors.toList()); - ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(entityId, nmsDataValues); - for (Player player : sendTo) sendPacket(player, packet); + return new ClientboundSetEntityDataPacket(entityId, nmsDataValues); } @Override @@ -503,4 +508,40 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. fakeNmsEntity.passengers = ImmutableList.of(); return packet; } + @Override + public void sendInvisibleParticleCloud(int entityId, Location location, UUID uuid, List sendTo) { + net.minecraft.world.entity.EntityType nmsEntityType = net.minecraft.world.entity.EntityType.AREA_EFFECT_CLOUD; + double x = location.getX(); + double y = location.getY(); + double z = location.getZ(); + float yaw = location.getYaw(); + float pitch = location.getPitch(); + Vec3 velocity = Vec3.ZERO; + float headYaw = 0f; + + ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(entityId, uuid, x, y, z, yaw, pitch, nmsEntityType, 0, velocity, headYaw); + ClientboundSetEntityDataPacket dataPacket = getSharedEntityPacket(entityId, CLOUD_EFFECT_INVISIBLE_DATA_VALUES); + + ClientboundBundlePacket bundlePacket = new ClientboundBundlePacket(List.of(spawnPacket, dataPacket)); + for (Player p : sendTo) sendPacket(p, bundlePacket); + } + + public void sendInvisibleArmorstand(int entityId, Location location, UUID uuid, byte mask, List sendTo) { + net.minecraft.world.entity.EntityType nmsEntityType = net.minecraft.world.entity.EntityType.ARMOR_STAND; + double x = location.getX(); + double y = location.getY(); + double z = location.getZ(); + float yaw = location.getYaw(); + float pitch = location.getPitch(); + Vec3 velocity = Vec3.ZERO; + float headYaw = 0f; + + final ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(entityId, uuid, x, y, z, yaw, pitch, nmsEntityType, 0, velocity, headYaw); + + final Map dataValues = Map.of(0, mask, 15, (byte) 0x10); + final ClientboundSetEntityDataPacket dataPacket = getSharedEntityPacket(entityId, dataValues); + + ClientboundBundlePacket bundlePacket = new ClientboundBundlePacket(List.of(spawnPacket, dataPacket)); + for (Player p : sendTo) sendPacket(p, bundlePacket); + } } 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 61be102..4fa132d 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 @@ -57,10 +57,16 @@ import java.util.stream.Collectors; public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons.nms.NMSPackets { private static ServerLevel level = MinecraftServer.getServer().overworld(); + private static final Map CLOUD_EFFECT_INVISIBLE_DATA_VALUES = Map.of(0, (byte) 0x20, 8, 0f); // For cloud effects private static Entity fakeNmsEntity = new ArmorStand(net.minecraft.world.entity.EntityType.ARMOR_STAND, level); @Override @SuppressWarnings("unchecked") public void sendSharedEntityData(int entityId, Map dataValues, List sendTo) { + ClientboundSetEntityDataPacket packet = getSharedEntityPacket(entityId, dataValues); + for (Player player : sendTo) sendPacket(player, packet); + } + + private ClientboundSetEntityDataPacket getSharedEntityPacket(int entityId, Map dataValues) { List> nmsDataValues = dataValues.entrySet().stream().map(entry -> { int index = entry.getKey(); Number value = entry.getValue(); @@ -73,8 +79,7 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. }; }).collect(Collectors.toList()); - ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(entityId, nmsDataValues); - for (Player player : sendTo) sendPacket(player, packet); + return new ClientboundSetEntityDataPacket(entityId, nmsDataValues); } @Override @@ -500,4 +505,41 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons. fakeNmsEntity.passengers = ImmutableList.of(); return packet; } + + @Override + public void sendInvisibleParticleCloud(int entityId, Location location, UUID uuid, List sendTo) { + net.minecraft.world.entity.EntityType nmsEntityType = net.minecraft.world.entity.EntityType.AREA_EFFECT_CLOUD; + double x = location.getX(); + double y = location.getY(); + double z = location.getZ(); + float yaw = location.getYaw(); + float pitch = location.getPitch(); + Vec3 velocity = Vec3.ZERO; + float headYaw = 0f; + + ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(entityId, uuid, x, y, z, yaw, pitch, nmsEntityType, 0, velocity, headYaw); + ClientboundSetEntityDataPacket dataPacket = getSharedEntityPacket(entityId, CLOUD_EFFECT_INVISIBLE_DATA_VALUES); + + ClientboundBundlePacket bundlePacket = new ClientboundBundlePacket(List.of(spawnPacket, dataPacket)); + for (Player p : sendTo) sendPacket(p, bundlePacket); + } + + public void sendInvisibleArmorstand(int entityId, Location location, UUID uuid, byte mask, List sendTo) { + net.minecraft.world.entity.EntityType nmsEntityType = net.minecraft.world.entity.EntityType.ARMOR_STAND; + double x = location.getX(); + double y = location.getY(); + double z = location.getZ(); + float yaw = location.getYaw(); + float pitch = location.getPitch(); + Vec3 velocity = Vec3.ZERO; + float headYaw = 0f; + + final ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(entityId, uuid, x, y, z, yaw, pitch, nmsEntityType, 0, velocity, headYaw); + + final Map dataValues = Map.of(0, mask, 15, (byte) 0x10); + final ClientboundSetEntityDataPacket dataPacket = getSharedEntityPacket(entityId, dataValues); + + ClientboundBundlePacket bundlePacket = new ClientboundBundlePacket(List.of(spawnPacket, dataPacket)); + for (Player p : sendTo) sendPacket(p, bundlePacket); + } }