mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-18 16:17:45 +01:00
parent
87d05ae487
commit
6a766f2467
@ -69,7 +69,7 @@ import java.util.logging.Logger;
|
||||
|
||||
public interface ViaBackwardsPlatform {
|
||||
|
||||
String MINIMUM_VV_VERSION = "5.0.2";
|
||||
String MINIMUM_VV_VERSION = "5.0.3";
|
||||
|
||||
/**
|
||||
* Initialize ViaBackwards.
|
||||
|
@ -54,6 +54,7 @@ import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPac
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundConfigurationPackets1_20_5;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPacket1_20_5;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPackets1_20_5;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.storage.ArmorTrimStorage;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.storage.BannerPatternStorage;
|
||||
import com.viaversion.viaversion.protocols.v1_20to1_20_2.packet.ServerboundConfigurationPackets1_20_2;
|
||||
import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType;
|
||||
@ -233,6 +234,7 @@ public final class Protocol1_20_5To1_20_3 extends BackwardsProtocol<ClientboundP
|
||||
user.put(new CookieStorage());
|
||||
user.put(new RegistryDataStorage());
|
||||
user.put(new BannerPatternStorage());
|
||||
user.put(new ArmorTrimStorage());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -274,4 +276,4 @@ public final class Protocol1_20_5To1_20_3 extends BackwardsProtocol<ClientboundP
|
||||
packetTypeMap(unmappedServerboundPacketType, ServerboundPackets1_20_3.class, ServerboundConfigurationPackets1_20_2.class)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.data.Attributes1_20_5
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundConfigurationPackets1_20_5;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPacket1_20_5;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPackets1_20_5;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.storage.ArmorTrimStorage;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.storage.BannerPatternStorage;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
import com.viaversion.viaversion.util.KeyMappings;
|
||||
@ -110,16 +111,21 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
|
||||
final RegistryDataStorage registryDataStorage = wrapper.user().get(RegistryDataStorage.class);
|
||||
final RegistryEntry[] entries = wrapper.read(Types.REGISTRY_ENTRY_ARRAY);
|
||||
|
||||
// Track trim patterns and armor trims for conversion in items
|
||||
if (registryKey.equals("banner_pattern")) {
|
||||
// Track banner pattern and material ids for conversion in items
|
||||
final String[] keys = new String[entries.length];
|
||||
for (int i = 0; i < entries.length; i++) {
|
||||
keys[i] = Key.stripMinecraftNamespace(entries[i].key());
|
||||
}
|
||||
wrapper.user().get(BannerPatternStorage.class).setBannerPatterns(new KeyMappings(keys));
|
||||
// Don't send it
|
||||
wrapper.user().get(BannerPatternStorage.class).setBannerPatterns(toMappings(entries));
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean isTrimPattern = registryKey.equals("trim_pattern");
|
||||
if (isTrimPattern) {
|
||||
wrapper.user().get(ArmorTrimStorage.class).setTrimPatterns(toMappings(entries));
|
||||
} else if (registryKey.equals("trim_material")) {
|
||||
wrapper.user().get(ArmorTrimStorage.class).setTrimMaterials(toMappings(entries));
|
||||
}
|
||||
|
||||
// Track biome and dimension data
|
||||
if (registryKey.equals("worldgen/biome")) {
|
||||
tracker(wrapper.user()).setBiomesSent(entries.length);
|
||||
@ -156,7 +162,6 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
}
|
||||
|
||||
// Write to old format
|
||||
final boolean isTrimPattern = registryKey.equals("trim_pattern");
|
||||
final CompoundTag registryTag = new CompoundTag();
|
||||
final ListTag<CompoundTag> entriesTag = new ListTag<>(CompoundTag.class);
|
||||
registryTag.putString("type", registryKey);
|
||||
@ -291,6 +296,14 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
});
|
||||
}
|
||||
|
||||
private KeyMappings toMappings(final RegistryEntry[] entries) {
|
||||
final String[] keys = new String[entries.length];
|
||||
for (int i = 0; i < entries.length; i++) {
|
||||
keys[i] = Key.stripMinecraftNamespace(entries[i].key());
|
||||
}
|
||||
return new KeyMappings(keys);
|
||||
}
|
||||
|
||||
private void updateParticleFormat(final CompoundTag options, final String particleType) {
|
||||
if ("block".equals(particleType) || "block_marker".equals(particleType) || "falling_dust".equals(particleType) || "dust_pillar".equals(particleType)) {
|
||||
Tag blockState = options.remove("block_state");
|
||||
|
@ -3,7 +3,7 @@ metadata.format.version = "1.1"
|
||||
[versions]
|
||||
|
||||
# ViaVersion
|
||||
viaver = "5.0.2-SNAPSHOT"
|
||||
viaver = "5.0.3-SNAPSHOT"
|
||||
|
||||
# Common provided
|
||||
netty = "4.0.20.Final"
|
||||
|
Loading…
Reference in New Issue
Block a user