mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 10:05:12 +01:00
Merge branch 'master' into dev
# Conflicts: # common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/packets/EntityPackets.java # common/src/main/java/com/viaversion/viaversion/rewriter/EntityRewriter.java # gradle/libs.versions.toml
This commit is contained in:
commit
b426302e76
@ -98,13 +98,13 @@ public class MappingDataBase implements MappingData {
|
||||
particleMappings = new IdentityMappings(unmappedParticles.size(), mappedParticles.size());
|
||||
}
|
||||
|
||||
final List<String> identifiers = unmappedParticles.getValue().stream().map(t -> (String) t.getValue()).collect(Collectors.toList());
|
||||
final List<String> mappedIdentifiers = mappedParticles.getValue().stream().map(t -> (String) t.getValue()).collect(Collectors.toList());
|
||||
final List<String> identifiers = unmappedParticles.stream().map(StringTag::getValue).collect(Collectors.toList());
|
||||
final List<String> mappedIdentifiers = mappedParticles.stream().map(StringTag::getValue).collect(Collectors.toList());
|
||||
this.particleMappings = new ParticleMappings(identifiers, mappedIdentifiers, particleMappings);
|
||||
}
|
||||
}
|
||||
|
||||
final CompoundTag tagsTag = data.get("tags");
|
||||
final CompoundTag tagsTag = data.getCompoundTag("tags");
|
||||
if (tagsTag != null) {
|
||||
this.tags = new EnumMap<>(RegistryType.class);
|
||||
loadTags(RegistryType.ITEM, tagsTag);
|
||||
@ -132,7 +132,7 @@ public class MappingDataBase implements MappingData {
|
||||
}
|
||||
|
||||
private void loadTags(final RegistryType type, final CompoundTag data) {
|
||||
final CompoundTag tag = data.get(type.resourceLocation());
|
||||
final CompoundTag tag = data.getCompoundTag(type.resourceLocation());
|
||||
if (tag == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -158,22 +158,22 @@ public final class MappingDataLoader {
|
||||
final AddConsumer<V> addConsumer,
|
||||
final MappingsSupplier<M, V> mappingsSupplier
|
||||
) {
|
||||
final CompoundTag tag = mappingsTag.get(key);
|
||||
final CompoundTag tag = mappingsTag.getCompoundTag(key);
|
||||
if (tag == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final ByteTag serializationStragetyTag = tag.get("id");
|
||||
final IntTag mappedSizeTag = tag.get("mappedSize");
|
||||
final ByteTag serializationStragetyTag = tag.getUnchecked("id");
|
||||
final IntTag mappedSizeTag = tag.getUnchecked("mappedSize");
|
||||
final byte strategy = serializationStragetyTag.asByte();
|
||||
final V mappings;
|
||||
if (strategy == DIRECT_ID) {
|
||||
final IntArrayTag valuesTag = tag.get("val");
|
||||
final IntArrayTag valuesTag = tag.getIntArrayTag("val");
|
||||
return IntArrayMappings.of(valuesTag.getValue(), mappedSizeTag.asInt());
|
||||
} else if (strategy == SHIFTS_ID) {
|
||||
final IntArrayTag shiftsAtTag = tag.get("at");
|
||||
final IntArrayTag shiftsTag = tag.get("to");
|
||||
final IntTag sizeTag = tag.get("size");
|
||||
final IntArrayTag shiftsAtTag = tag.getIntArrayTag("at");
|
||||
final IntArrayTag shiftsTag = tag.getIntArrayTag("to");
|
||||
final IntTag sizeTag = tag.getUnchecked("size");
|
||||
final int[] shiftsAt = shiftsAtTag.getValue();
|
||||
final int[] shiftsTo = shiftsTag.getValue();
|
||||
final int size = sizeTag.asInt();
|
||||
@ -197,9 +197,9 @@ public final class MappingDataLoader {
|
||||
}
|
||||
}
|
||||
} else if (strategy == CHANGES_ID) {
|
||||
final IntArrayTag changesAtTag = tag.get("at");
|
||||
final IntArrayTag valuesTag = tag.get("val");
|
||||
final IntTag sizeTag = tag.get("size");
|
||||
final IntArrayTag changesAtTag = tag.getIntArrayTag("at");
|
||||
final IntArrayTag valuesTag = tag.getIntArrayTag("val");
|
||||
final IntTag sizeTag = tag.getUnchecked("size");
|
||||
final boolean fillBetween = tag.get("nofill") == null;
|
||||
final int[] changesAt = changesAtTag.getValue();
|
||||
final int[] values = valuesTag.getValue();
|
||||
@ -219,7 +219,7 @@ public final class MappingDataLoader {
|
||||
addConsumer.addTo(mappings, id, values[i]);
|
||||
}
|
||||
} else if (strategy == IDENTITY_ID) {
|
||||
final IntTag sizeTag = tag.get("size");
|
||||
final IntTag sizeTag = tag.getUnchecked("size");
|
||||
return new IdentityMappings(sizeTag.asInt(), mappedSizeTag.asInt());
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown serialization strategy: " + strategy);
|
||||
@ -240,8 +240,8 @@ public final class MappingDataLoader {
|
||||
}
|
||||
|
||||
return new FullMappingsBase(
|
||||
unmappedElements.getValue().stream().map(StringTag::getValue).collect(Collectors.toList()),
|
||||
mappedElements.getValue().stream().map(StringTag::getValue).collect(Collectors.toList()),
|
||||
unmappedElements.stream().map(StringTag::getValue).collect(Collectors.toList()),
|
||||
mappedElements.stream().map(StringTag::getValue).collect(Collectors.toList()),
|
||||
mappings
|
||||
);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class WorldPackets {
|
||||
UUID targetUuid = UUID.fromString((String) targetUuidTag.getValue());
|
||||
compoundTag.put("Target", new IntArrayTag(UUIDUtil.toIntArray(targetUuid)));
|
||||
} else if (id.equals("minecraft:skull") && compoundTag.getCompoundTag("Owner") != null) {
|
||||
CompoundTag ownerTag = compoundTag.remove("Owner");
|
||||
CompoundTag ownerTag = compoundTag.removeUnchecked("Owner");
|
||||
Tag ownerUuidTag = ownerTag.remove("Id");
|
||||
if (ownerUuidTag instanceof StringTag) {
|
||||
UUID ownerUuid = UUID.fromString(((StringTag) ownerUuidTag).getValue());
|
||||
|
@ -77,10 +77,10 @@ public final class EntityPackets extends EntityRewriter<ClientboundPackets1_16_2
|
||||
map(Type.NAMED_COMPOUND_TAG); // Current dimension
|
||||
handler(wrapper -> {
|
||||
// Add new dimension fields
|
||||
CompoundTag dimensionRegistry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0).get("minecraft:dimension_type");
|
||||
CompoundTag dimensionRegistry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0).getCompoundTag("minecraft:dimension_type");
|
||||
ListTag<CompoundTag> dimensions = dimensionRegistry.getListTag("value", CompoundTag.class);
|
||||
for (CompoundTag dimension : dimensions) {
|
||||
CompoundTag dimensionCompound = dimension.get("element");
|
||||
CompoundTag dimensionCompound = dimension.getCompoundTag("element");
|
||||
addNewDimensionData(dimensionCompound);
|
||||
}
|
||||
|
||||
|
@ -69,10 +69,10 @@ public final class Protocol1_18_2To1_18 extends AbstractProtocol<ClientboundPack
|
||||
map(Type.NAMED_COMPOUND_TAG); // Current dimension data
|
||||
handler(wrapper -> {
|
||||
final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
|
||||
final CompoundTag dimensionsHolder = registry.get("minecraft:dimension_type");
|
||||
final CompoundTag dimensionsHolder = registry.getCompoundTag("minecraft:dimension_type");
|
||||
final ListTag<CompoundTag> dimensions = dimensionsHolder.getListTag("value", CompoundTag.class);
|
||||
for (final CompoundTag dimension : dimensions) {
|
||||
addTagPrefix(dimension.get("element"));
|
||||
addTagPrefix(dimension.getCompoundTag("element"));
|
||||
}
|
||||
|
||||
addTagPrefix(wrapper.get(Type.NAMED_COMPOUND_TAG, 1));
|
||||
|
@ -88,7 +88,7 @@ public final class Protocol1_19_1To1_19 extends AbstractProtocol<ClientboundPack
|
||||
private static final CompoundTag CHAT_REGISTRY;
|
||||
|
||||
static {
|
||||
CHAT_REGISTRY = SNBT.deserializeCompoundTag(CHAT_REGISTRY_SNBT).get("minecraft:chat_type");
|
||||
CHAT_REGISTRY = SNBT.deserializeCompoundTag(CHAT_REGISTRY_SNBT).getCompoundTag("minecraft:chat_type");
|
||||
}
|
||||
|
||||
public Protocol1_19_1To1_19() {
|
||||
@ -224,7 +224,7 @@ public final class Protocol1_19_1To1_19 extends AbstractProtocol<ClientboundPack
|
||||
final CompoundTag registry = wrapper.passthrough(Type.NAMED_COMPOUND_TAG);
|
||||
final ListTag<CompoundTag> chatTypes = registry.getCompoundTag("minecraft:chat_type").getListTag("value", CompoundTag.class);
|
||||
for (final CompoundTag chatType : chatTypes) {
|
||||
final NumberTag idTag = chatType.get("id");
|
||||
final NumberTag idTag = chatType.getNumberTag("id");
|
||||
chatTypeStorage.addChatType(idTag.asInt(), chatType);
|
||||
}
|
||||
|
||||
|
@ -63,11 +63,11 @@ public final class EntityPackets extends EntityRewriter<ClientboundPackets1_19_3
|
||||
final CompoundTag damageTypeRegistry = protocol.getMappingData().damageTypesRegistry();
|
||||
registry.put("minecraft:damage_type", damageTypeRegistry);
|
||||
|
||||
final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
|
||||
final CompoundTag biomeRegistry = registry.getCompoundTag("minecraft:worldgen/biome");
|
||||
final ListTag<CompoundTag> biomes = biomeRegistry.getListTag("value", CompoundTag.class);
|
||||
for (final CompoundTag biomeTag : biomes) {
|
||||
final CompoundTag biomeData = biomeTag.get("element");
|
||||
final StringTag precipitation = biomeData.get("precipitation");
|
||||
final CompoundTag biomeData = biomeTag.getCompoundTag("element");
|
||||
final StringTag precipitation = biomeData.getStringTag("precipitation");
|
||||
final byte precipitationByte = precipitation.getValue().equals("none") ? (byte) 0 : 1;
|
||||
biomeData.put("has_precipitation", new ByteTag(precipitationByte));
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public final class MappingData extends MappingDataBase {
|
||||
protected void loadExtras(final CompoundTag daata) {
|
||||
final ListTag<CompoundTag> chatTypes = MappingDataLoader.loadNBTFromFile("chat-types-1.19.nbt").getListTag("values", CompoundTag.class);
|
||||
for (final CompoundTag chatType : chatTypes) {
|
||||
final NumberTag idTag = chatType.get("id");
|
||||
final NumberTag idTag = chatType.getNumberTag("id");
|
||||
defaultChatTypes.put(idTag.asInt(), chatType);
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public final class EntityPackets extends EntityRewriter<ClientboundPackets1_18,
|
||||
public static final CompoundTag CHAT_REGISTRY;
|
||||
|
||||
static {
|
||||
CHAT_REGISTRY = SNBT.deserializeCompoundTag(CHAT_REGISTRY_SNBT).get("minecraft:chat_type");
|
||||
CHAT_REGISTRY = SNBT.deserializeCompoundTag(CHAT_REGISTRY_SNBT).getCompoundTag("minecraft:chat_type");
|
||||
}
|
||||
|
||||
public EntityPackets(final Protocol1_19To1_18_2 protocol) {
|
||||
@ -214,8 +214,8 @@ public final class EntityPackets extends EntityRewriter<ClientboundPackets1_18,
|
||||
final Map<String, DimensionData> dimensionDataMap = new HashMap<>(dimensions.size());
|
||||
final Map<CompoundTag, String> dimensionsMap = new HashMap<>(dimensions.size());
|
||||
for (final CompoundTag dimension : dimensions) {
|
||||
final NumberTag idTag = dimension.get("id");
|
||||
final CompoundTag element = dimension.get("element");
|
||||
final NumberTag idTag = dimension.getNumberTag("id");
|
||||
final CompoundTag element = dimension.getCompoundTag("element");
|
||||
final String name = dimension.getStringTag("name").getValue();
|
||||
addMonsterSpawnData(element);
|
||||
dimensionDataMap.put(Key.stripMinecraftNamespace(name), new DimensionDataImpl(idTag.asInt(), element));
|
||||
|
@ -76,11 +76,11 @@ public final class EntityPackets extends EntityRewriter<ClientboundPackets1_19_4
|
||||
handler(worldDataTrackerHandlerByKey()); // Tracks world height and name for chunk data and entity (un)tracking
|
||||
handler(wrapper -> {
|
||||
final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
|
||||
final CompoundTag damageTypeRegistry = registry.get("minecraft:damage_type");
|
||||
final ListTag<CompoundTag> damageTypes = damageTypeRegistry.get("value");
|
||||
final CompoundTag damageTypeRegistry = registry.getCompoundTag("minecraft:damage_type");
|
||||
final ListTag<CompoundTag> damageTypes = damageTypeRegistry.getListTag("value", CompoundTag.class);
|
||||
int highestId = -1;
|
||||
for (final CompoundTag damageType : damageTypes) {
|
||||
final IntTag id = damageType.get("id");
|
||||
final IntTag id = damageType.getUnchecked("id");
|
||||
highestId = Math.max(highestId, id.asInt());
|
||||
}
|
||||
|
||||
|
@ -172,15 +172,15 @@ public final class InventoryPackets extends ItemRewriter<ClientboundPackets1_19_
|
||||
|
||||
final ListTag<StringTag> messages = new ListTag<>(StringTag.class);
|
||||
for (int i = 1; i < 5; i++) {
|
||||
final StringTag text = tag.remove("Text" + i);
|
||||
messages.add(text != null ? text : new StringTag(ComponentUtil.emptyJsonComponentString()));
|
||||
final Tag text = tag.remove("Text" + i);
|
||||
messages.add(text instanceof StringTag ? (StringTag) text : new StringTag(ComponentUtil.emptyJsonComponentString()));
|
||||
}
|
||||
frontText.put("messages", messages);
|
||||
|
||||
final ListTag<StringTag> filteredMessages = new ListTag<>(StringTag.class);
|
||||
for (int i = 1; i < 5; i++) {
|
||||
final StringTag text = tag.remove("FilteredText" + i);
|
||||
filteredMessages.add(text != null ? text : messages.get(i - 1));
|
||||
final Tag text = tag.remove("FilteredText" + i);
|
||||
filteredMessages.add(text instanceof StringTag ? (StringTag) text : messages.get(i - 1));
|
||||
}
|
||||
if (!filteredMessages.equals(messages)) {
|
||||
frontText.put("filtered_messages", filteredMessages);
|
||||
|
@ -474,8 +474,8 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
|
||||
}
|
||||
|
||||
public void trackBiomeSize(final UserConnection connection, final CompoundTag registry) {
|
||||
final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
|
||||
final ListTag<?> biomes = biomeRegistry.get("value");
|
||||
final CompoundTag biomeRegistry = registry.getCompoundTag("minecraft:worldgen/biome");
|
||||
final ListTag<?> biomes = biomeRegistry.getListTag("value");
|
||||
tracker(connection).setBiomesSent(biomes.size());
|
||||
}
|
||||
|
||||
@ -494,8 +494,8 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
|
||||
final ListTag<CompoundTag> dimensions = registry.getCompoundTag("minecraft:dimension_type").getListTag("value", CompoundTag.class);
|
||||
final Map<String, DimensionData> dimensionDataMap = new HashMap<>(dimensions.size());
|
||||
for (final CompoundTag dimension : dimensions) {
|
||||
final NumberTag idTag = dimension.get("id");
|
||||
final CompoundTag element = dimension.get("element");
|
||||
final NumberTag idTag = dimension.getNumberTag("id");
|
||||
final CompoundTag element = dimension.getCompoundTag("element");
|
||||
final String name = dimension.getStringTag("name").getValue();
|
||||
dimensionDataMap.put(Key.stripMinecraftNamespace(name), new DimensionDataImpl(idTag.asInt(), element));
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ metadata.format.version = "1.1"
|
||||
|
||||
gson = "2.10.1"
|
||||
fastutil = "8.5.12"
|
||||
vianbt = "4.4.0"
|
||||
vianbt = "4.4.2"
|
||||
mcstructs = "2.4.2"
|
||||
|
||||
# Common provided
|
||||
|
Loading…
Reference in New Issue
Block a user