Skip to content

Commit 44ff6fa

Browse files
committed
1.21.9-pre1
1 parent 0dd5f64 commit 44ff6fa

File tree

6 files changed

+33
-71
lines changed

6 files changed

+33
-71
lines changed

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@
231231

232232
public class MinecraftCodec {
233233
public static final PacketCodec CODEC = PacketCodec.builder()
234-
.protocolVersion((1 << 30) | 268)
235-
.minecraftVersion("25w37a")
234+
.protocolVersion((1 << 30) | 269)
235+
.minecraftVersion("1.21.9-pre1")
236236
.state(ProtocolState.HANDSHAKE, MinecraftPacketRegistry.builder()
237237
.registerServerboundPacket(ClientIntentionPacket.class, ClientIntentionPacket::new)
238238
)

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftTypes.java

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.CopperGolemState;
4545
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.EntityMetadata;
4646
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.GlobalPos;
47-
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.MannequinProfile;
4847
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.MetadataType;
4948
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.MetadataTypes;
5049
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.PaintingVariant;
@@ -1837,9 +1836,15 @@ public static void writeDynamicGameProfile(ByteBuf buf, GameProfile profile) {
18371836
}
18381837

18391838
public static ResolvableProfile readResolvableProfile(ByteBuf buf) {
1840-
return buf.readBoolean()
1841-
? new ResolvableProfile(MinecraftTypes.readStaticGameProfile(buf), false)
1842-
: new ResolvableProfile(MinecraftTypes.readDynamicGameProfile(buf), true);
1839+
boolean dynamic = !buf.readBoolean();
1840+
GameProfile profile = dynamic ? MinecraftTypes.readDynamicGameProfile(buf) : MinecraftTypes.readStaticGameProfile(buf);
1841+
Key body = MinecraftTypes.readNullable(buf, MinecraftTypes::readResourceLocation);
1842+
Key cape = MinecraftTypes.readNullable(buf, MinecraftTypes::readResourceLocation);
1843+
Key elytra = MinecraftTypes.readNullable(buf, MinecraftTypes::readResourceLocation);
1844+
GameProfile.TextureModel model = MinecraftTypes.readNullable(buf, in -> {
1845+
return in.readBoolean() ? GameProfile.TextureModel.SLIM : GameProfile.TextureModel.WIDE;
1846+
});
1847+
return new ResolvableProfile(profile, body, cape, elytra, model, dynamic);
18431848
}
18441849

18451850
public static void writeResolvableProfile(ByteBuf buf, ResolvableProfile profile) {
@@ -1849,36 +1854,11 @@ public static void writeResolvableProfile(ByteBuf buf, ResolvableProfile profile
18491854
} else {
18501855
MinecraftTypes.writeDynamicGameProfile(buf, profile.getProfile());
18511856
}
1852-
}
1853-
1854-
public static MannequinProfile.CustomProfile readCustomProfile(ByteBuf buf) {
1855-
Key texture = MinecraftTypes.readResourceLocation(buf);
1856-
Key capeTexture = MinecraftTypes.readNullable(buf, MinecraftTypes::readResourceLocation);
1857-
Key elytraTexture = MinecraftTypes.readNullable(buf, MinecraftTypes::readResourceLocation);
1858-
GameProfile.TextureModel model = buf.readBoolean() ? GameProfile.TextureModel.SLIM : GameProfile.TextureModel.WIDE;
1859-
return new MannequinProfile.CustomProfile(texture, capeTexture, elytraTexture, model);
1860-
}
1861-
1862-
public static void writeCustomProfile(ByteBuf buf, MannequinProfile.CustomProfile profile) {
1863-
MinecraftTypes.writeResourceLocation(buf, profile.getTexture());
1864-
MinecraftTypes.writeNullable(buf, profile.getCapeTexture(), MinecraftTypes::writeResourceLocation);
1865-
MinecraftTypes.writeNullable(buf, profile.getElytraTexture(), MinecraftTypes::writeResourceLocation);
1866-
buf.writeBoolean(profile.getModel() == GameProfile.TextureModel.SLIM);
1867-
}
1868-
1869-
public static MannequinProfile readMannequinProfile(ByteBuf buf) {
1870-
return buf.readBoolean()
1871-
? new MannequinProfile(MinecraftTypes.readCustomProfile(buf), null)
1872-
: new MannequinProfile(null, MinecraftTypes.readResolvableProfile(buf));
1873-
}
18741857

1875-
public static void writeMannequinProfile(ByteBuf buf, MannequinProfile profile) {
1876-
buf.writeBoolean(profile.getCustomProfile() != null);
1877-
if (profile.getCustomProfile() != null) {
1878-
MinecraftTypes.writeCustomProfile(buf, profile.getCustomProfile());
1879-
} else {
1880-
MinecraftTypes.writeResolvableProfile(buf, profile.getProfile());
1881-
}
1858+
MinecraftTypes.writeNullable(buf, profile.getBody(), MinecraftTypes::writeResourceLocation);
1859+
MinecraftTypes.writeNullable(buf, profile.getCape(), MinecraftTypes::writeResourceLocation);
1860+
MinecraftTypes.writeNullable(buf, profile.getElytra(), MinecraftTypes::writeResourceLocation);
1861+
MinecraftTypes.writeNullable(buf, profile.getModel(), (out, model) -> out.writeBoolean(model == GameProfile.TextureModel.SLIM));
18821862
}
18831863

18841864
public static GameProfile.Property readProperty(ByteBuf buf) {

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/metadata/MannequinProfile.java

Lines changed: 0 additions & 27 deletions
This file was deleted.

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/metadata/MetadataTypes.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.LongEntityMetadata;
1717
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ObjectEntityMetadata;
1818
import org.geysermc.mcprotocollib.protocol.data.game.entity.object.Direction;
19+
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.ResolvableProfile;
1920
import org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack;
2021
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.Particle;
2122

@@ -64,7 +65,7 @@ public class MetadataTypes {
6465
public static final MetadataType<WeatheringCopperState> WEATHERING_COPPER_STATE = register(id -> new MetadataType<>(id, MinecraftTypes::readWeatheringCopperState, MinecraftTypes::writeWeatheringCopperState, ObjectEntityMetadata::new));
6566
public static final MetadataType<Vector3f> VECTOR3 = register(id -> new MetadataType<>(id, MinecraftTypes::readRotation, MinecraftTypes::writeRotation, ObjectEntityMetadata::new));
6667
public static final MetadataType<Quaternionf> QUATERNION = register(id -> new MetadataType<>(id, MinecraftTypes::readQuaternion, MinecraftTypes::writeQuaternion, ObjectEntityMetadata::new));
67-
public static final MetadataType<MannequinProfile> MANNEQUIN_PROFILE = register(id -> new MetadataType<>(id, MinecraftTypes::readMannequinProfile, MinecraftTypes::writeMannequinProfile, ObjectEntityMetadata::new));
68+
public static final MetadataType<ResolvableProfile> RESOLVABLE_PROFILE = register(id -> new MetadataType<>(id, MinecraftTypes::readResolvableProfile, MinecraftTypes::writeResolvableProfile, ObjectEntityMetadata::new));
6869

6970
public static <T extends MetadataType<?>> T register(Int2ObjectFunction<T> factory) {
7071
T value = factory.apply(VALUES.size());

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/entity/player/ResolvableProfile.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
import lombok.AllArgsConstructor;
44
import lombok.Data;
55
import lombok.With;
6+
import net.kyori.adventure.key.Key;
67
import org.geysermc.mcprotocollib.auth.GameProfile;
8+
import org.jetbrains.annotations.Nullable;
79

810
@Data
911
@With
1012
@AllArgsConstructor
1113
public class ResolvableProfile {
1214
private final GameProfile profile;
15+
private final @Nullable Key body;
16+
private final @Nullable Key cape;
17+
private final @Nullable Key elytra;
18+
private final @Nullable GameProfile.TextureModel model;
1319
private final boolean dynamic;
1420
}

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/packet/ingame/clientbound/level/ClientboundSetDefaultSpawnPositionPacket.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,30 @@
33
import io.netty.buffer.ByteBuf;
44
import lombok.AllArgsConstructor;
55
import lombok.Data;
6-
import lombok.NonNull;
76
import lombok.With;
8-
import org.cloudburstmc.math.vector.Vector3i;
97
import org.geysermc.mcprotocollib.protocol.codec.MinecraftPacket;
108
import org.geysermc.mcprotocollib.protocol.codec.MinecraftTypes;
9+
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.GlobalPos;
1110

1211
@Data
1312
@With
1413
@AllArgsConstructor
1514
public class ClientboundSetDefaultSpawnPositionPacket implements MinecraftPacket {
16-
private final @NonNull Vector3i position;
17-
private final float angle;
15+
private final GlobalPos globalPos;
16+
private final float yaw;
17+
private final float pitch;
1818

1919
public ClientboundSetDefaultSpawnPositionPacket(ByteBuf in) {
20-
this.position = MinecraftTypes.readPosition(in);
21-
this.angle = in.readFloat();
20+
this.globalPos = MinecraftTypes.readGlobalPos(in);
21+
this.yaw = in.readFloat();
22+
this.pitch = in.readFloat();
2223
}
2324

2425
@Override
2526
public void serialize(ByteBuf out) {
26-
MinecraftTypes.writePosition(out, this.position);
27-
out.writeFloat(this.angle);
27+
MinecraftTypes.writeGlobalPos(out, this.globalPos);
28+
out.writeFloat(this.yaw);
29+
out.writeFloat(this.pitch);
2830
}
2931

3032
@Override

0 commit comments

Comments
 (0)