diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/HMCCosmeticsPlugin.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/HMCCosmeticsPlugin.java index 83169727..1fe4c178 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/HMCCosmeticsPlugin.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/HMCCosmeticsPlugin.java @@ -102,13 +102,14 @@ public final class HMCCosmeticsPlugin extends JavaPlugin { // Translation setup Translation.setup(); + // ItemHooks + ItemHooks.setup(); + // Cosmetics setup Cosmetics.setup(); // Menus setup Menus.setup(); - // ItemHooks - ItemHooks.setup(); } } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/command/CosmeticCommand.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/command/CosmeticCommand.java index dae4e98d..7ff732f9 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/command/CosmeticCommand.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/command/CosmeticCommand.java @@ -34,6 +34,7 @@ public class CosmeticCommand implements CommandExecutor { return true; } if (args[0].equalsIgnoreCase("apply")) { + sender.sendMessage("Applying - Begin"); Player player = null; Cosmetic cosmetic; @@ -51,6 +52,7 @@ public class CosmeticCommand implements CommandExecutor { user.addPlayerCosmetic(cosmetic); user.updateCosmetic(cosmetic.getSlot()); + sender.sendMessage("Applying - Finish with " + cosmetic.getId()); return true; } if (args[0].equalsIgnoreCase("unapply")) { diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticArmorType.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticArmorType.java index 58cf6a33..b9de514e 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticArmorType.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticArmorType.java @@ -36,7 +36,7 @@ public class CosmeticArmorType extends Cosmetic { } public ItemStack getCosmeticItem() { - return this.itemStack; + return this.itemStack.clone(); } public EquipmentSlot getEquipSlot() { diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticBackpackType.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticBackpackType.java index 5036a198..1ecb80b4 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticBackpackType.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticBackpackType.java @@ -15,10 +15,13 @@ import org.spongepowered.configurate.serialize.SerializationException; public class CosmeticBackpackType extends Cosmetic { private ItemStack backpackItem; + ConfigurationNode config; public CosmeticBackpackType(String id, ConfigurationNode config) { super(id, config); + this.config = config; + this.backpackItem = generateItemStack(config.node("item")); } @@ -52,7 +55,11 @@ public class CosmeticBackpackType extends Cosmetic { } public ItemStack getBackpackItem() { - return backpackItem; + if (this.backpackItem == null ) { + HMCCosmeticsPlugin.getInstance().getLogger().info("Backpack item was null for " + getId()); + this.backpackItem = generateItemStack(config.node("item")); + } + return this.backpackItem.clone(); } private ItemStack generateItemStack(ConfigurationNode config) { diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticBalloonType.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticBalloonType.java index d2e593a2..db1b6e51 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticBalloonType.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/cosmetic/types/CosmeticBalloonType.java @@ -32,10 +32,10 @@ public class CosmeticBalloonType extends Cosmetic { final Location actual = player.getLocation().clone().add(Settings.getBalloonOffset()); if (player.getLocation().getWorld() != user.getBalloonEntity().getLocation().getWorld()) { - user.getBalloonEntity().getModelEntity().getBukkitLivingEntity().teleport(actual); + user.getBalloonEntity().getModelEntity().teleport(actual); } - user.getBalloonEntity().getModelEntity().moveTo(actual.getX(), actual.getY(), actual.getZ()); + user.getBalloonEntity().getModelEntity().teleport(actual); List viewer = PlayerUtils.getNearbyPlayers(player); viewer.add(player); diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/entities/BalloonEntity.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/entities/BalloonEntity.java index b8a9e1b9..425f0193 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/entities/BalloonEntity.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/entities/BalloonEntity.java @@ -2,11 +2,13 @@ package com.hibiscusmc.hmccosmetics.entities; import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin; import com.hibiscusmc.hmccosmetics.config.Settings; +import com.hibiscusmc.hmccosmetics.nms.NMSHandler; import com.hibiscusmc.hmccosmetics.nms.NMSHandlers; import com.ticxo.modelengine.api.ModelEngineAPI; import com.ticxo.modelengine.api.model.ActiveModel; import com.ticxo.modelengine.api.model.ModeledEntity; import org.bukkit.Location; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -17,12 +19,12 @@ public class BalloonEntity { private final int balloonID; private final UUID uniqueID; - private final MEGEntity modelEntity; + private final Entity modelEntity; public BalloonEntity(Location location) { this.uniqueID = UUID.randomUUID(); this.balloonID = NMSHandlers.getHandler().getNextEntityId(); - this.modelEntity = new MEGEntity(location.add(Settings.getBalloonOffset())); + this.modelEntity = NMSHandlers.getHandler().getMEGEntity(location.add(Settings.getBalloonOffset())); } public void spawnModel(final String id) { @@ -31,13 +33,13 @@ public class BalloonEntity { HMCCosmeticsPlugin.getInstance().getLogger().warning("Invalid Model Engine Blueprint " + id); return; } - ModeledEntity modeledEntity = ModelEngineAPI.getOrCreateModeledEntity(modelEntity.getBukkitEntity()); + ModeledEntity modeledEntity = ModelEngineAPI.getOrCreateModeledEntity(modelEntity); ActiveModel model = ModelEngineAPI.createActiveModel(ModelEngineAPI.getBlueprint(id)); modeledEntity.addModel(model, false); } public void remove() { - final ModeledEntity entity = ModelEngineAPI.api.getModeledEntity(modelEntity.getUUID()); + final ModeledEntity entity = ModelEngineAPI.api.getModeledEntity(modelEntity.getUniqueId()); if (entity == null) return; @@ -50,7 +52,7 @@ public class BalloonEntity { } public void addPlayerToModel(final Player player, final String id) { - final ModeledEntity model = ModelEngineAPI.api.getModeledEntity(modelEntity.getUUID()); + final ModeledEntity model = ModelEngineAPI.api.getModeledEntity(modelEntity.getUniqueId()); if (model == null) { spawnModel(id); return; @@ -59,14 +61,14 @@ public class BalloonEntity { model.showToPlayer(player); } public void removePlayerFromModel(final Player player) { - final ModeledEntity model = ModelEngineAPI.api.getModeledEntity(modelEntity.getUUID()); + final ModeledEntity model = ModelEngineAPI.api.getModeledEntity(modelEntity.getUniqueId()); if (model == null) return; model.hideFromPlayer(player); } - public MEGEntity getModelEntity() { + public Entity getModelEntity() { return this.modelEntity; } @@ -79,27 +81,23 @@ public class BalloonEntity { } public UUID getModelUnqiueId() { - return modelEntity.getUUID(); + return modelEntity.getUniqueId(); } public int getModelId() { - return modelEntity.getId(); + return modelEntity.getEntityId(); } public Location getLocation() { - return this.modelEntity.getBukkitEntity().getLocation(); - } - - public boolean isAlive() { - return this.modelEntity.isAlive(); + return this.modelEntity.getLocation(); } public void setLocation(Location location) { //this.megEntity.teleportTo(location.getX(), location.getY(), location.getZ()); - this.modelEntity.getBukkitEntity().teleport(location); + this.modelEntity.teleport(location); } public void setVelocity(Vector vector) { - this.modelEntity.getBukkitEntity().setVelocity(vector); + this.modelEntity.setVelocity(vector); } } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/entities/MEGEntity.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/entities/MEGEntity.java deleted file mode 100644 index ed306f01..00000000 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/entities/MEGEntity.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.hibiscusmc.hmccosmetics.entities; - -import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.ambient.Bat; -import org.bukkit.Location; -import org.bukkit.NamespacedKey; -import org.bukkit.craftbukkit.v1_19_R1.CraftWorld; -import org.bukkit.persistence.PersistentDataType; - -public class MEGEntity extends Bat { - - public MEGEntity(Location loc) { - super(EntityType.BAT, ((CraftWorld) loc.getWorld()).getHandle()); - this.setPos(loc.getX(), loc.getY(), loc.getZ()); - HMCCosmeticsPlugin.getInstance().getLogger().info("Spawned MEGEntity at " + loc); - getBukkitLivingEntity().setInvisible(true); - getBukkitLivingEntity().setInvulnerable(true); // NOTE - CREATIVE PLAYERS CAN DESTROY IT STILL - getBukkitLivingEntity().setAI(false); - getBukkitLivingEntity().setGravity(false); - getBukkitLivingEntity().setSilent(true); - getBukkitLivingEntity().setCollidable(false); - persist = false; - - getBukkitEntity().getPersistentDataContainer().set(new NamespacedKey(HMCCosmeticsPlugin.getInstance(), "cosmeticMob"), PersistentDataType.SHORT, Short.valueOf("1")); - } -} diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/nms/NMSHandler.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/nms/NMSHandler.java index a7e0c9f7..c1dd83c9 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/nms/NMSHandler.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/nms/NMSHandler.java @@ -4,8 +4,10 @@ import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBackpackType; import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBalloonType; import com.hibiscusmc.hmccosmetics.entities.BalloonEntity; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; +import net.minecraft.network.protocol.Packet; import org.bukkit.Location; import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; public interface NMSHandler { @@ -15,10 +17,14 @@ public interface NMSHandler { Entity getInvisibleArmorstand(Location loc); + Entity getMEGEntity(Location loc); + Entity spawnBackpack(CosmeticUser user, CosmeticBackpackType cosmeticBackpackType); BalloonEntity spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType); + void sendPacket(Player player, Packet packet); + default boolean getSupported () { return false; } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java index b70d5eed..2d5c3e6b 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java @@ -72,9 +72,11 @@ public class CosmeticUser { public void addPlayerCosmetic(Cosmetic cosmetic, Color color) { playerCosmetics.put(cosmetic.getSlot(), cosmetic); if (color != null) colors.put(cosmetic.getSlot(), color); + HMCCosmeticsPlugin.getInstance().getLogger().info("addPlayerCosmetic " + cosmetic.getId()); if (cosmetic.getSlot() == CosmeticSlot.BACKPACK) { CosmeticBackpackType backpackType = (CosmeticBackpackType) cosmetic; spawnBackpack(backpackType); + HMCCosmeticsPlugin.getInstance().getLogger().info("addPlayerCosmetic spawnBackpack " + cosmetic.getId()); } if (cosmetic.getSlot() == CosmeticSlot.BALLOON) { CosmeticBalloonType balloonType = (CosmeticBalloonType) cosmetic; @@ -129,19 +131,26 @@ public class CosmeticUser { if (cosmetic instanceof CosmeticArmorType) { CosmeticArmorType cosmetic1 = (CosmeticArmorType) cosmetic; item = cosmetic1.getCosmeticItem(); + HMCCosmeticsPlugin.getInstance().getLogger().info("GetUserCosemticUser Armor"); } if (cosmetic instanceof CosmeticBackpackType) { CosmeticBackpackType cosmetic1 = (CosmeticBackpackType) cosmetic; item = cosmetic1.getBackpackItem(); + HMCCosmeticsPlugin.getInstance().getLogger().info("GetUserCosemticUser Backpack"); } - if (!item.hasItemMeta()) return null; - ItemMeta itemMeta = item.getItemMeta(); - if (itemMeta instanceof LeatherArmorMeta) { - if (colors.containsKey(cosmetic.getSlot())) { - ((LeatherArmorMeta) itemMeta).setColor(colors.get(cosmetic.getSlot())); + if (item == null) { + HMCCosmeticsPlugin.getInstance().getLogger().info("GetUserCosemticUser Item is null"); + return null; + } + if (item.hasItemMeta()) { + ItemMeta itemMeta = item.getItemMeta(); + if (itemMeta instanceof LeatherArmorMeta) { + if (colors.containsKey(cosmetic.getSlot())) { + ((LeatherArmorMeta) itemMeta).setColor(colors.get(cosmetic.getSlot())); + } } + item.setItemMeta(itemMeta); } - item.setItemMeta(itemMeta); return item; } @@ -177,6 +186,7 @@ public class CosmeticUser { } public void spawnBackpack(CosmeticBackpackType cosmeticBackpackType) { + HMCCosmeticsPlugin.getInstance().getLogger().info("spawnBackpack Bukkit - Start"); Player player = Bukkit.getPlayer(getUniqueId()); List sentTo = PlayerUtils.getNearbyPlayers(player.getLocation()); @@ -186,6 +196,8 @@ public class CosmeticUser { player.addPassenger(invisibleArmorstand); + HMCCosmeticsPlugin.getInstance().getLogger().info("spawnBackpack Bukkit - Finish"); + } public void spawnBalloon(CosmeticBalloonType cosmeticBalloonType) { diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/Wardrobe.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/Wardrobe.java index bcc871fa..c8f1c922 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/Wardrobe.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/Wardrobe.java @@ -174,7 +174,7 @@ public class Wardrobe { if (VIEWER.hasCosmeticInSlot(CosmeticSlot.BALLOON)) { PacketManager.sendTeleportPacket(VIEWER.getBalloonEntity().getPufferfishBalloonId(), WardrobeSettings.getWardrobeLocation(), false, viewer); - VIEWER.getBalloonEntity().getModelEntity().getBukkitLivingEntity().teleport(WardrobeSettings.getWardrobeLocation().add(Settings.getBalloonOffset())); + VIEWER.getBalloonEntity().getModelEntity().teleport(WardrobeSettings.getWardrobeLocation().add(Settings.getBalloonOffset())); //PacketManager.sendLeashPacket(VIEWER.getBalloonEntity().getPufferfishBalloonId(), NPC_ID, viewer); } } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/util/packets/BasePacket.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/util/packets/BasePacket.java index 5324c184..077c20e1 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/util/packets/BasePacket.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/util/packets/BasePacket.java @@ -2,18 +2,14 @@ package com.hibiscusmc.hmccosmetics.util.packets; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.events.PacketContainer; +import com.hibiscusmc.hmccosmetics.nms.NMSHandlers; import net.minecraft.network.protocol.Packet; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.server.network.ServerPlayerConnection; -import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer; import org.bukkit.entity.Player; public class BasePacket { public static void sendPacket(Player player, Packet packet) { - ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle(); - ServerPlayerConnection connection = serverPlayer.connection; - connection.send(packet); + NMSHandlers.getHandler().sendPacket(player, packet); } public static void sendPacket(Player player, PacketContainer packet) { diff --git a/v1_19_R1/src/main/java/com/hibiscusmc/hmccosmetics/nms/v1_19_R1/MEGEntity.java b/v1_19_R1/src/main/java/com/hibiscusmc/hmccosmetics/nms/v1_19_R1/MEGEntity.java new file mode 100644 index 00000000..51df31a7 --- /dev/null +++ b/v1_19_R1/src/main/java/com/hibiscusmc/hmccosmetics/nms/v1_19_R1/MEGEntity.java @@ -0,0 +1,30 @@ +package com.hibiscusmc.hmccosmetics.nms.v1_19_R1; + +import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ambient.Bat; +import org.bukkit.Location; +import org.bukkit.NamespacedKey; +import org.bukkit.craftbukkit.v1_19_R1.CraftWorld; +import org.bukkit.persistence.PersistentDataType; + +public class MEGEntity extends Bat { + + public MEGEntity(Location loc) { + super(EntityType.BAT, ((CraftWorld) loc.getWorld()).getHandle()); + this.setPos(loc.getX(), loc.getY(), loc.getZ()); + HMCCosmeticsPlugin.getInstance().getLogger().info("Spawned MEGEntity at " + loc); + getBukkitLivingEntity().setInvisible(true); + getBukkitLivingEntity().setInvulnerable(true); // NOTE - CREATIVE PLAYERS CAN DESTROY IT STILL + getBukkitLivingEntity().setAI(false); + getBukkitLivingEntity().setGravity(false); + getBukkitLivingEntity().setSilent(true); + getBukkitLivingEntity().setCollidable(false); + persist = false; + + getBukkitEntity().getPersistentDataContainer().set(new NamespacedKey(HMCCosmeticsPlugin.getInstance(), "cosmeticMob"), PersistentDataType.SHORT, Short.valueOf("1")); + + ((CraftWorld) loc.getWorld()).getHandle().addFreshEntity(this); + } + +} diff --git a/v1_19_R1/src/main/java/com/hibiscusmc/hmccosmetics/nms/v1_19_R1/NMSHandler.java b/v1_19_R1/src/main/java/com/hibiscusmc/hmccosmetics/nms/v1_19_R1/NMSHandler.java index 2711efad..abeb6cda 100644 --- a/v1_19_R1/src/main/java/com/hibiscusmc/hmccosmetics/nms/v1_19_R1/NMSHandler.java +++ b/v1_19_R1/src/main/java/com/hibiscusmc/hmccosmetics/nms/v1_19_R1/NMSHandler.java @@ -1,5 +1,6 @@ package com.hibiscusmc.hmccosmetics.nms.v1_19_R1; +import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin; import com.hibiscusmc.hmccosmetics.config.Settings; import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBackpackType; import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBalloonType; @@ -8,13 +9,17 @@ import com.hibiscusmc.hmccosmetics.nms.NMSHandlers; import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import com.hibiscusmc.hmccosmetics.util.PlayerUtils; import com.hibiscusmc.hmccosmetics.util.packets.PacketManager; +import net.minecraft.network.protocol.Packet; import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.network.ServerPlayerConnection; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_19_R1.CraftServer; import org.bukkit.craftbukkit.v1_19_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -51,6 +56,11 @@ public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler { return invisibleArmorstand.getBukkitEntity(); } + @Override + public org.bukkit.entity.Entity getMEGEntity(Location loc) { + return new MEGEntity(loc).getBukkitEntity(); + } + @Override public org.bukkit.entity.Entity spawnBackpack(CosmeticUser user, CosmeticBackpackType cosmeticBackpackType) { InvisibleArmorstand invisibleArmorstand = new InvisibleArmorstand(user.getPlayer().getLocation()); @@ -60,12 +70,16 @@ public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler { invisibleArmorstand.setItemSlot(EquipmentSlot.HEAD, CraftItemStack.asNMSCopy(item)); ((CraftWorld) user.getPlayer().getWorld()).getHandle().addFreshEntity(invisibleArmorstand, CreatureSpawnEvent.SpawnReason.CUSTOM); + HMCCosmeticsPlugin.getInstance().getLogger().info("spawnBackpack NMS"); + return invisibleArmorstand.getBukkitLivingEntity(); //PacketManager.armorStandMetaPacket(invisibleArmorstand.getBukkitEntity(), sentTo); //PacketManager.ridingMountPacket(player.getEntityId(), invisibleArmorstand.getId(), sentTo); } + + @Override public BalloonEntity spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType) { Player player = user.getPlayer(); @@ -73,7 +87,7 @@ public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler { BalloonEntity balloonEntity1 = new BalloonEntity(user.getPlayer().getLocation()); List sentTo = PlayerUtils.getNearbyPlayers(player.getLocation()); - ((CraftWorld) user.getPlayer().getWorld()).getHandle().addFreshEntity(balloonEntity1.getModelEntity(), CreatureSpawnEvent.SpawnReason.CUSTOM); + balloonEntity1.getModelEntity().teleport(user.getPlayer().getLocation().add(Settings.getBalloonOffset())); balloonEntity1.spawnModel(cosmeticBalloonType.getModelName()); balloonEntity1.addPlayerToModel(player, cosmeticBalloonType.getModelName()); @@ -85,6 +99,13 @@ public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler { return balloonEntity1; } + @Override + public void sendPacket(Player player, Packet packet) { + ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle(); + ServerPlayerConnection connection = serverPlayer.connection; + connection.send(packet); + } + @Override public boolean getSupported() { return true;