3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-27 00:22:53 +01:00

24w03b (probably)

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-01-18 12:03:20 +01:00
Ursprung 6b1f913b91
Commit e6814a13a9
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
15 geänderte Dateien mit 1895 neuen und 122 gelöschten Zeilen

Datei anzeigen

@ -59,7 +59,7 @@ public final class Protocol1_19_3To1_19_4 extends BackwardsProtocol<ClientboundP
final SoundRewriter<ClientboundPackets1_19_4> soundRewriter = new SoundRewriter<>(this); final SoundRewriter<ClientboundPackets1_19_4> soundRewriter = new SoundRewriter<>(this);
soundRewriter.registerStopSound(ClientboundPackets1_19_4.STOP_SOUND); soundRewriter.registerStopSound(ClientboundPackets1_19_4.STOP_SOUND);
soundRewriter.register1_19_3Sound(ClientboundPackets1_19_4.SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_19_4.SOUND);
soundRewriter.registerSound(ClientboundPackets1_19_4.ENTITY_SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_19_4.ENTITY_SOUND);
// TODO fallback field in components // TODO fallback field in components
translatableRewriter.registerComponentPacket(ClientboundPackets1_19_4.ACTIONBAR); translatableRewriter.registerComponentPacket(ClientboundPackets1_19_4.ACTIONBAR);

Datei anzeigen

@ -57,7 +57,7 @@ public final class Protocol1_19_4To1_20 extends BackwardsProtocol<ClientboundPac
final SoundRewriter<ClientboundPackets1_19_4> soundRewriter = new SoundRewriter<>(this); final SoundRewriter<ClientboundPackets1_19_4> soundRewriter = new SoundRewriter<>(this);
soundRewriter.registerStopSound(ClientboundPackets1_19_4.STOP_SOUND); soundRewriter.registerStopSound(ClientboundPackets1_19_4.STOP_SOUND);
soundRewriter.register1_19_3Sound(ClientboundPackets1_19_4.SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_19_4.SOUND);
soundRewriter.registerSound(ClientboundPackets1_19_4.ENTITY_SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_19_4.ENTITY_SOUND);
new StatisticsRewriter<>(this).register(ClientboundPackets1_19_4.STATISTICS); new StatisticsRewriter<>(this).register(ClientboundPackets1_19_4.STATISTICS);

Datei anzeigen

@ -74,7 +74,7 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
final SoundRewriter<ClientboundPackets1_20_3> soundRewriter = new SoundRewriter<>(this); final SoundRewriter<ClientboundPackets1_20_3> soundRewriter = new SoundRewriter<>(this);
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND);
soundRewriter.registerEntitySound(ClientboundPackets1_20_3.ENTITY_SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.ENTITY_SOUND);
soundRewriter.registerStopSound(ClientboundPackets1_20_3.STOP_SOUND); soundRewriter.registerStopSound(ClientboundPackets1_20_3.STOP_SOUND);
new StatisticsRewriter<>(this).register(ClientboundPackets1_20_3.STATISTICS); new StatisticsRewriter<>(this).register(ClientboundPackets1_20_3.STATISTICS);

Datei anzeigen

@ -18,67 +18,114 @@
package com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5; package com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5;
import com.viaversion.viabackwards.api.BackwardsProtocol; import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.api.data.BackwardsMappings;
import com.viaversion.viabackwards.api.rewriters.SoundRewriter; import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter; import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.data.BackwardsMappings;
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter.BlockItemPacketRewriter1_20_5; import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter.BlockItemPacketRewriter1_20_5;
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter.EntityPacketRewriter1_20_5; import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter.EntityPacketRewriter1_20_5;
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.SecureChatStorage;
import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType; import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.data.entity.EntityTrackerBase; import com.viaversion.viaversion.data.entity.EntityTrackerBase;
import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_20_2; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundConfigurationPackets1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundConfigurationPackets1_20_3;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_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_5to1_20_3.Protocol1_20_5To1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundConfigurationPackets1_20_5;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundConfigurationPackets1_20_5;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPackets1_20_5;
import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType; import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType;
import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.StatisticsRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter; import com.viaversion.viaversion.rewriter.TagRewriter;
public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundPackets1_20_3, ClientboundPackets1_20_3, ServerboundPackets1_20_3, ServerboundPackets1_20_3> { public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundPackets1_20_5, ClientboundPackets1_20_3, ServerboundPackets1_20_5, ServerboundPackets1_20_3> {
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.20.5", "1.20.3", Protocol1_20_5To1_20_3.class); public static final BackwardsMappings MAPPINGS = new BackwardsMappings();
private final EntityPacketRewriter1_20_5 entityRewriter = new EntityPacketRewriter1_20_5(this); private final EntityPacketRewriter1_20_5 entityRewriter = new EntityPacketRewriter1_20_5(this);
private final BlockItemPacketRewriter1_20_5 itemRewriter = new BlockItemPacketRewriter1_20_5(this); private final BlockItemPacketRewriter1_20_5 itemRewriter = new BlockItemPacketRewriter1_20_5(this);
private final TranslatableRewriter<ClientboundPackets1_20_3> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); private final TranslatableRewriter<ClientboundPackets1_20_5> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT);
public Protocol1_20_3To1_20_5() { public Protocol1_20_3To1_20_5() {
super(ClientboundPackets1_20_3.class, ClientboundPackets1_20_3.class, ServerboundPackets1_20_3.class, ServerboundPackets1_20_3.class); super(ClientboundPackets1_20_5.class, ClientboundPackets1_20_3.class, ServerboundPackets1_20_5.class, ServerboundPackets1_20_3.class);
} }
@Override @Override
protected void registerPackets() { protected void registerPackets() {
super.registerPackets(); super.registerPackets();
final TagRewriter<ClientboundPackets1_20_3> tagRewriter = new TagRewriter<>(this); final TagRewriter<ClientboundPackets1_20_5> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS); tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS);
tagRewriter.registerGeneric(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.UPDATE_TAGS); tagRewriter.registerGeneric(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.UPDATE_TAGS);
final SoundRewriter<ClientboundPackets1_20_3> soundRewriter = new SoundRewriter<>(this); final SoundRewriter<ClientboundPackets1_20_5> soundRewriter = new SoundRewriter<>(this);
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.SOUND);
soundRewriter.registerSound(ClientboundPackets1_20_3.ENTITY_SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.ENTITY_SOUND);
soundRewriter.registerStopSound(ClientboundPackets1_20_3.STOP_SOUND); soundRewriter.registerStopSound(ClientboundPackets1_20_5.STOP_SOUND);
new StatisticsRewriter<>(this).register(ClientboundPackets1_20_3.STATISTICS); new StatisticsRewriter<>(this).register(ClientboundPackets1_20_5.STATISTICS);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.ACTIONBAR); translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.ACTIONBAR);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.TITLE_TEXT); translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.TITLE_TEXT);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.TITLE_SUBTITLE); translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.TITLE_SUBTITLE);
translatableRewriter.registerBossBar(ClientboundPackets1_20_3.BOSSBAR); translatableRewriter.registerBossBar(ClientboundPackets1_20_5.BOSSBAR);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.DISCONNECT); translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.DISCONNECT);
translatableRewriter.registerTabList(ClientboundPackets1_20_3.TAB_LIST); translatableRewriter.registerTabList(ClientboundPackets1_20_5.TAB_LIST);
translatableRewriter.registerCombatKill1_20(ClientboundPackets1_20_3.COMBAT_KILL); translatableRewriter.registerCombatKill1_20(ClientboundPackets1_20_5.COMBAT_KILL);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.SYSTEM_CHAT); translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.SYSTEM_CHAT);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.DISGUISED_CHAT); translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.DISGUISED_CHAT);
translatableRewriter.registerPing(); translatableRewriter.registerPing();
registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO, wrapper -> {
wrapper.passthrough(Type.STRING); // Server ID
wrapper.passthrough(Type.BYTE_ARRAY_PRIMITIVE); // Public key
wrapper.passthrough(Type.BYTE_ARRAY_PRIMITIVE); // Challenge
wrapper.read(Type.BOOLEAN); // Authenticate
});
registerClientbound(ClientboundPackets1_20_5.SERVER_DATA, wrapper -> {
wrapper.passthrough(Type.TAG); // MOTD
wrapper.passthrough(Type.OPTIONAL_BYTE_ARRAY_PRIMITIVE); // Icon
wrapper.write(Type.BOOLEAN, wrapper.user().get(SecureChatStorage.class).enforcesSecureChat());
});
// TODO
registerClientbound(State.LOGIN, ClientboundLoginPackets.COOKIE_REQUEST.getId(), -1, wrapper -> {
wrapper.cancel();
});
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.COOKIE_REQUEST.getId(), -1, wrapper -> {
wrapper.cancel();
});
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.STORE_COOKIE.getId(), -1, wrapper -> {
wrapper.cancel();
});
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.TRANSFER.getId(), -1, wrapper -> {
wrapper.cancel();
});
registerClientbound(ClientboundPackets1_20_5.COOKIE_REQUEST, null, wrapper -> {
wrapper.cancel();
});
registerClientbound(ClientboundPackets1_20_5.STORE_COOKIE, null, wrapper -> {
wrapper.cancel();
});
registerClientbound(ClientboundPackets1_20_5.TRANSFER, null, wrapper -> {
wrapper.cancel();
});
registerClientboundPacketIdChanges(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.class, ClientboundConfigurationPackets1_20_3.class);
registerServerboundPacketIdChanges(State.CONFIGURATION, ServerboundConfigurationPackets1_20_2.class, ServerboundConfigurationPackets1_20_5.class);
} }
@Override @Override
public void init(final UserConnection user) { public void init(final UserConnection user) {
addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_20_5.PLAYER)); addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_20_5.PLAYER));
user.put(new SecureChatStorage());
} }
@Override @Override
@ -97,13 +144,13 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundP
} }
@Override @Override
public TranslatableRewriter<ClientboundPackets1_20_3> getTranslatableRewriter() { public TranslatableRewriter<ClientboundPackets1_20_5> getTranslatableRewriter() {
return translatableRewriter; return translatableRewriter;
} }
@Override @Override
protected ClientboundPacketType clientboundFinishConfigurationPacket() { protected ClientboundPacketType clientboundFinishConfigurationPacket() {
return ClientboundConfigurationPackets1_20_3.FINISH_CONFIGURATION; return ClientboundConfigurationPackets1_20_5.FINISH_CONFIGURATION;
} }
@Override @Override

Datei anzeigen

@ -0,0 +1,50 @@
/*
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.data;
import com.viaversion.viabackwards.api.data.VBMappingDataLoader;
import com.viaversion.viaversion.libs.gson.JsonArray;
import com.viaversion.viaversion.libs.gson.JsonElement;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.Protocol1_20_5To1_20_3;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class BackwardsMappings extends com.viaversion.viabackwards.api.data.BackwardsMappings {
private String[] sounds;
public BackwardsMappings() {
super("1.20.5", "1.20.3", Protocol1_20_5To1_20_3.class);
}
@Override
protected void loadExtras(final CompoundTag data) {
super.loadExtras(data);
final JsonArray sounds = VBMappingDataLoader.loadData("sounds-1.20.3.json").getAsJsonArray("sounds");
this.sounds = new String[sounds.size()];
int i = 0;
for (final JsonElement sound : sounds) {
this.sounds[i++] = sound.getAsString();
}
}
public @Nullable String mappedSoundName(final int mappedId) {
return mappedId >= 0 && mappedId < sounds.length ? sounds[mappedId] : null;
}
}

Datei anzeigen

@ -19,14 +19,17 @@ package com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter;
import com.viaversion.viabackwards.api.rewriters.ItemRewriter; import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
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.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.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3; import com.viaversion.viaversion.api.type.types.version.Types1_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;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5;
import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.rewriter.BlockRewriter;
import com.viaversion.viaversion.util.Key;
public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<ClientboundPackets1_20_3, ServerboundPackets1_20_3, Protocol1_20_3To1_20_5> { public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<ClientboundPackets1_20_5, ServerboundPackets1_20_3, Protocol1_20_3To1_20_5> {
public BlockItemPacketRewriter1_20_5(final Protocol1_20_3To1_20_5 protocol) { public BlockItemPacketRewriter1_20_5(final Protocol1_20_3To1_20_5 protocol) {
super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY); super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY);
@ -34,25 +37,109 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
@Override @Override
public void registerPackets() { public void registerPackets() {
final BlockRewriter<ClientboundPackets1_20_3> blockRewriter = BlockRewriter.for1_20_2(protocol); final BlockRewriter<ClientboundPackets1_20_5> blockRewriter = BlockRewriter.for1_20_2(protocol);
blockRewriter.registerBlockAction(ClientboundPackets1_20_3.BLOCK_ACTION); blockRewriter.registerBlockAction(ClientboundPackets1_20_5.BLOCK_ACTION);
blockRewriter.registerBlockChange(ClientboundPackets1_20_3.BLOCK_CHANGE); blockRewriter.registerBlockChange(ClientboundPackets1_20_5.BLOCK_CHANGE);
blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_3.MULTI_BLOCK_CHANGE); blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_5.MULTI_BLOCK_CHANGE);
blockRewriter.registerEffect(ClientboundPackets1_20_3.EFFECT, 1010, 2001); blockRewriter.registerEffect(ClientboundPackets1_20_5.EFFECT, 1010, 2001);
blockRewriter.registerChunkData1_19(ClientboundPackets1_20_3.CHUNK_DATA, ChunkType1_20_2::new); blockRewriter.registerChunkData1_19(ClientboundPackets1_20_5.CHUNK_DATA, ChunkType1_20_2::new);
blockRewriter.registerBlockEntityData(ClientboundPackets1_20_3.BLOCK_ENTITY_DATA); blockRewriter.registerBlockEntityData(ClientboundPackets1_20_5.BLOCK_ENTITY_DATA);
registerSetCooldown(ClientboundPackets1_20_3.COOLDOWN); registerSetCooldown(ClientboundPackets1_20_5.COOLDOWN);
registerWindowItems1_17_1(ClientboundPackets1_20_3.WINDOW_ITEMS); registerWindowItems1_17_1(ClientboundPackets1_20_5.WINDOW_ITEMS);
registerSetSlot1_17_1(ClientboundPackets1_20_3.SET_SLOT); registerSetSlot1_17_1(ClientboundPackets1_20_5.SET_SLOT);
registerAdvancements1_20_3(ClientboundPackets1_20_3.ADVANCEMENTS); registerAdvancements1_20_3(ClientboundPackets1_20_5.ADVANCEMENTS);
registerEntityEquipmentArray(ClientboundPackets1_20_3.ENTITY_EQUIPMENT); registerEntityEquipmentArray(ClientboundPackets1_20_5.ENTITY_EQUIPMENT);
registerClickWindow1_17_1(ServerboundPackets1_20_3.CLICK_WINDOW); registerClickWindow1_17_1(ServerboundPackets1_20_3.CLICK_WINDOW);
registerTradeList1_19(ClientboundPackets1_20_3.TRADE_LIST);
registerCreativeInvAction(ServerboundPackets1_20_3.CREATIVE_INVENTORY_ACTION); registerCreativeInvAction(ServerboundPackets1_20_3.CREATIVE_INVENTORY_ACTION);
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_3.WINDOW_PROPERTY); registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_5.WINDOW_PROPERTY);
registerSpawnParticle1_19(ClientboundPackets1_20_3.SPAWN_PARTICLE);
new RecipeRewriter1_20_3<>(protocol).register(ClientboundPackets1_20_3.DECLARE_RECIPES); protocol.registerClientbound(ClientboundPackets1_20_5.SPAWN_PARTICLE, wrapper -> {
wrapper.write(Type.VAR_INT, 0); // Write dummy value, set later
wrapper.passthrough(Type.BOOLEAN); // Long Distance
wrapper.passthrough(Type.DOUBLE); // X
wrapper.passthrough(Type.DOUBLE); // Y
wrapper.passthrough(Type.DOUBLE); // Z
wrapper.passthrough(Type.FLOAT); // Offset X
wrapper.passthrough(Type.FLOAT); // Offset Y
wrapper.passthrough(Type.FLOAT); // Offset Z
wrapper.passthrough(Type.FLOAT); // Particle Data
wrapper.passthrough(Type.INT); // Particle Count
// Move it to the beginning, move out arguments here
final Particle particle = wrapper.read(Types1_20_3.PARTICLE);
rewriteParticle(particle);
wrapper.set(Type.VAR_INT, 0, particle.getId());
for (final Particle.ParticleData<?> argument : particle.getArguments()) {
argument.write(wrapper);
}
});
protocol.registerClientbound(ClientboundPackets1_20_5.EXPLOSION, wrapper -> {
wrapper.passthrough(Type.DOUBLE); // X
wrapper.passthrough(Type.DOUBLE); // Y
wrapper.passthrough(Type.DOUBLE); // Z
wrapper.passthrough(Type.FLOAT); // Power
final int blocks = wrapper.passthrough(Type.VAR_INT);
for (int i = 0; i < blocks; i++) {
wrapper.passthrough(Type.BYTE); // Relative X
wrapper.passthrough(Type.BYTE); // Relative Y
wrapper.passthrough(Type.BYTE); // Relative Z
}
wrapper.passthrough(Type.FLOAT); // Knockback X
wrapper.passthrough(Type.FLOAT); // Knockback Y
wrapper.passthrough(Type.FLOAT); // Knockback Z
wrapper.passthrough(Type.VAR_INT); // Block interaction type
final Particle smallExplosionParticle = wrapper.passthrough(Types1_20_3.PARTICLE);
final Particle largeExplosionParticle = wrapper.passthrough(Types1_20_3.PARTICLE);
protocol.getEntityRewriter().rewriteParticle(smallExplosionParticle);
protocol.getEntityRewriter().rewriteParticle(largeExplosionParticle);
int soundId = wrapper.read(Type.VAR_INT) - 1;
if (soundId == -1) {
// Already followed by the resource location
return;
}
soundId = protocol.getMappingData().getSoundMappings().getNewId(soundId);
final String soundKey = protocol.getMappingData().mappedSoundName(soundId);
wrapper.write(Type.STRING, soundKey != null ? soundKey : "minecraft:entity.generic.explode");
wrapper.write(Type.OPTIONAL_FLOAT, null); // Fixed range
});
protocol.registerClientbound(ClientboundPackets1_20_5.TRADE_LIST, wrapper -> {
wrapper.passthrough(Type.VAR_INT); // Container id
final int size = wrapper.passthrough(Type.VAR_INT);
for (int i = 0; i < size; i++) {
handleItemToClient(wrapper.passthrough(Type.ITEM1_20_2)); // Input
handleItemToClient(wrapper.passthrough(Type.ITEM1_20_2)); // Output
handleItemToClient(wrapper.passthrough(Type.ITEM1_20_2)); // Second Item
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
wrapper.passthrough(Type.INT); // Number of tools uses
wrapper.passthrough(Type.INT); // Maximum number of trade uses
wrapper.passthrough(Type.INT); // XP
wrapper.passthrough(Type.INT); // Special price
wrapper.passthrough(Type.FLOAT); // Price multiplier
wrapper.passthrough(Type.INT); // Demand
wrapper.read(Type.BOOLEAN); // Ignore tags
}
});
final RecipeRewriter1_20_3<ClientboundPackets1_20_5> recipeRewriter = new RecipeRewriter1_20_3<>(protocol);
protocol.registerClientbound(ClientboundPackets1_20_5.DECLARE_RECIPES, wrapper -> {
final int size = wrapper.passthrough(Type.VAR_INT);
for (int i = 0; i < size; i++) {
// Change order and write the type as an int
final String recipeIdentifier = wrapper.read(Type.STRING);
final int serializerTypeId = wrapper.read(Type.VAR_INT);
final String serializerType = protocol.getMappingData().getRecipeSerializerMappings().mappedIdentifier(serializerTypeId);
wrapper.write(Type.STRING, serializerType);
wrapper.write(Type.STRING, recipeIdentifier);
recipeRewriter.handleRecipeType(wrapper, Key.stripMinecraftNamespace(serializerType));
}
});
} }
} }

Datei anzeigen

@ -19,6 +19,7 @@ package com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter;
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.SecureChatStorage;
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;
import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.protocol.packet.State;
@ -26,11 +27,11 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
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.api.type.types.version.Types1_20_5;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundConfigurationPackets1_20_3;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.data.AttributeMappings; import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.data.AttributeMappings;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundConfigurationPackets1_20_5;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5;
public final class EntityPacketRewriter1_20_5 extends EntityRewriter<ClientboundPackets1_20_3, Protocol1_20_3To1_20_5> { public final class EntityPacketRewriter1_20_5 extends EntityRewriter<ClientboundPackets1_20_5, Protocol1_20_3To1_20_5> {
public EntityPacketRewriter1_20_5(final Protocol1_20_3To1_20_5 protocol) { public EntityPacketRewriter1_20_5(final Protocol1_20_3To1_20_5 protocol) {
super(protocol, Types1_20_3.META_TYPES.optionalComponentType, Types1_20_3.META_TYPES.booleanType); super(protocol, Types1_20_3.META_TYPES.optionalComponentType, Types1_20_3.META_TYPES.booleanType);
@ -38,11 +39,11 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
@Override @Override
public void registerPackets() { public void registerPackets() {
registerTrackerWithData1_19(ClientboundPackets1_20_3.SPAWN_ENTITY, EntityTypes1_20_5.FALLING_BLOCK); registerTrackerWithData1_19(ClientboundPackets1_20_5.SPAWN_ENTITY, EntityTypes1_20_5.FALLING_BLOCK);
registerMetadataRewriter(ClientboundPackets1_20_3.ENTITY_METADATA, Types1_20_5.METADATA_LIST, Types1_20_3.METADATA_LIST); registerMetadataRewriter(ClientboundPackets1_20_5.ENTITY_METADATA, Types1_20_5.METADATA_LIST, Types1_20_3.METADATA_LIST);
registerRemoveEntities(ClientboundPackets1_20_3.REMOVE_ENTITIES); registerRemoveEntities(ClientboundPackets1_20_5.REMOVE_ENTITIES);
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.REGISTRY_DATA, new PacketHandlers() { protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.REGISTRY_DATA, new PacketHandlers() {
@Override @Override
protected void register() { protected void register() {
map(Type.COMPOUND_TAG); // Registry data map(Type.COMPOUND_TAG); // Registry data
@ -51,7 +52,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
} }
}); });
protocol.registerClientbound(ClientboundPackets1_20_3.JOIN_GAME, new PacketHandlers() { protocol.registerClientbound(ClientboundPackets1_20_5.JOIN_GAME, new PacketHandlers() {
@Override @Override
public void register() { public void register() {
map(Type.INT); // Entity id map(Type.INT); // Entity id
@ -65,11 +66,22 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
map(Type.BOOLEAN); // Limited crafting map(Type.BOOLEAN); // Limited crafting
map(Type.STRING); // Dimension key map(Type.STRING); // Dimension key
map(Type.STRING); // World map(Type.STRING); // World
map(Type.LONG); // Seed
map(Type.BYTE); // Gamemode
map(Type.BYTE); // Previous gamemode
map(Type.BOOLEAN); // Debug
map(Type.BOOLEAN); // Flat
map(Type.OPTIONAL_GLOBAL_POSITION); // Last death location
handler(wrapper -> {
// Moved to server data
final boolean enforcesSecureChat = wrapper.read(Type.BOOLEAN);
wrapper.user().get(SecureChatStorage.class).setEnforcesSecureChat(enforcesSecureChat);
});
handler(worldDataTrackerHandlerByKey()); // Tracks world height and name for chunk data and entity (un)tracking handler(worldDataTrackerHandlerByKey()); // Tracks world height and name for chunk data and entity (un)tracking
} }
}); });
protocol.registerClientbound(ClientboundPackets1_20_3.RESPAWN, new PacketHandlers() { protocol.registerClientbound(ClientboundPackets1_20_5.RESPAWN, new PacketHandlers() {
@Override @Override
public void register() { public void register() {
map(Type.STRING); // Dimension map(Type.STRING); // Dimension
@ -78,7 +90,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
} }
}); });
protocol.registerClientbound(ClientboundPackets1_20_3.ENTITY_EFFECT, wrapper -> { protocol.registerClientbound(ClientboundPackets1_20_5.ENTITY_EFFECT, wrapper -> {
wrapper.passthrough(Type.VAR_INT); // Entity ID wrapper.passthrough(Type.VAR_INT); // Entity ID
wrapper.passthrough(Type.VAR_INT); // Effect ID wrapper.passthrough(Type.VAR_INT); // Effect ID
wrapper.passthrough(Type.BYTE); // Amplifier wrapper.passthrough(Type.BYTE); // Amplifier
@ -87,7 +99,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
wrapper.write(Type.OPTIONAL_COMPOUND_TAG, null); // Add empty factor data wrapper.write(Type.OPTIONAL_COMPOUND_TAG, null); // Add empty factor data
}); });
protocol.registerClientbound(ClientboundPackets1_20_3.ENTITY_PROPERTIES, wrapper -> { protocol.registerClientbound(ClientboundPackets1_20_5.ENTITY_PROPERTIES, wrapper -> {
wrapper.passthrough(Type.VAR_INT); // Entity ID wrapper.passthrough(Type.VAR_INT); // Entity ID
final int size = wrapper.passthrough(Type.VAR_INT); final int size = wrapper.passthrough(Type.VAR_INT);

Datei anzeigen

@ -0,0 +1,32 @@
/*
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
* Copyright (C) 2016-2024 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage;
import com.viaversion.viaversion.api.connection.StorableObject;
public final class SecureChatStorage implements StorableObject {
private boolean enforcesSecureChat;
public void setEnforcesSecureChat(final boolean enforcesSecureChat) {
this.enforcesSecureChat = enforcesSecureChat;
}
public boolean enforcesSecureChat() {
return enforcesSecureChat;
}
}

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -1,4 +1,4 @@
projectVersion=4.10.0-23w51b-SNAPSHOT projectVersion=4.10.0-24w03a-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-23w51b-SNAPSHOT" viaver = "4.10.0-24w03a-SNAPSHOT"
# Common provided # Common provided
netty = "4.0.20.Final" netty = "4.0.20.Final"

Datei anzeigen

@ -29,11 +29,11 @@ import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType; import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.data.entity.EntityTrackerBase; import com.viaversion.viaversion.data.entity.EntityTrackerBase;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundConfigurationPackets1_20_3;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.Protocol1_20_5To1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.Protocol1_20_5To1_20_3;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundConfigurationPackets1_20_5;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundConfigurationPackets1_20_5;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPackets1_20_5;
import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType; import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType;
import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.StatisticsRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter; import com.viaversion.viaversion.rewriter.TagRewriter;
@ -41,50 +41,50 @@ import com.viaversion.viaversion.rewriter.TagRewriter;
// Placeholders to replace (in the entire package): // Placeholders to replace (in the entire package):
// Protocol1_98To_99, EntityPacketRewriter1_99, BlockItemPacketRewriter1_99 // Protocol1_98To_99, EntityPacketRewriter1_99, BlockItemPacketRewriter1_99
// Protocol1_20_5To1_20_3 (the ViaVersion protocol class the mappings depend on) // Protocol1_20_5To1_20_3 (the ViaVersion protocol class the mappings depend on)
// ClientboundPackets1_20_3 // ClientboundPackets1_20_5
// ServerboundPackets1_20_3 // ServerboundPackets1_20_5
// ClientboundConfigurationPackets1_20_3 // ClientboundConfigurationPackets1_20_5
// ServerboundConfigurationPackets1_20_2 // ServerboundConfigurationPackets1_20_5
// EntityTypes1_20_5 (UNMAPPED type) // EntityTypes1_20_5 (UNMAPPED type)
// 1.99, 1.98 // 1.99, 1.98
public final class Protocol1_98To1_99 extends BackwardsProtocol<ClientboundPackets1_20_3, ClientboundPackets1_20_3, ServerboundPackets1_20_3, ServerboundPackets1_20_3> { public final class Protocol1_98To1_99 extends BackwardsProtocol<ClientboundPackets1_20_5, ClientboundPackets1_20_5, ServerboundPackets1_20_5, ServerboundPackets1_20_5> {
// ViaBackwards uses its own mappings and also needs a translatablerewriter for translation mappings // ViaBackwards uses its own mappings and also needs a translatablerewriter for translation mappings
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.99", "1.98", Protocol1_20_5To1_20_3.class); public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.99", "1.98", Protocol1_20_5To1_20_3.class);
private final EntityPacketRewriter1_99 entityRewriter = new EntityPacketRewriter1_99(this); private final EntityPacketRewriter1_99 entityRewriter = new EntityPacketRewriter1_99(this);
private final BlockItemPacketRewriter1_99 itemRewriter = new BlockItemPacketRewriter1_99(this); private final BlockItemPacketRewriter1_99 itemRewriter = new BlockItemPacketRewriter1_99(this);
private final TranslatableRewriter<ClientboundPackets1_20_3> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); private final TranslatableRewriter<ClientboundPackets1_20_5> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT);
public Protocol1_98To1_99() { public Protocol1_98To1_99() {
super(ClientboundPackets1_20_3.class, ClientboundPackets1_20_3.class, ServerboundPackets1_20_3.class, ServerboundPackets1_20_3.class); super(ClientboundPackets1_20_5.class, ClientboundPackets1_20_5.class, ServerboundPackets1_20_5.class, ServerboundPackets1_20_5.class);
} }
@Override @Override
protected void registerPackets() { protected void registerPackets() {
super.registerPackets(); super.registerPackets();
final TagRewriter<ClientboundPackets1_20_3> tagRewriter = new TagRewriter<>(this); final TagRewriter<ClientboundPackets1_20_5> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS); tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS);
tagRewriter.registerGeneric(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.UPDATE_TAGS); tagRewriter.registerGeneric(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.UPDATE_TAGS);
final SoundRewriter<ClientboundPackets1_20_3> soundRewriter = new SoundRewriter<>(this); final SoundRewriter<ClientboundPackets1_20_5> soundRewriter = new SoundRewriter<>(this);
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.SOUND);
soundRewriter.registerSound(ClientboundPackets1_20_3.ENTITY_SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.ENTITY_SOUND);
soundRewriter.registerStopSound(ClientboundPackets1_20_3.STOP_SOUND); soundRewriter.registerStopSound(ClientboundPackets1_20_5.STOP_SOUND);
new StatisticsRewriter<>(this).register(ClientboundPackets1_20_3.STATISTICS); new StatisticsRewriter<>(this).register(ClientboundPackets1_20_5.STATISTICS);
// Registers translatable mappings (missing a whole bunch still) // Registers translatable mappings (missing a whole bunch still)
//translatableRewriter.registerOpenWindow(ClientboundPackets1_20_3.OPEN_WINDOW); // Handled by registerOpenWindow in item rewriters //translatableRewriter.registerOpenWindow(ClientboundPackets1_20_5.OPEN_WINDOW); // Handled by registerOpenWindow in item rewriters
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.ACTIONBAR); translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.ACTIONBAR);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.TITLE_TEXT); translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.TITLE_TEXT);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.TITLE_SUBTITLE); translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.TITLE_SUBTITLE);
translatableRewriter.registerBossBar(ClientboundPackets1_20_3.BOSSBAR); translatableRewriter.registerBossBar(ClientboundPackets1_20_5.BOSSBAR);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.DISCONNECT); translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.DISCONNECT);
translatableRewriter.registerTabList(ClientboundPackets1_20_3.TAB_LIST); translatableRewriter.registerTabList(ClientboundPackets1_20_5.TAB_LIST);
translatableRewriter.registerCombatKill1_20(ClientboundPackets1_20_3.COMBAT_KILL); translatableRewriter.registerCombatKill1_20(ClientboundPackets1_20_5.COMBAT_KILL);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.SYSTEM_CHAT); translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.SYSTEM_CHAT);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.DISGUISED_CHAT); translatableRewriter.registerComponentPacket(ClientboundPackets1_20_5.DISGUISED_CHAT);
translatableRewriter.registerPing(); translatableRewriter.registerPing();
// TODO Attributes // TODO Attributes
@ -111,17 +111,17 @@ public final class Protocol1_98To1_99 extends BackwardsProtocol<ClientboundPacke
} }
@Override @Override
public TranslatableRewriter<ClientboundPackets1_20_3> getTranslatableRewriter() { public TranslatableRewriter<ClientboundPackets1_20_5> getTranslatableRewriter() {
return translatableRewriter; return translatableRewriter;
} }
@Override @Override
protected ClientboundPacketType clientboundFinishConfigurationPacket() { protected ClientboundPacketType clientboundFinishConfigurationPacket() {
return ClientboundConfigurationPackets1_20_3.FINISH_CONFIGURATION; return ClientboundConfigurationPackets1_20_5.FINISH_CONFIGURATION;
} }
@Override @Override
protected ServerboundPacketType serverboundFinishConfigurationPacket() { protected ServerboundPacketType serverboundFinishConfigurationPacket() {
return ServerboundConfigurationPackets1_20_2.FINISH_CONFIGURATION; return ServerboundConfigurationPackets1_20_5.FINISH_CONFIGURATION;
} }
} }

Datei anzeigen

@ -21,15 +21,16 @@ import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
import com.viaversion.viabackwards.template.protocol.Protocol1_98To1_99; import com.viaversion.viabackwards.template.protocol.Protocol1_98To1_99;
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.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3; import com.viaversion.viaversion.api.type.types.version.Types1_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;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5;
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPackets1_20_5;
import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.rewriter.BlockRewriter;
// To replace if needed: // To replace if needed:
// ChunkType1_20_2 // ChunkType1_20_2
// RecipeRewriter1_20_3 // RecipeRewriter1_20_3
public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundPackets1_20_3, ServerboundPackets1_20_3, Protocol1_98To1_99> { public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundPackets1_20_5, ServerboundPackets1_20_5, Protocol1_98To1_99> {
public BlockItemPacketRewriter1_99(final Protocol1_98To1_99 protocol) { public BlockItemPacketRewriter1_99(final Protocol1_98To1_99 protocol) {
super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY); super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY);
@ -37,28 +38,29 @@ public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundP
@Override @Override
public void registerPackets() { public void registerPackets() {
final BlockRewriter<ClientboundPackets1_20_3> blockRewriter = BlockRewriter.for1_20_2(protocol); final BlockRewriter<ClientboundPackets1_20_5> blockRewriter = BlockRewriter.for1_20_2(protocol);
blockRewriter.registerBlockAction(ClientboundPackets1_20_3.BLOCK_ACTION); blockRewriter.registerBlockAction(ClientboundPackets1_20_5.BLOCK_ACTION);
blockRewriter.registerBlockChange(ClientboundPackets1_20_3.BLOCK_CHANGE); blockRewriter.registerBlockChange(ClientboundPackets1_20_5.BLOCK_CHANGE);
blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_3.MULTI_BLOCK_CHANGE); blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_5.MULTI_BLOCK_CHANGE);
blockRewriter.registerEffect(ClientboundPackets1_20_3.EFFECT, 1010, 2001); blockRewriter.registerEffect(ClientboundPackets1_20_5.EFFECT, 1010, 2001);
blockRewriter.registerChunkData1_19(ClientboundPackets1_20_3.CHUNK_DATA, ChunkType1_20_2::new); blockRewriter.registerChunkData1_19(ClientboundPackets1_20_5.CHUNK_DATA, ChunkType1_20_2::new);
blockRewriter.registerBlockEntityData(ClientboundPackets1_20_3.BLOCK_ENTITY_DATA); blockRewriter.registerBlockEntityData(ClientboundPackets1_20_5.BLOCK_ENTITY_DATA);
// registerOpenWindow(ClientboundPackets1_20_3.OPEN_WINDOW); // registerOpenWindow(ClientboundPackets1_20_5.OPEN_WINDOW);
registerSetCooldown(ClientboundPackets1_20_3.COOLDOWN); registerSetCooldown(ClientboundPackets1_20_5.COOLDOWN);
registerWindowItems1_17_1(ClientboundPackets1_20_3.WINDOW_ITEMS); registerWindowItems1_17_1(ClientboundPackets1_20_5.WINDOW_ITEMS);
registerSetSlot1_17_1(ClientboundPackets1_20_3.SET_SLOT); registerSetSlot1_17_1(ClientboundPackets1_20_5.SET_SLOT);
registerAdvancements1_20_3(ClientboundPackets1_20_3.ADVANCEMENTS); registerAdvancements1_20_3(ClientboundPackets1_20_5.ADVANCEMENTS);
registerEntityEquipmentArray(ClientboundPackets1_20_3.ENTITY_EQUIPMENT); registerEntityEquipmentArray(ClientboundPackets1_20_5.ENTITY_EQUIPMENT);
registerClickWindow1_17_1(ServerboundPackets1_20_3.CLICK_WINDOW); registerClickWindow1_17_1(ServerboundPackets1_20_5.CLICK_WINDOW);
registerTradeList1_19(ClientboundPackets1_20_3.TRADE_LIST); registerTradeList1_20_5(ClientboundPackets1_20_5.TRADE_LIST);
registerCreativeInvAction(ServerboundPackets1_20_3.CREATIVE_INVENTORY_ACTION); registerCreativeInvAction(ServerboundPackets1_20_5.CREATIVE_INVENTORY_ACTION);
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_3.WINDOW_PROPERTY); registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_5.WINDOW_PROPERTY);
registerSpawnParticle1_19(ClientboundPackets1_20_3.SPAWN_PARTICLE); registerSpawnParticle1_20_5(ClientboundPackets1_20_5.SPAWN_PARTICLE, Types1_20_3.PARTICLE, Types1_20_3.PARTICLE);
registerExplosion(ClientboundPackets1_20_5.EXPLOSION, Types1_20_3.PARTICLE, Types1_20_3.PARTICLE);
//TODO Particles in explosion packet //TODO Particles in explosion packet
new RecipeRewriter1_20_3<>(protocol).register(ClientboundPackets1_20_3.DECLARE_RECIPES); new RecipeRewriter1_20_3<>(protocol).register1_20_5(ClientboundPackets1_20_5.DECLARE_RECIPES);
} }
} }

Datei anzeigen

@ -25,13 +25,13 @@ import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.version.Types1_20_5; import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundConfigurationPackets1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundConfigurationPackets1_20_5;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5;
// Replace if needed // Replace if needed
// Types1_OLD // Types1_OLD
// Types1_20_5 // Types1_20_5
public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPackets1_20_3, Protocol1_98To1_99> { public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPackets1_20_5, Protocol1_98To1_99> {
public EntityPacketRewriter1_99(final Protocol1_98To1_99 protocol) { public EntityPacketRewriter1_99(final Protocol1_98To1_99 protocol) {
super(protocol, Types1_20_5.META_TYPES.optionalComponentType, Types1_20_5.META_TYPES.booleanType); super(protocol, Types1_20_5.META_TYPES.optionalComponentType, Types1_20_5.META_TYPES.booleanType);
@ -39,11 +39,11 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
@Override @Override
public void registerPackets() { public void registerPackets() {
registerTrackerWithData1_19(ClientboundPackets1_20_3.SPAWN_ENTITY, EntityTypes1_20_5.FALLING_BLOCK); registerTrackerWithData1_19(ClientboundPackets1_20_5.SPAWN_ENTITY, EntityTypes1_20_5.FALLING_BLOCK);
registerMetadataRewriter(ClientboundPackets1_20_3.ENTITY_METADATA, /*Types1_OLD.METADATA_LIST, */Types1_20_5.METADATA_LIST); // Specify old and new metadata list if changed registerMetadataRewriter(ClientboundPackets1_20_5.ENTITY_METADATA, /*Types1_OLD.METADATA_LIST, */Types1_20_5.METADATA_LIST); // Specify old and new metadata list if changed
registerRemoveEntities(ClientboundPackets1_20_3.REMOVE_ENTITIES); registerRemoveEntities(ClientboundPackets1_20_5.REMOVE_ENTITIES);
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.REGISTRY_DATA, new PacketHandlers() { protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_5.REGISTRY_DATA, new PacketHandlers() {
@Override @Override
protected void register() { protected void register() {
map(Type.COMPOUND_TAG); // Registry data map(Type.COMPOUND_TAG); // Registry data
@ -52,7 +52,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
} }
}); });
protocol.registerClientbound(ClientboundPackets1_20_3.JOIN_GAME, new PacketHandlers() { protocol.registerClientbound(ClientboundPackets1_20_5.JOIN_GAME, new PacketHandlers() {
@Override @Override
public void register() { public void register() {
map(Type.INT); // Entity id map(Type.INT); // Entity id
@ -70,7 +70,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
} }
}); });
protocol.registerClientbound(ClientboundPackets1_20_3.RESPAWN, new PacketHandlers() { protocol.registerClientbound(ClientboundPackets1_20_5.RESPAWN, new PacketHandlers() {
@Override @Override
public void register() { public void register() {
map(Type.STRING); // Dimension map(Type.STRING); // Dimension