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

Compare commits

...

5 Commits

Author SHA1 Message Date
LoJoSho
c051b267cf version bump (2.6.1) 2023-08-25 21:51:48 -05:00
LoJoSho
d1fc84b5bc fix: non-thirdperson backpacks interactable 2023-08-25 15:27:42 -05:00
LoJoSho
b47b9d8235 clean: remove deprecated methods relating to static radius distance 2023-08-24 18:48:31 -05:00
LoJoSho
edccc844c9 fix: remove static radius from default config, it's deprecated 2023-08-24 18:42:21 -05:00
LoJoSho
5788b2cce0 version bump (2.6.1-DEV) 2023-08-24 18:39:39 -05:00
7 changed files with 19 additions and 35 deletions

View File

@@ -8,7 +8,7 @@ plugins {
}
group = "com.hibiscusmc"
version = "2.6.0"
version = "2.6.1"
allprojects {
apply(plugin = "java")

View File

@@ -22,7 +22,6 @@ public class WardrobeSettings {
private static final String DISPLAY_RADIUS_PATH = "display-radius";
private static final String PORTABLE_PATH = "portable";
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 SPAWN_DELAY_PATH = "spawn-delay";
private static final String DESPAWN_DELAY_PATH = "despawn-delay";
@@ -69,8 +68,6 @@ public class WardrobeSettings {
@Getter
private static boolean alwaysDisplay;
@Getter
private static int staticRadius;
@Getter
private static int rotationSpeed;
@Getter
private static int spawnDelay;
@@ -120,7 +117,6 @@ public class WardrobeSettings {
disableOnDamage = source.node(DISABLE_ON_DAMAGE_PATH).getBoolean();
displayRadius = source.node(DISPLAY_RADIUS_PATH).getInt();
portable = source.node(PORTABLE_PATH).getBoolean();
staticRadius = source.node(STATIC_RADIUS_PATH).getInt();
alwaysDisplay = source.node(ALWAYS_DISPLAY_PATH).getBoolean();
rotationSpeed = source.node(ROTATION_SPEED_PATH).getInt();
spawnDelay = source.node(SPAWN_DELAY_PATH).getInt();
@@ -206,22 +202,6 @@ public class WardrobeSettings {
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
* @param newLocation

View File

@@ -56,7 +56,7 @@ public class CosmeticBackpackType extends Cosmetic {
user.getUserBackpackManager().getEntityManager().setRotation((int) loc.getYaw());
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);
// 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());

View File

@@ -56,7 +56,7 @@ public class UserBackpackManager {
getEntityManager().teleport(user.getEntity().getLocation());
List<Player> outsideViewers = 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();

View File

@@ -101,7 +101,7 @@ public class UserWardrobeManager {
Runnable run = () -> {
// Armorstand
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);
// Player

View File

@@ -122,19 +122,25 @@ public class PacketManager extends BasePacket {
NMSHandlers.getHandler().equipmentSlotUpdate(entityId, InventoryUtils.getEquipmentSlot(cosmeticSlot), user.getUserCosmeticItem(cosmeticSlot), sendTo);
}
public static void armorStandMetaPacket(
@NotNull Entity entity,
public static void sendArmorstandMetadata(
int entityId,
List<Player> sendTo
) {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
packet.getModifier().writeDefaults();
packet.getIntegers().write(0, entity.getEntityId());
WrappedDataWatcher metadata = new WrappedDataWatcher();
if (metadata == null) return;
// 0x10 & 0x20
metadata.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);
packet.getWatchableCollectionModifier().write(0, metadata.getWatchableObjects());
packet.getIntegers().write(0, entityId);
WrappedDataWatcher wrapper = new WrappedDataWatcher();
if (NMSHandlers.getVersion().contains("v1_18_R2") || NMSHandlers.getVersion().contains("v1_19_R1")) {
wrapper.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class)), (byte) 0x20);
wrapper.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(15, WrappedDataWatcher.Registry.get(Byte.class)), (byte) 0x10);
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);
}

View File

@@ -89,8 +89,6 @@ hook-settings:
# Requires restart to apply changes.
player-move-check: true
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
rotation-speed: 3
# Applies a pumpkin for an overlay of the player while in the wardrobe.