mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-19 15:09:19 +00:00
fix: fix client crashes for wardrobe on 1.21.10
This commit is contained in:
@@ -92,7 +92,7 @@ allprojects {
|
|||||||
compileOnly("io.github.toxicity188:BetterCommand:1.3") //BetterCommand library
|
compileOnly("io.github.toxicity188:BetterCommand:1.3") //BetterCommand library
|
||||||
//compileOnly("it.unimi.dsi:fastutil:8.5.14")
|
//compileOnly("it.unimi.dsi:fastutil:8.5.14")
|
||||||
compileOnly("org.projectlombok:lombok:1.18.34")
|
compileOnly("org.projectlombok:lombok:1.18.34")
|
||||||
compileOnly("me.lojosho:HibiscusCommons:0.8.0-3fb20b0f")
|
compileOnly("me.lojosho:HibiscusCommons:0.8.1-d9fbae1d")
|
||||||
|
|
||||||
// Handled by Spigot Library Loader
|
// Handled by Spigot Library Loader
|
||||||
compileOnly("net.kyori:adventure-api:4.24.0")
|
compileOnly("net.kyori:adventure-api:4.24.0")
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
|||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||||
import com.hibiscusmc.hmccosmetics.util.HMCCInventoryUtils;
|
import com.hibiscusmc.hmccosmetics.util.HMCCInventoryUtils;
|
||||||
|
import me.lojosho.hibiscuscommons.nms.MinecraftVersion;
|
||||||
import me.lojosho.hibiscuscommons.nms.NMSHandlers;
|
import me.lojosho.hibiscuscommons.nms.NMSHandlers;
|
||||||
import me.lojosho.hibiscuscommons.util.packets.PacketManager;
|
import me.lojosho.hibiscuscommons.util.packets.PacketManager;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -19,7 +20,10 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.joml.Quaternionf;
|
import org.joml.Quaternionf;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class HMCCPacketManager extends PacketManager {
|
public class HMCCPacketManager extends PacketManager {
|
||||||
|
|
||||||
@@ -202,22 +206,6 @@ public class HMCCPacketManager extends PacketManager {
|
|||||||
sendRidingPacket(mountId, new int[] {passengerId}, sendTo);
|
sendRidingPacket(mountId, new int[] {passengerId}, sendTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param location Location of the fake player.
|
|
||||||
* @param uuid UUID of the fake player. Should be random.
|
|
||||||
* @param entityId The entityID that the entity will take on.
|
|
||||||
* @param sendTo Who should it send the packet to?
|
|
||||||
*/
|
|
||||||
public static void sendFakePlayerSpawnPacket(
|
|
||||||
final @NotNull Location location,
|
|
||||||
final UUID uuid,
|
|
||||||
final int entityId,
|
|
||||||
final @NotNull List<Player> sendTo
|
|
||||||
) {
|
|
||||||
sendEntitySpawnPacket(location, entityId, EntityType.PLAYER, uuid, sendTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a fake player entity.
|
* Creates a fake player entity.
|
||||||
* @param skinnedPlayer The original player it bases itself off of.
|
* @param skinnedPlayer The original player it bases itself off of.
|
||||||
@@ -243,19 +231,10 @@ public class HMCCPacketManager extends PacketManager {
|
|||||||
final int playerId,
|
final int playerId,
|
||||||
final @NotNull List<Player> sendTo
|
final @NotNull List<Player> sendTo
|
||||||
) {
|
) {
|
||||||
/*
|
// https://minecraft.wiki/w/Java_Edition_protocol/Entity_metadata#Avatar
|
||||||
0x01 = Is on fire
|
|
||||||
0x02 = Is courching
|
|
||||||
0x04 = Unusued
|
|
||||||
0x08 = Sprinting
|
|
||||||
0x10 = Is swimming
|
|
||||||
0x20 = Invisibile
|
|
||||||
0x40 = Is Glowing
|
|
||||||
0x80 = Is flying with an elytra
|
|
||||||
https://wiki.vg/Entity_metadata#Entity
|
|
||||||
*/
|
|
||||||
final byte mask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020 | 0x40;
|
final byte mask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020 | 0x40;
|
||||||
NMSHandlers.getHandler().getPacketHandler().sendSharedEntityData(playerId, Map.of(17, mask), sendTo);
|
if (NMSHandlers.getVersion().isLowerOrEqual(MinecraftVersion.v1_21_8)) NMSHandlers.getHandler().getPacketHandler().sendSharedEntityData(playerId, Map.of(17, mask), sendTo);
|
||||||
|
else NMSHandlers.getHandler().getPacketHandler().sendSharedEntityData(playerId, Map.of(16, mask), sendTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user