Fix enchantment order

This commit is contained in:
Nassim Jahnke 2024-06-20 17:42:27 +02:00
parent f5b3799db9
commit 64497b305a
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 12 additions and 3 deletions

View File

@ -11,6 +11,9 @@ The base ViaVersion jar runs on Paper and Velocity. We also have projects integr
on Fabric, Forge, Bungee, Sponge, or as a standalone proxy to join from basically any client version on on Fabric, Forge, Bungee, Sponge, or as a standalone proxy to join from basically any client version on
any server version from the past decade. **See [HERE](https://github.com/ViaVersion) for an overview of the different Via\* projects.** any server version from the past decade. **See [HERE](https://github.com/ViaVersion) for an overview of the different Via\* projects.**
Note that ViaVersion will be able to **run best on either Paper servers or Fabric clients** due to having
direct access to client/server state and more extensive API.
Supported Versions: Supported Versions:
![Table (https://i.imgur.com/sTrVnC2.png)](https://i.imgur.com/sTrVnC2.png) ![Table (https://i.imgur.com/sTrVnC2.png)](https://i.imgur.com/sTrVnC2.png)

View File

@ -93,7 +93,13 @@ public final class EfficiencyAttributeStorage implements StorableObject {
final PacketWrapper attributesPacket = PacketWrapper.create(ClientboundPackets1_21.UPDATE_ATTRIBUTES, connection); final PacketWrapper attributesPacket = PacketWrapper.create(ClientboundPackets1_21.UPDATE_ATTRIBUTES, connection);
attributesPacket.write(Types.VAR_INT, enchants.entityId()); attributesPacket.write(Types.VAR_INT, enchants.entityId());
final List<ActiveEnchant> list = List.of(enchants.efficiency(), enchants.soulSpeed(), enchants.swiftSneak(), enchants.depthStrider()); final List<ActiveEnchant> list = List.of(
enchants.efficiency(),
enchants.soulSpeed(),
enchants.swiftSneak(),
enchants.aquaAffinity(),
enchants.depthStrider()
);
attributesPacket.write(Types.VAR_INT, list.size()); attributesPacket.write(Types.VAR_INT, list.size());
for (final ActiveEnchant enchant : list) { for (final ActiveEnchant enchant : list) {
final EnchantAttributeModifier modifier = enchant.modifier; final EnchantAttributeModifier modifier = enchant.modifier;
@ -113,8 +119,8 @@ public final class EfficiencyAttributeStorage implements StorableObject {
attributesPacket.scheduleSend(Protocol1_20_5To1_21.class); attributesPacket.scheduleSend(Protocol1_20_5To1_21.class);
} }
public record ActiveEnchants(int entityId, ActiveEnchant efficiency, ActiveEnchant aquaAffinity, public record ActiveEnchants(int entityId, ActiveEnchant efficiency, ActiveEnchant soulSpeed,
ActiveEnchant soulSpeed, ActiveEnchant swiftSneak, ActiveEnchant depthStrider) { ActiveEnchant swiftSneak, ActiveEnchant aquaAffinity, ActiveEnchant depthStrider) {
} }
public record ActiveEnchant(EnchantAttributeModifier modifier, int level) { public record ActiveEnchant(EnchantAttributeModifier modifier, int level) {