9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-19 15:09:19 +00:00

Ballons item now dye correctly

This commit is contained in:
LoJoSho
2023-01-26 16:24:21 -06:00
parent cad78636d0
commit 9854e77bf5
6 changed files with 11 additions and 10 deletions

View File

@@ -3,6 +3,7 @@ package com.hibiscusmc.hmccosmetics.entities;
import com.hibiscusmc.hmccosmetics.config.Settings;
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBalloonType;
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
import com.ticxo.modelengine.api.ModelEngineAPI;
import com.ticxo.modelengine.api.model.ActiveModel;
@@ -84,11 +85,11 @@ public class BalloonEntity {
modelEntity.remove();
}
public void addPlayerToModel(final Player player, final CosmeticBalloonType cosmeticBalloonType) {
addPlayerToModel(player, cosmeticBalloonType, null);
public void addPlayerToModel(final CosmeticUser user, final CosmeticBalloonType cosmeticBalloonType) {
addPlayerToModel(user, cosmeticBalloonType, null);
}
public void addPlayerToModel(final Player player, final CosmeticBalloonType cosmeticBalloonType, Color color) {
public void addPlayerToModel(final CosmeticUser user, final CosmeticBalloonType cosmeticBalloonType, Color color) {
if (balloonType == BalloonType.MODELENGINE) {
final ModeledEntity model = ModelEngineAPI.api.getModeledEntity(modelEntity.getUniqueId());
if (model == null) {
@@ -97,12 +98,12 @@ public class BalloonEntity {
return;
}
//if (model.getRangeManager().getPlayerInRange().contains(player)) return;
model.showToPlayer(player);
model.showToPlayer(user.getPlayer());
MessagesUtil.sendDebugMessages("Show to player");
return;
}
if (balloonType == BalloonType.ITEM) {
modelEntity.getEquipment().setHelmet(cosmeticBalloonType.getItem());
modelEntity.getEquipment().setHelmet(user.getUserCosmeticItem(cosmeticBalloonType));
}
}
public void removePlayerFromModel(final Player player) {

View File

@@ -436,7 +436,7 @@ public class CosmeticUser {
hiddenReason = HiddenReason.NONE;
if (hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
CosmeticBalloonType balloonType = (CosmeticBalloonType) getCosmetic(CosmeticSlot.BALLOON);
getBalloonEntity().addPlayerToModel(getPlayer(), balloonType);
getBalloonEntity().addPlayerToModel(this, balloonType);
List<Player> viewer = PlayerUtils.getNearbyPlayers(getPlayer());
PacketManager.sendLeashPacket(getBalloonEntity().getPufferfishBalloonId(), getPlayer().getEntityId(), viewer);
}

View File

@@ -103,7 +103,7 @@ public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler {
balloonEntity1.getModelEntity().teleport(user.getPlayer().getLocation().add(Settings.getBalloonOffset()));
balloonEntity1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
balloonEntity1.addPlayerToModel(player, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
balloonEntity1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
PacketManager.sendEntitySpawnPacket(newLoc, balloonEntity1.getPufferfishBalloonId(), EntityType.PUFFERFISH, balloonEntity1.getPufferfishBalloonUniqueId(), sentTo);
PacketManager.sendInvisibilityPacket(balloonEntity1.getPufferfishBalloonId(), sentTo);

View File

@@ -105,7 +105,7 @@ public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler {
balloonEntity1.getModelEntity().teleport(user.getPlayer().getLocation().add(Settings.getBalloonOffset()));
balloonEntity1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
balloonEntity1.addPlayerToModel(player, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
balloonEntity1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
PacketManager.sendEntitySpawnPacket(newLoc, balloonEntity1.getPufferfishBalloonId(), EntityType.PUFFERFISH, balloonEntity1.getPufferfishBalloonUniqueId(), sentTo);
PacketManager.sendInvisibilityPacket(balloonEntity1.getPufferfishBalloonId(), sentTo);

View File

@@ -105,7 +105,7 @@ public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler {
balloonEntity1.getModelEntity().teleport(user.getPlayer().getLocation().add(Settings.getBalloonOffset()));
balloonEntity1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
balloonEntity1.addPlayerToModel(player, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
balloonEntity1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
PacketManager.sendEntitySpawnPacket(newLoc, balloonEntity1.getPufferfishBalloonId(), EntityType.PUFFERFISH, balloonEntity1.getPufferfishBalloonUniqueId(), sentTo);
PacketManager.sendInvisibilityPacket(balloonEntity1.getPufferfishBalloonId(), sentTo);

View File

@@ -105,7 +105,7 @@ public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler {
balloonEntity1.getModelEntity().teleport(user.getPlayer().getLocation().add(Settings.getBalloonOffset()));
balloonEntity1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
balloonEntity1.addPlayerToModel(player, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
balloonEntity1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
PacketManager.sendEntitySpawnPacket(newLoc, balloonEntity1.getPufferfishBalloonId(), EntityType.PUFFERFISH, balloonEntity1.getPufferfishBalloonUniqueId(), sentTo);
PacketManager.sendInvisibilityPacket(balloonEntity1.getPufferfishBalloonId(), sentTo);