3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-20 06:50:10 +01:00
Dieser Commit ist enthalten in:
Nassim Jahnke 2024-02-07 19:07:34 +01:00
Ursprung fa1c3e1520
Commit 06f07d2b2c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
6 geänderte Dateien mit 34 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -125,6 +125,14 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundP
registerClientbound(ClientboundPackets1_20_5.STORE_COOKIE, null, this::handleStoreCookie); registerClientbound(ClientboundPackets1_20_5.STORE_COOKIE, null, this::handleStoreCookie);
registerClientbound(ClientboundPackets1_20_5.TRANSFER, null, this::handleTransfer); registerClientbound(ClientboundPackets1_20_5.TRANSFER, null, this::handleTransfer);
registerClientbound(ClientboundConfigurationPackets1_20_5.SELECT_KNOWN_PACKS, null, wrapper -> {
wrapper.cancel();
final PacketWrapper response = wrapper.create(ServerboundConfigurationPackets1_20_5.SELECT_KNOWN_PACKS);
response.write(Type.VAR_INT, 0); // Empty, we don't know anything
response.sendToServer(Protocol1_20_3To1_20_5.class);
});
cancelClientbound(ClientboundPackets1_20_5.DEBUG_SAMPLE); cancelClientbound(ClientboundPackets1_20_5.DEBUG_SAMPLE);
} }

Datei anzeigen

@ -23,6 +23,7 @@ import com.viaversion.viaversion.api.minecraft.Particle;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
import com.viaversion.viaversion.api.type.types.version.Types1_20_3; import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPacket1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPacket1_20_3;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.RecipeRewriter1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.RecipeRewriter1_20_3;
@ -69,7 +70,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
wrapper.passthrough(Type.INT); // Particle Count wrapper.passthrough(Type.INT); // Particle Count
// Move it to the beginning, move out arguments here // Move it to the beginning, move out arguments here
final Particle particle = wrapper.read(Types1_20_3.PARTICLE); final Particle particle = wrapper.read(Types1_20_5.PARTICLE);
rewriteParticle(particle); rewriteParticle(particle);
wrapper.set(Type.VAR_INT, 0, particle.getId()); wrapper.set(Type.VAR_INT, 0, particle.getId());
for (final Particle.ParticleData<?> argument : particle.getArguments()) { for (final Particle.ParticleData<?> argument : particle.getArguments()) {
@ -93,10 +94,8 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
wrapper.passthrough(Type.FLOAT); // Knockback Z wrapper.passthrough(Type.FLOAT); // Knockback Z
wrapper.passthrough(Type.VAR_INT); // Block interaction type wrapper.passthrough(Type.VAR_INT); // Block interaction type
final Particle smallExplosionParticle = wrapper.passthrough(Types1_20_3.PARTICLE); protocol.getEntityRewriter().rewriteParticle(wrapper, Types1_20_5.PARTICLE, Types1_20_3.PARTICLE); // Small explosion particle
final Particle largeExplosionParticle = wrapper.passthrough(Types1_20_3.PARTICLE); protocol.getEntityRewriter().rewriteParticle(wrapper, Types1_20_5.PARTICLE, Types1_20_3.PARTICLE); // Large explosion particle
protocol.getEntityRewriter().rewriteParticle(smallExplosionParticle);
protocol.getEntityRewriter().rewriteParticle(largeExplosionParticle);
int soundId = wrapper.read(Type.VAR_INT) - 1; int soundId = wrapper.read(Type.VAR_INT) - 1;
if (soundId == -1) { if (soundId == -1) {

Datei anzeigen

@ -17,11 +17,13 @@
*/ */
package com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter; package com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter;
import com.google.common.base.Preconditions;
import com.viaversion.viabackwards.api.rewriters.EntityRewriter; import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.Protocol1_20_3To1_20_5; import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.Protocol1_20_3To1_20_5;
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.RegistryDataStorage; import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.RegistryDataStorage;
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.SecureChatStorage; import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.SecureChatStorage;
import com.viaversion.viaversion.api.data.entity.DimensionData; import com.viaversion.viaversion.api.data.entity.DimensionData;
import com.viaversion.viaversion.api.data.entity.TrackedEntity;
import com.viaversion.viaversion.api.minecraft.RegistryEntry; import com.viaversion.viaversion.api.minecraft.RegistryEntry;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
@ -86,6 +88,8 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
final String[] keys = new String[entries.length]; final String[] keys = new String[entries.length];
for (int i = 0; i < entries.length; i++) { for (int i = 0; i < entries.length; i++) {
final RegistryEntry entry = entries[i]; final RegistryEntry entry = entries[i];
Preconditions.checkNotNull(entry.tag(), "Server unexpectedly sent null dimension data for " + entry.key());
final String dimensionKey = Key.stripMinecraftNamespace(entry.key()); final String dimensionKey = Key.stripMinecraftNamespace(entry.key());
dimensionDataMap.put(dimensionKey, new DimensionDataImpl(i, (CompoundTag) entry.tag())); dimensionDataMap.put(dimensionKey, new DimensionDataImpl(i, (CompoundTag) entry.tag()));
keys[i] = dimensionKey; keys[i] = dimensionKey;
@ -101,6 +105,8 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
registryTag.put("value", entriesTag); registryTag.put("value", entriesTag);
for (int i = 0; i < entries.length; i++) { for (int i = 0; i < entries.length; i++) {
final RegistryEntry entry = entries[i]; final RegistryEntry entry = entries[i];
Preconditions.checkNotNull(entry.tag(), "Server unexpectedly sent null registry data entry for " + entry.key());
final CompoundTag entryCompoundTag = new CompoundTag(); final CompoundTag entryCompoundTag = new CompoundTag();
entryCompoundTag.putString("name", entry.key()); entryCompoundTag.putString("name", entry.key());
entryCompoundTag.putInt("id", i); entryCompoundTag.putInt("id", i);
@ -174,13 +180,25 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
}); });
protocol.registerClientbound(ClientboundPackets1_20_5.ENTITY_PROPERTIES, wrapper -> { protocol.registerClientbound(ClientboundPackets1_20_5.ENTITY_PROPERTIES, wrapper -> {
wrapper.passthrough(Type.VAR_INT); // Entity ID final int entityId = wrapper.passthrough(Type.VAR_INT);
final TrackedEntity entity = tracker(wrapper.user()).entity(entityId);
if (entity == null || !entity.entityType().isOrHasParent(EntityTypes1_20_5.LIVINGENTITY)) {
// Cannot add attributes to base entities in old version
wrapper.cancel();
return;
}
final int size = wrapper.passthrough(Type.VAR_INT); final int size = wrapper.passthrough(Type.VAR_INT);
int newSize = size; int newSize = size;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
// From a registry int ID to a string // From a registry int ID to a string
final int id = protocol.getMappingData().getAttributeMappings().getNewId(wrapper.read(Type.VAR_INT)); int id = protocol.getMappingData().getAttributeMappings().getNewId(wrapper.read(Type.VAR_INT));
final String attribute = AttributeMappings.attribute(id);
if ("horse.jump_strength".equals(attribute)) {
// Jump strength only applies to horses in old versions
id = -1;
}
if (id == -1) { if (id == -1) {
// Remove new attributes from the list // Remove new attributes from the list
newSize--; newSize--;
@ -195,7 +213,6 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
continue; continue;
} }
final String attribute = AttributeMappings.attribute(id);
wrapper.write(Type.STRING, attribute); wrapper.write(Type.STRING, attribute);
wrapper.passthrough(Type.DOUBLE); // Base wrapper.passthrough(Type.DOUBLE); // Base

Datei anzeigen

@ -1,4 +1,4 @@
projectVersion=4.10.0-24w05b-SNAPSHOT projectVersion=4.10.0-24w06a-SNAPSHOT
# Smile emoji # Smile emoji
mcVersions=1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10 mcVersions=1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10

Datei anzeigen

@ -3,7 +3,7 @@ metadata.format.version = "1.1"
[versions] [versions]
# ViaVersion # ViaVersion
viaver = "4.10.0-24w05a-SNAPSHOT" viaver = "4.10.0-24w06a-SNAPSHOT"
# Common provided # Common provided
netty = "4.0.20.Final" netty = "4.0.20.Final"