This commit is contained in:
basaigh 2024-03-30 20:47:22 +00:00
parent 5ca54dc2e4
commit d1350b303d
7 changed files with 15 additions and 12 deletions

View file

@ -220,9 +220,9 @@ public class MinecraftCodec {
}
public static final PacketCodec CODEC = PacketCodec.builder()
.protocolVersion((1 << 30) | 178)
.protocolVersion((1 << 30) | 179)
.helper(() -> new MinecraftCodecHelper(LEVEL_EVENTS, SOUND_NAMES))
.minecraftVersion("24w09a")
.minecraftVersion("24w10a")
.state(ProtocolState.HANDSHAKE, PacketStateCodec.builder()
.registerServerboundPacket(ClientIntentionPacket.class, ClientIntentionPacket::new)
)

View file

@ -35,6 +35,7 @@ public enum CommandParser {
SWIZZLE,
TEAM,
ITEM_SLOT,
ITEM_SLOTS,
RESOURCE_LOCATION,
FUNCTION,
ENTITY_ANCHOR,

View file

@ -51,6 +51,7 @@ public class MetadataType<T> {
public static final OptionalIntMetadataType OPTIONAL_VARINT = new OptionalIntMetadataType(ObjectEntityMetadata::new);
public static final MetadataType<Pose> POSE = new MetadataType<>(MinecraftCodecHelper::readPose, MinecraftCodecHelper::writePose, ObjectEntityMetadata::new);
public static final IntMetadataType CAT_VARIANT = new IntMetadataType(MinecraftCodecHelper::readVarInt, MinecraftCodecHelper::writeVarInt, IntEntityMetadata::new);
public static final IntMetadataType WOLF_VARIANT = new IntMetadataType(MinecraftCodecHelper::readVarInt, MinecraftCodecHelper::writeVarInt, IntEntityMetadata::new);
public static final IntMetadataType FROG_VARIANT = new IntMetadataType(MinecraftCodecHelper::readVarInt, MinecraftCodecHelper::writeVarInt, IntEntityMetadata::new);
public static final MetadataType<Optional<GlobalPos>> OPTIONAL_GLOBAL_POS = new MetadataType<>(optionalReader(MinecraftCodecHelper::readGlobalPos), optionalWriter(MinecraftCodecHelper::writeGlobalPos), ObjectEntityMetadata::new);
public static final MetadataType<PaintingType> PAINTING_VARIANT = new MetadataType<>(MinecraftCodecHelper::readPaintingType, MinecraftCodecHelper::writePaintingType, ObjectEntityMetadata::new);

View file

@ -53,7 +53,7 @@ public class DataComponentType<T> {
public static final DataComponentType<CompoundTag> BLOCK_ENTITY_DATA = new DataComponentType<>(ItemCodecHelper::readAnyTag, ItemCodecHelper::writeAnyTag, ObjectDataComponent::new);
public static final DataComponentType<Instrument> INSTRUMENT = new DataComponentType<>(ItemCodecHelper::readInstrument, ItemCodecHelper::writeInstrument, ObjectDataComponent::new);
public static final DataComponentType<CompoundTag> RECIPES = new DataComponentType<>(ItemCodecHelper::readAnyTag, ItemCodecHelper::writeAnyTag, ObjectDataComponent::new);
public static final DataComponentType<LodestoneTarget> LODESTONE_TARGET = new DataComponentType<>(ItemCodecHelper::readLodestoneTarget, ItemCodecHelper::writeLodestoneTarget, ObjectDataComponent::new);
public static final DataComponentType<LodestoneTracker> LODESTONE_TRACKER = new DataComponentType<>(ItemCodecHelper::readLodestoneTarget, ItemCodecHelper::writeLodestoneTarget, ObjectDataComponent::new);
public static final DataComponentType<Fireworks.FireworkExplosion> FIREWORK_EXPLOSION = new DataComponentType<>(ItemCodecHelper::readFireworkExplosion, ItemCodecHelper::writeFireworkExplosion, ObjectDataComponent::new);
public static final DataComponentType<Fireworks> FIREWORKS = new DataComponentType<>(ItemCodecHelper::readFireworks, ItemCodecHelper::writeFireworks, ObjectDataComponent::new);
public static final DataComponentType<GameProfile> PROFILE = new DataComponentType<>(ItemCodecHelper::readResolvableProfile, ItemCodecHelper::writeResolvableProfile, ObjectDataComponent::new);

View file

@ -402,12 +402,12 @@ public class ItemCodecHelper extends MinecraftCodecHelper {
}
}
public LodestoneTarget readLodestoneTarget(ByteBuf buf) {
return new LodestoneTarget(this.readGlobalPos(buf), buf.readBoolean());
public LodestoneTracker readLodestoneTarget(ByteBuf buf) {
return new LodestoneTracker(this.readNullable(buf, this::readGlobalPos), buf.readBoolean());
}
public void writeLodestoneTarget(ByteBuf buf, LodestoneTarget target) {
this.writeGlobalPos(buf, target.getPos());
public void writeLodestoneTarget(ByteBuf buf, LodestoneTracker target) {
this.writeNullable(buf, target.getPos(), this::writeGlobalPos);
buf.writeBoolean(target.isTracked());
}
@ -468,7 +468,7 @@ public class ItemCodecHelper extends MinecraftCodecHelper {
}
public GameProfile readResolvableProfile(ByteBuf buf) {
String name = this.readString(buf);
String name = this.readNullable(buf, this::readString);
UUID id = this.readNullable(buf, this::readUUID);
GameProfile profile = new GameProfile(id, name);
@ -483,8 +483,8 @@ public class ItemCodecHelper extends MinecraftCodecHelper {
}
public void writeResolvableProfile(ByteBuf buf, GameProfile profile) {
this.writeString(buf, profile.getName());
this.writeUUID(buf, profile.getId());
this.writeNullable(buf, profile.getName(), this::writeString);
this.writeNullable(buf, profile.getId(), this::writeUUID);
this.writeVarInt(buf, profile.getProperties().size());
for (GameProfile.Property property : profile.getProperties()) {

View file

@ -3,10 +3,11 @@ package com.github.steveice10.mc.protocol.data.game.item.component;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.GlobalPos;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.jetbrains.annotations.Nullable;
@Data
@AllArgsConstructor
public class LodestoneTarget {
private final GlobalPos pos;
public class LodestoneTracker {
private final @Nullable GlobalPos pos;
private final boolean tracked;
}

Binary file not shown.