diff --git a/protocol/build.gradle.kts b/protocol/build.gradle.kts index 9a5044bf1..3d17e2fdc 100644 --- a/protocol/build.gradle.kts +++ b/protocol/build.gradle.kts @@ -5,7 +5,7 @@ plugins { jacoco } -version = "1.21.9-SNAPSHOT" +version = "1.21.11-SNAPSHOT" description = "MCProtocolLib is a simple library for communicating with Minecraft clients and servers." dependencies { diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodec.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodec.java index 71fc1349a..781f6f378 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodec.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodec.java @@ -109,7 +109,7 @@ import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetContentPacket; import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetDataPacket; import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetSlotPacket; -import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundHorseScreenOpenPacket; +import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundMountScreenOpenPacket; import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundMerchantOffersPacket; import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundOpenBookPacket; import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundOpenScreenPacket; @@ -231,8 +231,8 @@ public class MinecraftCodec { public static final PacketCodec CODEC = PacketCodec.builder() - .protocolVersion(773) - .minecraftVersion("1.21.9") + .protocolVersion(774) + .minecraftVersion("1.21.11") .state(ProtocolState.HANDSHAKE, MinecraftPacketRegistry.builder() .registerServerboundPacket(ClientIntentionPacket.class, ClientIntentionPacket::new) ) @@ -325,7 +325,7 @@ public class MinecraftCodec { .registerClientboundPacket(ClientboundForgetLevelChunkPacket.class, ClientboundForgetLevelChunkPacket::new) .registerClientboundPacket(ClientboundGameEventPacket.class, ClientboundGameEventPacket::new) .registerClientboundPacket(ClientboundGameTestHighlightPosPacket.class, ClientboundGameTestHighlightPosPacket::new) - .registerClientboundPacket(ClientboundHorseScreenOpenPacket.class, ClientboundHorseScreenOpenPacket::new) + .registerClientboundPacket(ClientboundMountScreenOpenPacket.class, ClientboundMountScreenOpenPacket::new) .registerClientboundPacket(ClientboundHurtAnimationPacket.class, ClientboundHurtAnimationPacket::new) .registerClientboundPacket(ClientboundInitializeBorderPacket.class, ClientboundInitializeBorderPacket::new) .registerClientboundPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new) diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftTypes.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftTypes.java index 5f0fddb9d..e1a0817f3 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftTypes.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftTypes.java @@ -44,6 +44,7 @@ import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.CopperGolemState; import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.EntityMetadata; import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.GlobalPos; +import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.HumanoidArm; import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.MetadataType; import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.MetadataTypes; import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.PaintingVariant; @@ -837,6 +838,24 @@ public static void writeChickenVariant(ByteBuf buf, Holder variant) { } } + public static Holder readZombieNautilusVariant(ByteBuf buf) { + if (buf.readBoolean()) { + return Holder.ofId(MinecraftTypes.readVarInt(buf)); + } else { + return Holder.ofCustom(MinecraftTypes.readResourceLocation(buf)); + } + } + + public static void writeZombieNautilusVariant(ByteBuf buf, Holder variant) { + if (variant.isId()) { + buf.writeBoolean(true); + MinecraftTypes.writeVarInt(buf, variant.id()); + } else { + buf.writeBoolean(false); + MinecraftTypes.writeResourceLocation(buf, variant.custom()); + } + } + public static Holder readPaintingVariant(ByteBuf buf) { return MinecraftTypes.readHolder(buf, input -> { return new PaintingVariant(MinecraftTypes.readVarInt(input), MinecraftTypes.readVarInt(input), MinecraftTypes.readResourceLocation(input), @@ -886,6 +905,14 @@ public static void writeWeatheringCopperState(ByteBuf buf, WeatheringCopperState MinecraftTypes.writeEnum(buf, state); } + public static HumanoidArm readHumanoidArm(ByteBuf buf) { + return HumanoidArm.from(MinecraftTypes.readVarInt(buf)); + } + + public static void writeHumanoidArm(ByteBuf buf, HumanoidArm arm) { + MinecraftTypes.writeVarInt(buf, arm.ordinal()); + } + private static void writeEnum(ByteBuf buf, Enum e) { MinecraftTypes.writeVarInt(buf, e.ordinal()); } diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/Effect.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/Effect.java index 1738457b2..f21c0b7f1 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/Effect.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/Effect.java @@ -39,7 +39,8 @@ public enum Effect { WIND_CHARGED, WEAVING, OOZING, - INFESTED; + INFESTED, + BREATH_OF_THE_NAUTILUS; public static final Effect[] VALUES = values(); diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/metadata/HumanoidArm.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/metadata/HumanoidArm.java new file mode 100644 index 000000000..69ce0b2d0 --- /dev/null +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/metadata/HumanoidArm.java @@ -0,0 +1,12 @@ +package org.geysermc.mcprotocollib.protocol.data.game.entity.metadata; + +public enum HumanoidArm { + LEFT, + RIGHT; + + private static final HumanoidArm[] VALUES = values(); + + public static HumanoidArm from(int id) { + return id >= 0 & id < VALUES.length ? VALUES[id] : VALUES[0]; + } +} diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/metadata/MetadataTypes.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/metadata/MetadataTypes.java index 429e1f667..db8d1b500 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/metadata/MetadataTypes.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/metadata/MetadataTypes.java @@ -57,6 +57,7 @@ public class MetadataTypes { public static final IntMetadataType FROG_VARIANT = register(id -> new IntMetadataType(id, MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntEntityMetadata::new)); public static final IntMetadataType PIG_VARIANT = register(id -> new IntMetadataType(id, MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntEntityMetadata::new)); public static final IntMetadataType CHICKEN_VARIANT = register(id -> new IntMetadataType(id, MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntEntityMetadata::new)); + public static final IntMetadataType ZOMBIE_NAUTILUS_VARIANT = register(id -> new IntMetadataType(id, MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntEntityMetadata::new)); public static final MetadataType> OPTIONAL_GLOBAL_POS = register(id -> new MetadataType<>(id, optionalReader(MinecraftTypes::readGlobalPos), optionalWriter(MinecraftTypes::writeGlobalPos), ObjectEntityMetadata::new)); public static final MetadataType> PAINTING_VARIANT = register(id -> new MetadataType<>(id, MinecraftTypes::readPaintingVariant, MinecraftTypes::writePaintingVariant, ObjectEntityMetadata::new)); public static final MetadataType SNIFFER_STATE = register(id -> new MetadataType<>(id, MinecraftTypes::readSnifferState, MinecraftTypes::writeSnifferState, ObjectEntityMetadata::new)); @@ -66,6 +67,7 @@ public class MetadataTypes { public static final MetadataType VECTOR3 = register(id -> new MetadataType<>(id, MinecraftTypes::readRotation, MinecraftTypes::writeRotation, ObjectEntityMetadata::new)); public static final MetadataType QUATERNION = register(id -> new MetadataType<>(id, MinecraftTypes::readQuaternion, MinecraftTypes::writeQuaternion, ObjectEntityMetadata::new)); public static final MetadataType RESOLVABLE_PROFILE = register(id -> new MetadataType<>(id, MinecraftTypes::readResolvableProfile, MinecraftTypes::writeResolvableProfile, ObjectEntityMetadata::new)); + public static final MetadataType HUMANOID_ARM = register(id -> new MetadataType<>(id, MinecraftTypes::readHumanoidArm, MinecraftTypes::writeHumanoidArm, ObjectEntityMetadata::new)); public static > T register(Int2ObjectFunction factory) { T value = factory.apply(VALUES.size()); diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/player/PlayerAction.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/player/PlayerAction.java index eea2f51ff..039a0c9a5 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/player/PlayerAction.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/player/PlayerAction.java @@ -7,7 +7,8 @@ public enum PlayerAction { DROP_ITEM_STACK, DROP_ITEM, RELEASE_USE_ITEM, - SWAP_HANDS; + SWAP_HANDS, + STAB; private static final PlayerAction[] VALUES = values(); diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/type/EntityType.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/type/EntityType.java index 89862200b..ef5df4f1d 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/type/EntityType.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/type/EntityType.java @@ -23,6 +23,7 @@ public enum EntityType { BREEZE, BREEZE_WIND_CHARGE(true), CAMEL, + CAMEL_HUSK, CAT, CAVE_SPIDER, CHERRY_BOAT, @@ -90,6 +91,7 @@ public enum EntityType { MINECART, MOOSHROOM, MULE, + NAUTILUS, OAK_BOAT, OAK_CHEST_BOAT, OCELOT, @@ -98,6 +100,7 @@ public enum EntityType { PALE_OAK_BOAT, PALE_OAK_CHEST_BOAT, PANDA, + PARCHED, PARROT, PHANTOM, PIG, @@ -152,6 +155,7 @@ public enum EntityType { ZOGLIN, ZOMBIE, ZOMBIE_HORSE, + ZOMBIE_NAUTILUS, ZOMBIE_VILLAGER, ZOMBIFIED_PIGLIN, PLAYER, diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/AttackRange.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/AttackRange.java new file mode 100644 index 000000000..5eb583b3d --- /dev/null +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/AttackRange.java @@ -0,0 +1,8 @@ +package org.geysermc.mcprotocollib.protocol.data.game.item.component; + +import lombok.Builder; + +@Builder(toBuilder = true) +public record AttackRange(float minRange, float maxRange, float minCreativeRange, + float maxCreativeRange, float hitboxMargin, float mobFactor) { +} diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/Consumable.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/Consumable.java index 3f01218cc..822c3eac8 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/Consumable.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/Consumable.java @@ -21,12 +21,13 @@ public enum ItemUseAnimation { DRINK, BLOCK, BOW, - SPEAR, + TRIDENT, CROSSBOW, SPYGLASS, TOOT_HORN, BRUSH, - BUNDLE; + BUNDLE, + SPEAR; private static final ItemUseAnimation[] VALUES = values(); diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/DataComponentMatchers.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/DataComponentMatchers.java index 6e76704ee..4bb774c8e 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/DataComponentMatchers.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/DataComponentMatchers.java @@ -1,9 +1,18 @@ package org.geysermc.mcprotocollib.protocol.data.game.item.component; import lombok.Builder; +import org.cloudburstmc.nbt.NbtMap; import java.util.Map; @Builder(toBuilder = true) -public record DataComponentMatchers(Map, DataComponent> exactMatchers, int[] partialMatchers) { +public record DataComponentMatchers(Map, DataComponent> exactMatchers, Map partialMatchers) { + public DataComponentMatchers(Map, DataComponent> exactMatchers, Map partialMatchers) { + this.exactMatchers = Map.copyOf(exactMatchers); + this.partialMatchers = Map.copyOf(partialMatchers); + } + + @Builder(toBuilder = true) + public record PredicateType(boolean isPredicate, int id) { + } } diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/DataComponentTypes.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/DataComponentTypes.java index b9f399347..29e09faa7 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/DataComponentTypes.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/DataComponentTypes.java @@ -31,7 +31,10 @@ public class DataComponentTypes { public static final IntComponentType MAX_DAMAGE = register(id -> new IntComponentType(id, "max_damage", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new)); public static final IntComponentType DAMAGE = register(id -> new IntComponentType(id, "damage", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new)); public static final DataComponentType UNBREAKABLE = register(id -> new DataComponentType<>(id, "unbreakable", unitReader(), unitWriter(), ObjectDataComponent::new)); + public static final DataComponentType USE_EFFECTS = register(id -> new DataComponentType<>(id, "use_effects", ItemTypes::readUseEffects, ItemTypes::writeUseEffects, ObjectDataComponent::new)); public static final DataComponentType CUSTOM_NAME = register(id -> new DataComponentType<>(id, "custom_name", MinecraftTypes::readComponent, MinecraftTypes::writeComponent, ObjectDataComponent::new)); + public static final DataComponentType MINIMUM_ATTACK_CHARGE = register(id -> new DataComponentType<>(id, "minimum_attack_charge", ByteBuf::readFloat, ByteBuf::writeFloat, ObjectDataComponent::new)); + public static final DataComponentType> DAMAGE_TYPE = register(id -> new DataComponentType<>(id, "damage_type", ItemTypes::readDamageType, ItemTypes::writeDamageType, ObjectDataComponent::new)); public static final DataComponentType ITEM_NAME = register(id -> new DataComponentType<>(id, "item_name", MinecraftTypes::readComponent, MinecraftTypes::writeComponent, ObjectDataComponent::new)); public static final DataComponentType ITEM_MODEL = register(id -> new DataComponentType<>(id, "item_model", MinecraftTypes::readResourceLocation, MinecraftTypes::writeResourceLocation, ObjectDataComponent::new)); public static final DataComponentType> LORE = register(id -> new DataComponentType<>(id, "lore", listReader(MinecraftTypes::readComponent), listWriter(MinecraftTypes::writeComponent), ObjectDataComponent::new)); @@ -53,6 +56,7 @@ public class DataComponentTypes { public static final DataComponentType DAMAGE_RESISTANT = register(id -> new DataComponentType<>(id, "damage_resistant", MinecraftTypes::readResourceLocation, MinecraftTypes::writeResourceLocation, ObjectDataComponent::new)); public static final DataComponentType TOOL = register(id -> new DataComponentType<>(id, "tool", ItemTypes::readToolData, ItemTypes::writeToolData, ObjectDataComponent::new)); public static final DataComponentType WEAPON = register(id -> new DataComponentType<>(id, "weapon", ItemTypes::readWeapon, ItemTypes::writeWeapon, ObjectDataComponent::new)); + public static final DataComponentType ATTACK_RANGE = register(id -> new DataComponentType<>(id, "attack_range", ItemTypes::readAttackRange, ItemTypes::writeAttackRange, ObjectDataComponent::new)); public static final IntComponentType ENCHANTABLE = register(id -> new IntComponentType(id, "enchantable", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new)); public static final DataComponentType EQUIPPABLE = register(id -> new DataComponentType<>(id, "equippable", ItemTypes::readEquippable, ItemTypes::writeEquippable, ObjectDataComponent::new)); public static final DataComponentType REPAIRABLE = register(id -> new DataComponentType<>(id, "repairable", MinecraftTypes::readHolderSet, MinecraftTypes::writeHolderSet, ObjectDataComponent::new)); @@ -60,6 +64,9 @@ public class DataComponentTypes { public static final DataComponentType TOOLTIP_STYLE = register(id -> new DataComponentType<>(id, "tooltip_style", MinecraftTypes::readResourceLocation, MinecraftTypes::writeResourceLocation, ObjectDataComponent::new)); public static final DataComponentType> DEATH_PROTECTION = register(id -> new DataComponentType<>(id, "death_protection", listReader(ItemTypes::readConsumeEffect), listWriter(ItemTypes::writeConsumeEffect), ObjectDataComponent::new)); public static final DataComponentType BLOCKS_ATTACKS = register(id -> new DataComponentType<>(id, "blocks_attacks", ItemTypes::readBlocksAttacks, ItemTypes::writeBlocksAttacks, ObjectDataComponent::new)); + public static final DataComponentType PIERCING_WEAPON = register(id -> new DataComponentType<>(id, "piercing_weapon", ItemTypes::readPiercingWeapon, ItemTypes::writePiercingWeapon, ObjectDataComponent::new)); + public static final DataComponentType KINETIC_WEAPON = register(id -> new DataComponentType<>(id, "kinetic_weapon", ItemTypes::readKineticWeapon, ItemTypes::writeKineticWeapon, ObjectDataComponent::new)); + public static final DataComponentType SWING_ANIMATION = register(id -> new DataComponentType<>(id, "swing_animation", ItemTypes::readSwingAnimation, ItemTypes::writeSwingAnimation, ObjectDataComponent::new)); public static final DataComponentType STORED_ENCHANTMENTS = register(id -> new DataComponentType<>(id, "stored_enchantments", ItemTypes::readItemEnchantments, ItemTypes::writeItemEnchantments, ObjectDataComponent::new)); public static final IntComponentType DYED_COLOR = register(id -> new IntComponentType(id, "dyed_color", ByteBuf::readInt, ByteBuf::writeInt, IntDataComponent::new)); public static final IntComponentType MAP_COLOR = register(id -> new IntComponentType(id, "map_color", ByteBuf::readInt, ByteBuf::writeInt, IntDataComponent::new)); @@ -113,6 +120,7 @@ public class DataComponentTypes { public static final IntComponentType PIG_VARIANT = register(id -> new IntComponentType(id, "pig/variant", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new)); public static final IntComponentType COW_VARIANT = register(id -> new IntComponentType(id, "cow/variant", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new)); public static final DataComponentType> CHICKEN_VARIANT = register(id -> new DataComponentType<>(id, "chicken/variant", MinecraftTypes::readChickenVariant, MinecraftTypes::writeChickenVariant, ObjectDataComponent::new)); + public static final DataComponentType> ZOMBIE_NAUTILUS_VARIANT = register(id -> new DataComponentType<>(id, "zombie_nautilus/variant", MinecraftTypes::readZombieNautilusVariant, MinecraftTypes::writeZombieNautilusVariant, ObjectDataComponent::new)); public static final IntComponentType FROG_VARIANT = register(id -> new IntComponentType(id, "frog/variant", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new)); public static final IntComponentType HORSE_VARIANT = register(id -> new IntComponentType(id, "horse/variant", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new)); public static final DataComponentType> PAINTING_VARIANT = register(id -> new DataComponentType<>(id, "painting/variant", MinecraftTypes::readPaintingVariant, MinecraftTypes::writePaintingVariant, ObjectDataComponent::new)); diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/ItemTypes.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/ItemTypes.java index ce6ed233b..a1715ab27 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/ItemTypes.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/ItemTypes.java @@ -36,6 +36,38 @@ public static void writeFilterable(ByteBuf buf, Filterable filterable, Bi MinecraftTypes.writeNullable(buf, filterable.getOptional(), writer); } + public static UseEffects readUseEffects(ByteBuf buf) { + boolean canSprint = buf.readBoolean(); + boolean interactVibrations = buf.readBoolean(); + float speedMultiplier = buf.readFloat(); + + return new UseEffects(canSprint, interactVibrations, speedMultiplier); + } + + public static void writeUseEffects(ByteBuf buf, UseEffects useEffects) { + buf.writeBoolean(useEffects.canSprint()); + buf.writeBoolean(useEffects.interactVibrations()); + buf.writeFloat(useEffects.speedMultiplier()); + } + + public static Holder readDamageType(ByteBuf buf) { + if (buf.readBoolean()) { + return Holder.ofId(MinecraftTypes.readVarInt(buf)); + } else { + return Holder.ofCustom(MinecraftTypes.readResourceLocation(buf)); + } + } + + public static void writeDamageType(ByteBuf buf, Holder variant) { + if (variant.isId()) { + buf.writeBoolean(true); + MinecraftTypes.writeVarInt(buf, variant.id()); + } else { + buf.writeBoolean(false); + MinecraftTypes.writeResourceLocation(buf, variant.custom()); + } + } + public static ItemEnchantments readItemEnchantments(ByteBuf buf) { Map enchantments = new HashMap<>(); int enchantmentCount = MinecraftTypes.readVarInt(buf); @@ -106,10 +138,16 @@ public static void writeBlockPredicate(ByteBuf buf, AdventureModePredicate.Block public static DataComponentMatchers readDataComponentMatchers(ByteBuf buf) { Map, DataComponent> exactMatchers = MinecraftTypes.readExactComponentMatcher(buf); + Map partialMatchers = new HashMap<>(); + + int count = MinecraftTypes.readVarInt(buf); + if (count > 64) { + throw new IllegalArgumentException(count + " elements exceeds max size of: " + 64); + } - int[] partialMatchers = new int[MinecraftTypes.readVarInt(buf)]; - for (int i = 0; i < partialMatchers.length; i++) { - partialMatchers[i] = MinecraftTypes.readVarInt(buf); + for (int i = 0; i < count; i++) { + DataComponentMatchers.PredicateType type = new DataComponentMatchers.PredicateType(buf.readBoolean(), MinecraftTypes.readVarInt(buf)); + partialMatchers.put(type, MinecraftTypes.readCompoundTag(buf)); } return new DataComponentMatchers(exactMatchers, partialMatchers); @@ -118,9 +156,16 @@ public static DataComponentMatchers readDataComponentMatchers(ByteBuf buf) { public static void writeDataComponentMatchers(ByteBuf buf, DataComponentMatchers matchers) { MinecraftTypes.writeExactComponentMatcher(buf, matchers.exactMatchers()); - MinecraftTypes.writeVarInt(buf, matchers.partialMatchers().length); - for (int id : matchers.partialMatchers()) { - MinecraftTypes.writeVarInt(buf, id); + int count = matchers.partialMatchers().size(); + if (count > 64) { + throw new IllegalArgumentException(count + " elements exceeds max size of: " + 64); + } + + MinecraftTypes.writeVarInt(buf, count); + for (Map.Entry entry : matchers.partialMatchers().entrySet()) { + buf.writeBoolean(entry.getKey().isPredicate()); + MinecraftTypes.writeVarInt(buf, entry.getKey().id()); + MinecraftTypes.writeAnyTag(buf, entry.getValue()); } } @@ -162,6 +207,26 @@ public static void writeWeapon(ByteBuf buf, Weapon weapon) { buf.writeFloat(weapon.disableBlockingForSeconds()); } + public static AttackRange readAttackRange(ByteBuf buf) { + float minRange = buf.readFloat(); + float maxRange = buf.readFloat(); + float minCreativeRange = buf.readFloat(); + float maxCreativeRange = buf.readFloat(); + float hitboxMargin = buf.readFloat(); + float mobFactor = buf.readFloat(); + + return new AttackRange(minRange, maxRange, minCreativeRange, maxCreativeRange, hitboxMargin, mobFactor); + } + + public static void writeAttackRange(ByteBuf buf, AttackRange attackRange) { + buf.writeFloat(attackRange.minRange()); + buf.writeFloat(attackRange.maxRange()); + buf.writeFloat(attackRange.minCreativeRange()); + buf.writeFloat(attackRange.maxCreativeRange()); + buf.writeFloat(attackRange.hitboxMargin()); + buf.writeFloat(attackRange.mobFactor()); + } + public static Equippable readEquippable(ByteBuf buf) { EquipmentSlot slot = EquipmentSlot.fromId(MinecraftTypes.readVarInt(buf)); Sound equipSound = MinecraftTypes.readSound(buf); @@ -229,6 +294,75 @@ public static void writeBlocksAttacks(ByteBuf buf, BlocksAttacks blocksAttacks) MinecraftTypes.writeNullable(buf, blocksAttacks.disableSound(), MinecraftTypes::writeSound); } + public static PiercingWeapon readPiercingWeapon(ByteBuf buf) { + boolean dealsKnockback = buf.readBoolean(); + boolean dismounts = buf.readBoolean(); + Sound sound = MinecraftTypes.readNullable(buf, MinecraftTypes::readSound); + Sound hitSound = MinecraftTypes.readNullable(buf, MinecraftTypes::readSound); + + return new PiercingWeapon(dealsKnockback, dismounts, sound, hitSound); + } + + public static void writePiercingWeapon(ByteBuf buf, PiercingWeapon piercingWeapon) { + buf.writeBoolean(piercingWeapon.dealsKnockback()); + buf.writeBoolean(piercingWeapon.dismounts()); + MinecraftTypes.writeNullable(buf, piercingWeapon.sound(), MinecraftTypes::writeSound); + MinecraftTypes.writeNullable(buf, piercingWeapon.hitSound(), MinecraftTypes::writeSound); + } + + public static KineticWeapon readKineticWeapon(ByteBuf buf) { + int contactCooldownTicks = MinecraftTypes.readVarInt(buf); + int delayTicks = MinecraftTypes.readVarInt(buf); + KineticWeapon.Condition dismountConditions = MinecraftTypes.readNullable(buf, ItemTypes::readKineticCondition); + KineticWeapon.Condition knockbackConditions = MinecraftTypes.readNullable(buf, ItemTypes::readKineticCondition); + KineticWeapon.Condition damageConditions = MinecraftTypes.readNullable(buf, ItemTypes::readKineticCondition); + float forwardMovement = buf.readFloat(); + float damageMultiplier = buf.readFloat(); + Sound sound = MinecraftTypes.readNullable(buf, MinecraftTypes::readSound); + Sound hitSound = MinecraftTypes.readNullable(buf, MinecraftTypes::readSound); + + return new KineticWeapon(contactCooldownTicks, delayTicks, dismountConditions, + knockbackConditions, damageConditions, forwardMovement, damageMultiplier, sound, hitSound); + } + + public static void writeKineticWeapon(ByteBuf buf, KineticWeapon kineticWeapon) { + MinecraftTypes.writeVarInt(buf, kineticWeapon.contactCooldownTicks()); + MinecraftTypes.writeVarInt(buf, kineticWeapon.delayTicks()); + MinecraftTypes.writeNullable(buf, kineticWeapon.dismountConditions(), ItemTypes::writeKineticCondition); + MinecraftTypes.writeNullable(buf, kineticWeapon.knockbackConditions(), ItemTypes::writeKineticCondition); + MinecraftTypes.writeNullable(buf, kineticWeapon.damageConditions(), ItemTypes::writeKineticCondition); + buf.writeFloat(kineticWeapon.forwardMovement()); + buf.writeFloat(kineticWeapon.damageMultiplier()); + MinecraftTypes.writeNullable(buf, kineticWeapon.sound(), MinecraftTypes::writeSound); + MinecraftTypes.writeNullable(buf, kineticWeapon.hitSound(), MinecraftTypes::writeSound); + } + + public static KineticWeapon.Condition readKineticCondition(ByteBuf buf) { + int maxDurationTicks = MinecraftTypes.readVarInt(buf); + float minSpeed = buf.readFloat(); + float minRelativeSpeed = buf.readFloat(); + + return new KineticWeapon.Condition(maxDurationTicks, minSpeed, minRelativeSpeed); + } + + public static void writeKineticCondition(ByteBuf buf, KineticWeapon.Condition condition) { + MinecraftTypes.writeVarInt(buf, condition.maxDurationTicks()); + buf.writeFloat(condition.minSpeed()); + buf.writeFloat(condition.minRelativeSpeed()); + } + + public static SwingAnimation readSwingAnimation(ByteBuf buf) { + SwingAnimation.Type type = SwingAnimation.Type.from(MinecraftTypes.readVarInt(buf)); + int duration = MinecraftTypes.readVarInt(buf); + + return new SwingAnimation(type, duration); + } + + public static void writeSwingAnimation(ByteBuf buf, SwingAnimation swingAnimation) { + MinecraftTypes.writeVarInt(buf, swingAnimation.type().ordinal()); + MinecraftTypes.writeVarInt(buf, swingAnimation.duration()); + } + public static ItemAttributeModifiers readItemAttributeModifiers(ByteBuf buf) { List modifiers = MinecraftTypes.readList(buf, (input) -> { int attribute = MinecraftTypes.readVarInt(input); diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/KineticWeapon.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/KineticWeapon.java new file mode 100644 index 000000000..09c05d5b5 --- /dev/null +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/KineticWeapon.java @@ -0,0 +1,15 @@ +package org.geysermc.mcprotocollib.protocol.data.game.item.component; + +import lombok.Builder; +import org.geysermc.mcprotocollib.protocol.data.game.level.sound.Sound; +import org.jetbrains.annotations.Nullable; + +@Builder(toBuilder = true) +public record KineticWeapon(int contactCooldownTicks, int delayTicks, @Nullable Condition dismountConditions, + @Nullable Condition knockbackConditions, @Nullable Condition damageConditions, + float forwardMovement, float damageMultiplier, @Nullable Sound sound, @Nullable Sound hitSound) { + + @Builder(toBuilder = true) + public record Condition(int maxDurationTicks, float minSpeed, float minRelativeSpeed) { + } +} diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/PiercingWeapon.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/PiercingWeapon.java new file mode 100644 index 000000000..9a6898769 --- /dev/null +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/PiercingWeapon.java @@ -0,0 +1,9 @@ +package org.geysermc.mcprotocollib.protocol.data.game.item.component; + +import lombok.Builder; +import org.geysermc.mcprotocollib.protocol.data.game.level.sound.Sound; +import org.jetbrains.annotations.Nullable; + +@Builder(toBuilder = true) +public record PiercingWeapon(boolean dealsKnockback, boolean dismounts, @Nullable Sound sound, @Nullable Sound hitSound) { +} diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/SwingAnimation.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/SwingAnimation.java new file mode 100644 index 000000000..28ff01c67 --- /dev/null +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/SwingAnimation.java @@ -0,0 +1,19 @@ +package org.geysermc.mcprotocollib.protocol.data.game.item.component; + +import lombok.Builder; + +@Builder(toBuilder = true) +public record SwingAnimation(Type type, int duration) { + + public enum Type { + NONE, + WHACK, + STAB; + + private static final Type[] VALUES = values(); + + public static Type from(int id) { + return id >= 0 && id < VALUES.length ? VALUES[id] : VALUES[0]; + } + } +} diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/UseEffects.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/UseEffects.java new file mode 100644 index 000000000..2450ec1b2 --- /dev/null +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/UseEffects.java @@ -0,0 +1,7 @@ +package org.geysermc.mcprotocollib.protocol.data.game.item.component; + +import lombok.Builder; + +@Builder(toBuilder = true) +public record UseEffects(boolean canSprint, boolean interactVibrations, float speedMultiplier) { +} diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/level/sound/BuiltinSound.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/level/sound/BuiltinSound.java index e329a1c0c..150183eef 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/level/sound/BuiltinSound.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/level/sound/BuiltinSound.java @@ -86,6 +86,8 @@ public enum BuiltinSound implements Sound { ITEM_ARMOR_EQUIP_TURTLE("item.armor.equip_turtle"), ITEM_ARMOR_EQUIP_WOLF("item.armor.equip_wolf"), ITEM_ARMOR_UNEQUIP_WOLF("item.armor.unequip_wolf"), + ITEM_ARMOR_EQUIP_NAUTILUS("item.armor.equip_nautilus"), + ITEM_ARMOR_UNEQUIP_NAUTILUS("item.armor.unequip_nautilus"), ENTITY_ARMOR_STAND_BREAK("entity.armor_stand.break"), ENTITY_ARMOR_STAND_FALL("entity.armor_stand.fall"), ENTITY_ARMOR_STAND_HIT("entity.armor_stand.hit"), @@ -113,6 +115,15 @@ public enum BuiltinSound implements Sound { BLOCK_AZALEA_LEAVES_HIT("block.azalea_leaves.hit"), BLOCK_AZALEA_LEAVES_PLACE("block.azalea_leaves.place"), BLOCK_AZALEA_LEAVES_STEP("block.azalea_leaves.step"), + ENTITY_BABY_NAUTILUS_AMBIENT("entity.baby_nautilus.ambient"), + ENTITY_BABY_NAUTILUS_AMBIENT_LAND("entity.baby_nautilus.ambient_land"), + ENTITY_BABY_NAUTILUS_DEATH("entity.baby_nautilus.death"), + ENTITY_BABY_NAUTILUS_DEATH_LAND("entity.baby_nautilus.death_land"), + ENTITY_BABY_NAUTILUS_EAT("entity.baby_nautilus.eat"), + ENTITY_BABY_NAUTILUS_HURT("entity.baby_nautilus.hurt"), + ENTITY_BABY_NAUTILUS_HURT_LAND("entity.baby_nautilus.hurt_land"), + ENTITY_NAUTILUS_RIDING("entity.nautilus.riding"), + ENTITY_BABY_NAUTILUS_SWIM("entity.baby_nautilus.swim"), BLOCK_BAMBOO_BREAK("block.bamboo.break"), BLOCK_BAMBOO_FALL("block.bamboo.fall"), BLOCK_BAMBOO_HIT("block.bamboo.hit"), @@ -243,6 +254,17 @@ public enum BuiltinSound implements Sound { BLOCK_CALCITE_PLACE("block.calcite.place"), BLOCK_CALCITE_HIT("block.calcite.hit"), BLOCK_CALCITE_FALL("block.calcite.fall"), + ENTITY_CAMEL_HUSK_AMBIENT("entity.camel_husk.ambient"), + ENTITY_CAMEL_HUSK_DASH("entity.camel_husk.dash"), + ENTITY_CAMEL_HUSK_DASH_READY("entity.camel_husk.dash_ready"), + ENTITY_CAMEL_HUSK_DEATH("entity.camel_husk.death"), + ENTITY_CAMEL_HUSK_EAT("entity.camel_husk.eat"), + ENTITY_CAMEL_HUSK_HURT("entity.camel_husk.hurt"), + ENTITY_CAMEL_HUSK_SADDLE("entity.camel_husk.saddle"), + ENTITY_CAMEL_HUSK_SIT("entity.camel_husk.sit"), + ENTITY_CAMEL_HUSK_STAND("entity.camel_husk.stand"), + ENTITY_CAMEL_HUSK_STEP("entity.camel_husk.step"), + ENTITY_CAMEL_HUSK_STEP_SAND("entity.camel_husk.step_sand"), ENTITY_CAMEL_AMBIENT("entity.camel.ambient"), ENTITY_CAMEL_DASH("entity.camel.dash"), ENTITY_CAMEL_DASH_READY("entity.camel.dash_ready"), @@ -900,6 +922,9 @@ public enum BuiltinSound implements Sound { BLOCK_LODESTONE_HIT("block.lodestone.hit"), BLOCK_LODESTONE_FALL("block.lodestone.fall"), ITEM_LODESTONE_COMPASS_LOCK("item.lodestone_compass.lock"), + ITEM_SPEAR_LUNGE_1("item.spear.lunge_1"), + ITEM_SPEAR_LUNGE_2("item.spear.lunge_2"), + ITEM_SPEAR_LUNGE_3("item.spear.lunge_3"), ITEM_MACE_SMASH_AIR("item.mace.smash_air"), ITEM_MACE_SMASH_GROUND("item.mace.smash_ground"), ITEM_MACE_SMASH_GROUND_HEAVY("item.mace.smash_ground_heavy"), @@ -1020,6 +1045,18 @@ public enum BuiltinSound implements Sound { MUSIC_OVERWORLD_SPARSE_JUNGLE("music.overworld.sparse_jungle"), MUSIC_OVERWORLD_BAMBOO_JUNGLE("music.overworld.bamboo_jungle"), MUSIC_UNDER_WATER("music.under_water"), + ENTITY_NAUTILUS_AMBIENT("entity.nautilus.ambient"), + ENTITY_NAUTILUS_AMBIENT_LAND("entity.nautilus.ambient_land"), + ENTITY_NAUTILUS_DASH("entity.nautilus.dash"), + ENTITY_NAUTILUS_DASH_LAND("entity.nautilus.dash_land"), + ENTITY_NAUTILUS_DASH_READY("entity.nautilus.dash_ready"), + ENTITY_NAUTILUS_DASH_READY_LAND("entity.nautilus.dash_ready_land"), + ENTITY_NAUTILUS_DEATH("entity.nautilus.death"), + ENTITY_NAUTILUS_DEATH_LAND("entity.nautilus.death_land"), + ENTITY_NAUTILUS_EAT("entity.nautilus.eat"), + ENTITY_NAUTILUS_HURT("entity.nautilus.hurt"), + ENTITY_NAUTILUS_HURT_LAND("entity.nautilus.hurt_land"), + ENTITY_NAUTILUS_SWIM("entity.nautilus.swim"), BLOCK_NETHER_BRICKS_BREAK("block.nether_bricks.break"), BLOCK_NETHER_BRICKS_STEP("block.nether_bricks.step"), BLOCK_NETHER_BRICKS_PLACE("block.nether_bricks.place"), @@ -1128,6 +1165,10 @@ public enum BuiltinSound implements Sound { ENTITY_PANDA_WORRIED_AMBIENT("entity.panda.worried_ambient"), ENTITY_PANDA_HURT("entity.panda.hurt"), ENTITY_PANDA_BITE("entity.panda.bite"), + ENTITY_PARCHED_AMBIENT("entity.parched.ambient"), + ENTITY_PARCHED_DEATH("entity.parched.death"), + ENTITY_PARCHED_HURT("entity.parched.hurt"), + ENTITY_PARCHED_STEP("entity.parched.step"), ENTITY_PARROT_AMBIENT("entity.parrot.ambient"), ENTITY_PARROT_DEATH("entity.parrot.death"), ENTITY_PARROT_EAT("entity.parrot.eat"), @@ -1136,6 +1177,7 @@ public enum BuiltinSound implements Sound { ENTITY_PARROT_IMITATE_BLAZE("entity.parrot.imitate.blaze"), ENTITY_PARROT_IMITATE_BOGGED("entity.parrot.imitate.bogged"), ENTITY_PARROT_IMITATE_BREEZE("entity.parrot.imitate.breeze"), + ENTITY_PARROT_IMITATE_CAMEL_HUSK("entity.parrot.imitate.camel_husk"), ENTITY_PARROT_IMITATE_CREAKING("entity.parrot.imitate.creaking"), ENTITY_PARROT_IMITATE_CREEPER("entity.parrot.imitate.creeper"), ENTITY_PARROT_IMITATE_DROWNED("entity.parrot.imitate.drowned"), @@ -1150,6 +1192,7 @@ public enum BuiltinSound implements Sound { ENTITY_PARROT_IMITATE_ILLUSIONER("entity.parrot.imitate.illusioner"), ENTITY_PARROT_IMITATE_MAGMA_CUBE("entity.parrot.imitate.magma_cube"), ENTITY_PARROT_IMITATE_PHANTOM("entity.parrot.imitate.phantom"), + ENTITY_PARROT_IMITATE_PARCHED("entity.parrot.imitate.parched"), ENTITY_PARROT_IMITATE_PIGLIN("entity.parrot.imitate.piglin"), ENTITY_PARROT_IMITATE_PIGLIN_BRUTE("entity.parrot.imitate.piglin_brute"), ENTITY_PARROT_IMITATE_PILLAGER("entity.parrot.imitate.pillager"), @@ -1168,6 +1211,8 @@ public enum BuiltinSound implements Sound { ENTITY_PARROT_IMITATE_WITHER_SKELETON("entity.parrot.imitate.wither_skeleton"), ENTITY_PARROT_IMITATE_ZOGLIN("entity.parrot.imitate.zoglin"), ENTITY_PARROT_IMITATE_ZOMBIE("entity.parrot.imitate.zombie"), + ENTITY_PARROT_IMITATE_ZOMBIE_HORSE("entity.parrot.imitate.zombie_horse"), + ENTITY_PARROT_IMITATE_ZOMBIE_NAUTILUS("entity.parrot.imitate.zombie_nautilus"), ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER("entity.parrot.imitate.zombie_villager"), ENTITY_PARROT_STEP("entity.parrot.step"), ENTITY_PHANTOM_AMBIENT("entity.phantom.ambient"), @@ -1275,6 +1320,15 @@ public enum BuiltinSound implements Sound { BLOCK_NETHER_ORE_PLACE("block.nether_ore.place"), BLOCK_NETHER_ORE_STEP("block.nether_ore.step"), BLOCK_REDSTONE_TORCH_BURNOUT("block.redstone_torch.burnout"), + BLOCK_RESIN_BREAK("block.resin.break"), + BLOCK_RESIN_FALL("block.resin.fall"), + BLOCK_RESIN_PLACE("block.resin.place"), + BLOCK_RESIN_STEP("block.resin.step"), + BLOCK_RESIN_BRICKS_BREAK("block.resin_bricks.break"), + BLOCK_RESIN_BRICKS_FALL("block.resin_bricks.fall"), + BLOCK_RESIN_BRICKS_HIT("block.resin_bricks.hit"), + BLOCK_RESIN_BRICKS_PLACE("block.resin_bricks.place"), + BLOCK_RESIN_BRICKS_STEP("block.resin_bricks.step"), BLOCK_RESPAWN_ANCHOR_AMBIENT("block.respawn_anchor.ambient"), BLOCK_RESPAWN_ANCHOR_CHARGE("block.respawn_anchor.charge"), BLOCK_RESPAWN_ANCHOR_DEPLETE("block.respawn_anchor.deplete"), @@ -1418,15 +1472,12 @@ public enum BuiltinSound implements Sound { BLOCK_SPAWNER_HIT("block.spawner.hit"), BLOCK_SPAWNER_PLACE("block.spawner.place"), BLOCK_SPAWNER_STEP("block.spawner.step"), - BLOCK_RESIN_BREAK("block.resin.break"), - BLOCK_RESIN_FALL("block.resin.fall"), - BLOCK_RESIN_PLACE("block.resin.place"), - BLOCK_RESIN_STEP("block.resin.step"), - BLOCK_RESIN_BRICKS_BREAK("block.resin_bricks.break"), - BLOCK_RESIN_BRICKS_FALL("block.resin_bricks.fall"), - BLOCK_RESIN_BRICKS_HIT("block.resin_bricks.hit"), - BLOCK_RESIN_BRICKS_PLACE("block.resin_bricks.place"), - BLOCK_RESIN_BRICKS_STEP("block.resin_bricks.step"), + ITEM_SPEAR_USE("item.spear.use"), + ITEM_SPEAR_HIT("item.spear.hit"), + ITEM_SPEAR_ATTACK("item.spear.attack"), + ITEM_SPEAR_WOOD_USE("item.spear_wood.use"), + ITEM_SPEAR_WOOD_HIT("item.spear_wood.hit"), + ITEM_SPEAR_WOOD_ATTACK("item.spear_wood.attack"), BLOCK_SPORE_BLOSSOM_BREAK("block.spore_blossom.break"), BLOCK_SPORE_BLOSSOM_FALL("block.spore_blossom.fall"), BLOCK_SPORE_BLOSSOM_HIT("block.spore_blossom.hit"), @@ -1759,10 +1810,24 @@ public enum BuiltinSound implements Sound { ENTITY_ZOMBIE_DEATH("entity.zombie.death"), ENTITY_ZOMBIE_DESTROY_EGG("entity.zombie.destroy_egg"), ENTITY_ZOMBIE_HORSE_AMBIENT("entity.zombie_horse.ambient"), + ENTITY_ZOMBIE_HORSE_ANGRY("entity.zombie_horse.angry"), ENTITY_ZOMBIE_HORSE_DEATH("entity.zombie_horse.death"), + ENTITY_ZOMBIE_HORSE_EAT("entity.zombie_horse.eat"), ENTITY_ZOMBIE_HORSE_HURT("entity.zombie_horse.hurt"), ENTITY_ZOMBIE_HURT("entity.zombie.hurt"), ENTITY_ZOMBIE_INFECT("entity.zombie.infect"), + ENTITY_ZOMBIE_NAUTILUS_AMBIENT("entity.zombie_nautilus.ambient"), + ENTITY_ZOMBIE_NAUTILUS_AMBIENT_LAND("entity.zombie_nautilus.ambient_land"), + ENTITY_ZOMBIE_NAUTILUS_DASH("entity.zombie_nautilus.dash"), + ENTITY_ZOMBIE_NAUTILUS_DASH_LAND("entity.zombie_nautilus.dash_land"), + ENTITY_ZOMBIE_NAUTILUS_DASH_READY("entity.zombie_nautilus.dash_ready"), + ENTITY_ZOMBIE_NAUTILUS_DASH_READY_LAND("entity.zombie_nautilus.dash_ready_land"), + ENTITY_ZOMBIE_NAUTILUS_DEATH("entity.zombie_nautilus.death"), + ENTITY_ZOMBIE_NAUTILUS_DEATH_LAND("entity.zombie_nautilus.death_land"), + ENTITY_ZOMBIE_NAUTILUS_EAT("entity.zombie_nautilus.eat"), + ENTITY_ZOMBIE_NAUTILUS_HURT("entity.zombie_nautilus.hurt"), + ENTITY_ZOMBIE_NAUTILUS_HURT_LAND("entity.zombie_nautilus.hurt_land"), + ENTITY_ZOMBIE_NAUTILUS_SWIM("entity.zombie_nautilus.swim"), ENTITY_ZOMBIFIED_PIGLIN_AMBIENT("entity.zombified_piglin.ambient"), ENTITY_ZOMBIFIED_PIGLIN_ANGRY("entity.zombified_piglin.angry"), ENTITY_ZOMBIFIED_PIGLIN_DEATH("entity.zombified_piglin.death"), @@ -1777,7 +1842,9 @@ public enum BuiltinSound implements Sound { EVENT_MOB_EFFECT_BAD_OMEN("event.mob_effect.bad_omen"), EVENT_MOB_EFFECT_TRIAL_OMEN("event.mob_effect.trial_omen"), EVENT_MOB_EFFECT_RAID_OMEN("event.mob_effect.raid_omen"), - ITEM_SADDLE_UNEQUIP("item.saddle.unequip"); + ITEM_SADDLE_UNEQUIP("item.saddle.unequip"), + ITEM_NAUTILUS_SADDLE_UNDERWATER_EQUIP("item.nautilus_saddle_underwater_equip"), + ITEM_NAUTILUS_SADDLE_EQUIP("item.nautilus_saddle_equip"); private final @NonNull String name; diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/statistic/CustomStatistic.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/statistic/CustomStatistic.java index eb200b4e8..260aa4395 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/statistic/CustomStatistic.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/statistic/CustomStatistic.java @@ -29,6 +29,7 @@ public enum CustomStatistic implements Statistic { AVIATE_ONE_CM(StatisticFormat.DISTANCE), SWIM_ONE_CM(StatisticFormat.DISTANCE), STRIDER_ONE_CM(StatisticFormat.DISTANCE), + NAUTILUS_ONE_CM(StatisticFormat.DISTANCE), JUMP, DROP, DAMAGE_DEALT(StatisticFormat.TENTHS), diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/packet/ingame/clientbound/inventory/ClientboundHorseScreenOpenPacket.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/packet/ingame/clientbound/inventory/ClientboundMountScreenOpenPacket.java similarity index 88% rename from protocol/src/main/java/org/geysermc/mcprotocollib/protocol/packet/ingame/clientbound/inventory/ClientboundHorseScreenOpenPacket.java rename to protocol/src/main/java/org/geysermc/mcprotocollib/protocol/packet/ingame/clientbound/inventory/ClientboundMountScreenOpenPacket.java index 166069397..c93491774 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/packet/ingame/clientbound/inventory/ClientboundHorseScreenOpenPacket.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/packet/ingame/clientbound/inventory/ClientboundMountScreenOpenPacket.java @@ -10,12 +10,12 @@ @Data @With @AllArgsConstructor -public class ClientboundHorseScreenOpenPacket implements MinecraftPacket { +public class ClientboundMountScreenOpenPacket implements MinecraftPacket { private final int containerId; private final int inventoryColumns; private final int entityId; - public ClientboundHorseScreenOpenPacket(ByteBuf in) { + public ClientboundMountScreenOpenPacket(ByteBuf in) { this.containerId = MinecraftTypes.readVarInt(in); this.inventoryColumns = MinecraftTypes.readVarInt(in); this.entityId = in.readInt(); diff --git a/protocol/src/main/resources/networkCodec.nbt b/protocol/src/main/resources/networkCodec.nbt index ae4494d9e..fb08022a2 100644 Binary files a/protocol/src/main/resources/networkCodec.nbt and b/protocol/src/main/resources/networkCodec.nbt differ