mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-29 11:59:21 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c051b267cf | ||
|
|
d1fc84b5bc | ||
|
|
b47b9d8235 | ||
|
|
edccc844c9 | ||
|
|
5788b2cce0 |
@@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.hibiscusmc"
|
group = "com.hibiscusmc"
|
||||||
version = "2.6.0"
|
version = "2.6.1"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ public class WardrobeSettings {
|
|||||||
private static final String DISPLAY_RADIUS_PATH = "display-radius";
|
private static final String DISPLAY_RADIUS_PATH = "display-radius";
|
||||||
private static final String PORTABLE_PATH = "portable";
|
private static final String PORTABLE_PATH = "portable";
|
||||||
private static final String ALWAYS_DISPLAY_PATH = "always-display";
|
private static final String ALWAYS_DISPLAY_PATH = "always-display";
|
||||||
private static final String STATIC_RADIUS_PATH = "static-radius";
|
|
||||||
private static final String ROTATION_SPEED_PATH = "rotation-speed";
|
private static final String ROTATION_SPEED_PATH = "rotation-speed";
|
||||||
private static final String SPAWN_DELAY_PATH = "spawn-delay";
|
private static final String SPAWN_DELAY_PATH = "spawn-delay";
|
||||||
private static final String DESPAWN_DELAY_PATH = "despawn-delay";
|
private static final String DESPAWN_DELAY_PATH = "despawn-delay";
|
||||||
@@ -69,8 +68,6 @@ public class WardrobeSettings {
|
|||||||
@Getter
|
@Getter
|
||||||
private static boolean alwaysDisplay;
|
private static boolean alwaysDisplay;
|
||||||
@Getter
|
@Getter
|
||||||
private static int staticRadius;
|
|
||||||
@Getter
|
|
||||||
private static int rotationSpeed;
|
private static int rotationSpeed;
|
||||||
@Getter
|
@Getter
|
||||||
private static int spawnDelay;
|
private static int spawnDelay;
|
||||||
@@ -120,7 +117,6 @@ public class WardrobeSettings {
|
|||||||
disableOnDamage = source.node(DISABLE_ON_DAMAGE_PATH).getBoolean();
|
disableOnDamage = source.node(DISABLE_ON_DAMAGE_PATH).getBoolean();
|
||||||
displayRadius = source.node(DISPLAY_RADIUS_PATH).getInt();
|
displayRadius = source.node(DISPLAY_RADIUS_PATH).getInt();
|
||||||
portable = source.node(PORTABLE_PATH).getBoolean();
|
portable = source.node(PORTABLE_PATH).getBoolean();
|
||||||
staticRadius = source.node(STATIC_RADIUS_PATH).getInt();
|
|
||||||
alwaysDisplay = source.node(ALWAYS_DISPLAY_PATH).getBoolean();
|
alwaysDisplay = source.node(ALWAYS_DISPLAY_PATH).getBoolean();
|
||||||
rotationSpeed = source.node(ROTATION_SPEED_PATH).getInt();
|
rotationSpeed = source.node(ROTATION_SPEED_PATH).getInt();
|
||||||
spawnDelay = source.node(SPAWN_DELAY_PATH).getInt();
|
spawnDelay = source.node(SPAWN_DELAY_PATH).getInt();
|
||||||
@@ -206,22 +202,6 @@ public class WardrobeSettings {
|
|||||||
wardrobes.remove(id);
|
wardrobes.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static boolean inDistanceOfWardrobe(final Location wardrobeLocation, final Location playerLocation) {
|
|
||||||
if (displayRadius == -1) return true;
|
|
||||||
if (!wardrobeLocation.getWorld().equals(playerLocation.getWorld())) return false;
|
|
||||||
return playerLocation.distanceSquared(wardrobeLocation) <= displayRadius * displayRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static boolean inDistanceOfStatic(Wardrobe wardrobe, final Location location) {
|
|
||||||
Location wardrobeLocation = wardrobe.getLocation().getNpcLocation();
|
|
||||||
if (wardrobeLocation == null) return false;
|
|
||||||
if (staticRadius == -1) return true;
|
|
||||||
if (!wardrobeLocation.getWorld().equals(location.getWorld())) return false;
|
|
||||||
return wardrobeLocation.distanceSquared(location) <= staticRadius * staticRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets where the NPC/Mannequin will spawn in the wardrobe
|
* Sets where the NPC/Mannequin will spawn in the wardrobe
|
||||||
* @param newLocation
|
* @param newLocation
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class CosmeticBackpackType extends Cosmetic {
|
|||||||
user.getUserBackpackManager().getEntityManager().setRotation((int) loc.getYaw());
|
user.getUserBackpackManager().getEntityManager().setRotation((int) loc.getYaw());
|
||||||
|
|
||||||
PacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), user.getUserBackpackManager().getFirstArmorStandId(), EntityType.ARMOR_STAND, UUID.randomUUID(), outsideViewers);
|
PacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), user.getUserBackpackManager().getFirstArmorStandId(), EntityType.ARMOR_STAND, UUID.randomUUID(), outsideViewers);
|
||||||
PacketManager.sendInvisibilityPacket(user.getUserBackpackManager().getFirstArmorStandId(), outsideViewers);
|
PacketManager.sendArmorstandMetadata(user.getUserBackpackManager().getFirstArmorStandId(), outsideViewers);
|
||||||
NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(this, getItem()), outsideViewers);
|
NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(this, getItem()), outsideViewers);
|
||||||
// If true, it will send the riding packet to all players. If false, it will send the riding packet only to new players
|
// 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()) PacketManager.sendRidingPacket(entity.getEntityId(), user.getUserBackpackManager().getFirstArmorStandId(), user.getUserBackpackManager().getEntityManager().getViewers());
|
if (Settings.isBackpackForceRidingEnabled()) PacketManager.sendRidingPacket(entity.getEntityId(), user.getUserBackpackManager().getFirstArmorStandId(), user.getUserBackpackManager().getEntityManager().getViewers());
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class UserBackpackManager {
|
|||||||
getEntityManager().teleport(user.getEntity().getLocation());
|
getEntityManager().teleport(user.getEntity().getLocation());
|
||||||
List<Player> outsideViewers = getEntityManager().getViewers();
|
List<Player> outsideViewers = getEntityManager().getViewers();
|
||||||
PacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), getFirstArmorStandId(), EntityType.ARMOR_STAND, UUID.randomUUID(), getEntityManager().getViewers());
|
PacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), getFirstArmorStandId(), EntityType.ARMOR_STAND, UUID.randomUUID(), getEntityManager().getViewers());
|
||||||
PacketManager.sendInvisibilityPacket(getFirstArmorStandId(), outsideViewers);
|
PacketManager.sendArmorstandMetadata(getFirstArmorStandId(), outsideViewers);
|
||||||
|
|
||||||
Entity entity = user.getEntity();
|
Entity entity = user.getEntity();
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public class UserWardrobeManager {
|
|||||||
Runnable run = () -> {
|
Runnable run = () -> {
|
||||||
// Armorstand
|
// Armorstand
|
||||||
PacketManager.sendEntitySpawnPacket(viewingLocation, ARMORSTAND_ID, EntityType.ARMOR_STAND, UUID.randomUUID(), viewer);
|
PacketManager.sendEntitySpawnPacket(viewingLocation, ARMORSTAND_ID, EntityType.ARMOR_STAND, UUID.randomUUID(), viewer);
|
||||||
PacketManager.sendInvisibilityPacket(ARMORSTAND_ID, viewer);
|
PacketManager.sendArmorstandMetadata(ARMORSTAND_ID, viewer);
|
||||||
PacketManager.sendLookPacket(ARMORSTAND_ID, viewingLocation, viewer);
|
PacketManager.sendLookPacket(ARMORSTAND_ID, viewingLocation, viewer);
|
||||||
|
|
||||||
// Player
|
// Player
|
||||||
|
|||||||
@@ -122,19 +122,25 @@ public class PacketManager extends BasePacket {
|
|||||||
NMSHandlers.getHandler().equipmentSlotUpdate(entityId, InventoryUtils.getEquipmentSlot(cosmeticSlot), user.getUserCosmeticItem(cosmeticSlot), sendTo);
|
NMSHandlers.getHandler().equipmentSlotUpdate(entityId, InventoryUtils.getEquipmentSlot(cosmeticSlot), user.getUserCosmeticItem(cosmeticSlot), sendTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void armorStandMetaPacket(
|
public static void sendArmorstandMetadata(
|
||||||
@NotNull Entity entity,
|
int entityId,
|
||||||
List<Player> sendTo
|
List<Player> sendTo
|
||||||
) {
|
) {
|
||||||
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
|
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
|
||||||
packet.getModifier().writeDefaults();
|
packet.getModifier().writeDefaults();
|
||||||
packet.getIntegers().write(0, entity.getEntityId());
|
packet.getIntegers().write(0, entityId);
|
||||||
WrappedDataWatcher metadata = new WrappedDataWatcher();
|
WrappedDataWatcher wrapper = new WrappedDataWatcher();
|
||||||
if (metadata == null) return;
|
|
||||||
// 0x10 & 0x20
|
if (NMSHandlers.getVersion().contains("v1_18_R2") || NMSHandlers.getVersion().contains("v1_19_R1")) {
|
||||||
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class)), (byte) 0x20);
|
wrapper.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class)), (byte) 0x20);
|
||||||
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(15, WrappedDataWatcher.Registry.get(Byte.class)), (byte) 0x10);
|
wrapper.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(15, WrappedDataWatcher.Registry.get(Byte.class)), (byte) 0x10);
|
||||||
packet.getWatchableCollectionModifier().write(0, metadata.getWatchableObjects());
|
packet.getWatchableCollectionModifier().write(0, wrapper.getWatchableObjects());
|
||||||
|
} else {
|
||||||
|
final List<WrappedDataValue> wrappedDataValueList = Lists.newArrayList();
|
||||||
|
wrappedDataValueList.add(new WrappedDataValue(0, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0x20));
|
||||||
|
wrapper.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(15, WrappedDataWatcher.Registry.get(Byte.class)), (byte) 0x10);
|
||||||
|
packet.getDataValueCollectionModifier().write(0, wrappedDataValueList);
|
||||||
|
}
|
||||||
for (Player p : sendTo) sendPacket(p, packet);
|
for (Player p : sendTo) sendPacket(p, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,8 +89,6 @@ hook-settings:
|
|||||||
# Requires restart to apply changes.
|
# Requires restart to apply changes.
|
||||||
player-move-check: true
|
player-move-check: true
|
||||||
wardrobe:
|
wardrobe:
|
||||||
# spawn static wardrobe if in this radius of wardrobe-location
|
|
||||||
static-radius: 10
|
|
||||||
# how much yaw should change per tick, set to 0 for none
|
# how much yaw should change per tick, set to 0 for none
|
||||||
rotation-speed: 3
|
rotation-speed: 3
|
||||||
# Applies a pumpkin for an overlay of the player while in the wardrobe.
|
# Applies a pumpkin for an overlay of the player while in the wardrobe.
|
||||||
|
|||||||
Reference in New Issue
Block a user