Skip to content

Commit f5d2a77

Browse files
committed
Add some missing changes from 25w03/4a
1 parent 75a74b5 commit f5d2a77

File tree

6 files changed

+8
-80
lines changed

6 files changed

+8
-80
lines changed

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

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,9 @@
4545
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.MetadataType;
4646
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.MetadataTypes;
4747
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.PaintingVariant;
48-
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.PigVariant;
4948
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.Pose;
5049
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.SnifferState;
5150
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.VillagerData;
52-
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.WolfVariant;
5351
import org.geysermc.mcprotocollib.protocol.data.game.entity.object.Direction;
5452
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.BlockBreakStage;
5553
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode;
@@ -611,61 +609,6 @@ public static void writePose(ByteBuf buf, Pose pose) {
611609
MinecraftTypes.writeEnum(buf, pose);
612610
}
613611

614-
public static Holder<WolfVariant> readWolfVariant(ByteBuf buf) {
615-
return MinecraftTypes.readHolder(buf, input -> {
616-
Key wildTexture = MinecraftTypes.readResourceLocation(input);
617-
Key tameTexture = MinecraftTypes.readResourceLocation(input);
618-
Key angryTexture = MinecraftTypes.readResourceLocation(input);
619-
Key biomeLocation = null;
620-
int[] biomeHolders = null;
621-
622-
int length = MinecraftTypes.readVarInt(input) - 1;
623-
if (length == -1) {
624-
biomeLocation = MinecraftTypes.readResourceLocation(input);
625-
} else {
626-
biomeHolders = new int[length];
627-
for (int j = 0; j < length; j++) {
628-
biomeHolders[j] = MinecraftTypes.readVarInt(input);
629-
}
630-
}
631-
return new WolfVariant(wildTexture, tameTexture, angryTexture, biomeLocation, biomeHolders);
632-
});
633-
}
634-
635-
public static void writeWolfVariant(ByteBuf buf, Holder<WolfVariant> variantHolder) {
636-
MinecraftTypes.writeHolder(buf, variantHolder, (output, variant) -> {
637-
MinecraftTypes.writeResourceLocation(output, variant.wildTexture());
638-
MinecraftTypes.writeResourceLocation(output, variant.tameTexture());
639-
MinecraftTypes.writeResourceLocation(output, variant.angryTexture());
640-
if (variant.biomeLocation() != null) {
641-
MinecraftTypes.writeVarInt(output, 0);
642-
MinecraftTypes.writeResourceLocation(output, variant.biomeLocation());
643-
} else {
644-
MinecraftTypes.writeVarInt(output, variant.biomeHolders().length + 1);
645-
for (int holder : variant.biomeHolders()) {
646-
MinecraftTypes.writeVarInt(output, holder);
647-
}
648-
}
649-
});
650-
}
651-
652-
public static Holder<PigVariant> readPigVariant(ByteBuf buf) {
653-
return MinecraftTypes.readHolder(buf, input -> {
654-
int modelId = MinecraftTypes.readVarInt(input);
655-
Key texture = MinecraftTypes.readResourceLocation(input);
656-
HolderSet biomes = MinecraftTypes.readNullable(input, MinecraftTypes::readHolderSet);
657-
return new PigVariant(modelId, texture, biomes);
658-
});
659-
}
660-
661-
public static void writePigVariant(ByteBuf buf, Holder<PigVariant> variantHolder) {
662-
MinecraftTypes.writeHolder(buf, variantHolder, (output, variant) -> {
663-
MinecraftTypes.writeVarInt(buf, variant.modelId());
664-
MinecraftTypes.writeResourceLocation(buf, variant.texture());
665-
MinecraftTypes.writeNullable(buf, variant.biomes(), MinecraftTypes::writeHolderSet);
666-
});
667-
}
668-
669612
public static Holder<Key> readChickenVariant(ByteBuf buf) {
670613
if (buf.readBoolean()) {
671614
return Holder.ofId(MinecraftTypes.readVarInt(buf));

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ public enum EquipmentSlot {
77
LEGGINGS,
88
CHESTPLATE,
99
HELMET,
10-
BODY;
10+
BODY,
11+
SADDLE;
1112

1213
private static final EquipmentSlot[] VALUES = values();
1314

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
public class MetadataTypes {
3030
private static final List<MetadataType<?>> VALUES = new ArrayList<>();
3131

32+
// TODO: check all types before release
3233
public static final ByteMetadataType BYTE = register(id -> new ByteMetadataType(id, ByteBuf::readByte, ByteBuf::writeByte, ByteEntityMetadata::new));
3334
public static final IntMetadataType INT = register(id -> new IntMetadataType(id, MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntEntityMetadata::new));
3435
public static final LongMetadataType LONG = register(id -> new LongMetadataType(id, MinecraftTypes::readVarLong, MinecraftTypes::writeVarLong, LongEntityMetadata::new));
@@ -54,9 +55,9 @@ public class MetadataTypes {
5455
public static final IntMetadataType CAT_VARIANT = register(id -> new IntMetadataType(id, MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntEntityMetadata::new));
5556
public static final IntMetadataType CHICKEN_VARIANT = register(id -> new IntMetadataType(id, MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntEntityMetadata::new));
5657
public static final IntMetadataType COW_VARIANT = register(id -> new IntMetadataType(id, MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntEntityMetadata::new));
57-
public static final MetadataType<Holder<WolfVariant>> WOLF_VARIANT = register(id -> new MetadataType<>(id, MinecraftTypes::readWolfVariant, MinecraftTypes::writeWolfVariant, ObjectEntityMetadata::new));
58+
public static final IntMetadataType WOLF_VARIANT = register(id -> new IntMetadataType(id, MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntEntityMetadata::new));
5859
public static final IntMetadataType FROG_VARIANT = register(id -> new IntMetadataType(id, MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntEntityMetadata::new));
59-
public static final MetadataType<Holder<PigVariant>> PIG_VARIANT = register(id -> new MetadataType<>(id, MinecraftTypes::readPigVariant, MinecraftTypes::writePigVariant, ObjectEntityMetadata::new));
60+
public static final IntMetadataType PIG_VARIANT = register(id -> new IntMetadataType(id, MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntEntityMetadata::new));
6061
public static final MetadataType<Optional<GlobalPos>> OPTIONAL_GLOBAL_POS = register(id -> new MetadataType<>(id, optionalReader(MinecraftTypes::readGlobalPos), optionalWriter(MinecraftTypes::writeGlobalPos), ObjectEntityMetadata::new));
6162
public static final MetadataType<Holder<PaintingVariant>> PAINTING_VARIANT = register(id -> new MetadataType<>(id, MinecraftTypes::readPaintingVariant, MinecraftTypes::writePaintingVariant, ObjectEntityMetadata::new));
6263
public static final MetadataType<SnifferState> SNIFFER_STATE = register(id -> new MetadataType<>(id, MinecraftTypes::readSnifferState, MinecraftTypes::writeSnifferState, ObjectEntityMetadata::new));

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

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

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

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

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/DataComponentTypes.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
import org.geysermc.mcprotocollib.protocol.codec.MinecraftTypes;
1212
import org.geysermc.mcprotocollib.protocol.data.game.Holder;
1313
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.PaintingVariant;
14-
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.PigVariant;
15-
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.WolfVariant;
1614
import org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack;
1715
import org.geysermc.mcprotocollib.protocol.data.game.item.component.type.BooleanDataComponent;
1816
import org.geysermc.mcprotocollib.protocol.data.game.item.component.type.IntDataComponent;
@@ -26,6 +24,7 @@
2624
public class DataComponentTypes {
2725
private static final List<DataComponentType<?>> VALUES = new ArrayList<>();
2826

27+
// TODO: check all types before release
2928
public static final DataComponentType<NbtMap> CUSTOM_DATA = register(id -> new DataComponentType<>(id, "custom_data", MinecraftTypes::readCompoundTag, MinecraftTypes::writeAnyTag, ObjectDataComponent::new));
3029
public static final IntComponentType MAX_STACK_SIZE = register(id -> new IntComponentType(id, "max_stack_size", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
3130
public static final IntComponentType MAX_DAMAGE = register(id -> new IntComponentType(id, "max_damage", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
@@ -99,7 +98,7 @@ public class DataComponentTypes {
9998
public static final DataComponentType<NbtMap> CONTAINER_LOOT = register(id -> new DataComponentType<>(id, "container_loot", MinecraftTypes::readCompoundTag, MinecraftTypes::writeAnyTag, ObjectDataComponent::new));
10099
public static final DataComponentType<Sound> BREAK_SOUND = register(id -> new DataComponentType<>(id, "break_sound", MinecraftTypes::readSound, MinecraftTypes::writeSound, ObjectDataComponent::new));
101100
public static final IntComponentType VILLAGER_VARIANT = register(id -> new IntComponentType(id, "villager/variant", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
102-
public static final DataComponentType<Holder<WolfVariant>> WOLF_VARIANT = register(id -> new DataComponentType<>(id, "wolf/variant", MinecraftTypes::readWolfVariant, MinecraftTypes::writeWolfVariant, ObjectDataComponent::new));
101+
public static final IntComponentType WOLF_VARIANT = register(id -> new IntComponentType(id, "wolf/variant", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
103102
public static final IntComponentType WOLF_COLLAR = register(id -> new IntComponentType(id, "wolf/collar", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
104103
public static final IntComponentType FOX_VARIANT = register(id -> new IntComponentType(id, "fox/variant", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
105104
public static final IntComponentType SALMON_SIZE = register(id -> new IntComponentType(id, "salmon/size", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
@@ -109,7 +108,7 @@ public class DataComponentTypes {
109108
public static final IntComponentType TROPICAL_FISH_PATTERN_COLOR = register(id -> new IntComponentType(id, "tropical_fish/pattern_color", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
110109
public static final IntComponentType MOOSHROOM_VARIANT = register(id -> new IntComponentType(id, "mooshroom/variant", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
111110
public static final IntComponentType RABBIT_VARIANT = register(id -> new IntComponentType(id, "rabbit/variant", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
112-
public static final DataComponentType<Holder<PigVariant>> PIG_VARIANT = register(id -> new DataComponentType<>(id, "pig/variant", MinecraftTypes::readPigVariant, MinecraftTypes::writePigVariant, ObjectDataComponent::new));
111+
public static final IntComponentType PIG_VARIANT = register(id -> new IntComponentType(id, "pig/variant", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
113112
public static final IntComponentType COW_VARIANT = register(id -> new IntComponentType(id, "cow/variant", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
114113
public static final DataComponentType<Holder<Key>> CHICKEN_VARIANT = register(id -> new DataComponentType<>(id, "chicken/variant", MinecraftTypes::readChickenVariant, MinecraftTypes::writeChickenVariant, ObjectDataComponent::new));
115114
public static final IntComponentType FROG_VARIANT = register(id -> new IntComponentType(id, "frog/variant", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));

0 commit comments

Comments
 (0)