mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-19 15:09:19 +00:00
fix: latest changes
This commit is contained in:
@@ -86,7 +86,7 @@ allprojects {
|
||||
compileOnly("io.github.toxicity188:BetterCommand:1.3") //BetterCommand library
|
||||
//compileOnly("it.unimi.dsi:fastutil:8.5.14")
|
||||
compileOnly("org.projectlombok:lombok:1.18.34")
|
||||
compileOnly("me.lojosho:HibiscusCommons:0.6.2-d21ebed8")
|
||||
compileOnly("me.lojosho:HibiscusCommons:0.6.3")
|
||||
|
||||
// Handled by Spigot Library Loader
|
||||
compileOnly("net.kyori:adventure-api:4.19.0")
|
||||
|
||||
@@ -55,7 +55,7 @@ public class CosmeticBackpackType extends Cosmetic {
|
||||
}
|
||||
|
||||
UserBackpackManager backpackManager = user.getUserBackpackManager();
|
||||
Location loc = entity.getLocation().clone().add(0, 2, 0);
|
||||
Location loc = entity.getLocation();
|
||||
loc.setPitch(0);
|
||||
|
||||
List<Player> addedViewers = user.getUserBackpackManager().getEntityManager().refreshViewers(loc);
|
||||
@@ -65,7 +65,7 @@ public class CosmeticBackpackType extends Cosmetic {
|
||||
user.getUserBackpackManager().getEntityManager().teleport(loc);
|
||||
|
||||
HMCCPacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), entityId, EntityType.ITEM_DISPLAY, UUID.randomUUID(), addedViewers);
|
||||
HMCCPacketManager.sendItemDisplayMetadata(entityId, backpackItem, false, addedViewers);
|
||||
HMCCPacketManager.sendDisplayEntityMetadataPacket(backpackManager.getDisplayEntityId(), backpackItem, addedViewers);
|
||||
// If true, it will send the riding packet to all players. If false, it will send the riding packet only to new players
|
||||
if (Settings.isBackpackForceRidingEnabled()) HMCCPacketManager.sendRidingPacket(entity.getEntityId(), user.getUserBackpackManager().getDisplayEntityId(), user.getUserBackpackManager().getEntityManager().getViewers());
|
||||
else HMCCPacketManager.sendRidingPacket(entity.getEntityId(), user.getUserBackpackManager().getDisplayEntityId(), addedViewers);
|
||||
|
||||
@@ -69,7 +69,7 @@ public class UserBackpackManager {
|
||||
ItemStack backpackItem = user.getUserCosmeticItem(CosmeticSlot.BACKPACK);
|
||||
|
||||
HMCCPacketManager.sendEntitySpawnPacket(loc, getDisplayEntityId(), EntityType.ITEM_DISPLAY, UUID.randomUUID(), outsideViewers);
|
||||
HMCCPacketManager.sendItemDisplayMetadata(getDisplayEntityId(), backpackItem, false, outsideViewers);
|
||||
HMCCPacketManager.sendDisplayEntityMetadataPacket(getDisplayEntityId(), backpackItem, outsideViewers);
|
||||
|
||||
Entity entity = user.getEntity();
|
||||
int[] passengerIDs = new int[entity.getPassengers().size() + 1];
|
||||
|
||||
@@ -19,10 +19,7 @@ import me.lojosho.hibiscuscommons.nms.NMSHandlers;
|
||||
import me.lojosho.hibiscuscommons.util.packets.PacketManager;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.ItemDisplay;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -378,6 +375,38 @@ public class HMCCPacketManager extends PacketManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendDisplayEntityMetadataPacket(int entityid, ItemStack backpackItem, List<Player> sendTo) {
|
||||
// TODO: Make the default values adjustable
|
||||
Vector3f translation = new Vector3f(0, 3, 0);
|
||||
Vector3f scale = new Vector3f(1, 1, 1);
|
||||
Quaternionf rotationLeft = new Quaternionf();
|
||||
Quaternionf rotationRight = new Quaternionf();
|
||||
Display.Billboard billboard = Display.Billboard.FIXED;
|
||||
int blockLight = 15;
|
||||
int skylight = 15;
|
||||
int viewRange = Settings.getViewDistance();
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
ItemDisplay.ItemDisplayTransform transform = ItemDisplay.ItemDisplayTransform.HEAD;
|
||||
|
||||
NMSHandlers.getHandler().getPacketHandler().sendItemDisplayMetadata(
|
||||
entityid,
|
||||
translation,
|
||||
scale,
|
||||
rotationLeft,
|
||||
rotationRight,
|
||||
billboard,
|
||||
blockLight,
|
||||
skylight,
|
||||
viewRange,
|
||||
width,
|
||||
height,
|
||||
transform,
|
||||
backpackItem,
|
||||
sendTo
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the nearby players (or viewers) of a location through the view distance set in the config. If the view distance is 0, it will return all players in the world.
|
||||
* @param location
|
||||
|
||||
Reference in New Issue
Block a user