3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-24 15:20:19 +01:00
Dieser Commit ist enthalten in:
Nassim Jahnke 2021-10-07 16:56:22 +02:00
Ursprung 448f452965
Commit 5df0dacf92
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
5 geänderte Dateien mit 44 neuen und 36 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ plugins {
allprojects {
group = "com.viaversion"
version = "4.1.0-21w39a-SNAPSHOT"
version = "4.1.0-21w40a-SNAPSHOT"
description = "Allow older clients to join newer server versions."
}

Datei anzeigen

@ -28,17 +28,18 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types;
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1;
import com.viaversion.viaversion.rewriter.TagRewriter;
public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPackets1_17_1, ClientboundPackets1_17_1, ServerboundPackets1_17, ServerboundPackets1_17> {
public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPackets1_18, ClientboundPackets1_17_1, ServerboundPackets1_17, ServerboundPackets1_17> {
private static final BackwardsMappings MAPPINGS = new BackwardsMappings();
private final EntityPackets1_18 entityRewriter = new EntityPackets1_18(this);
private final BlockItemPackets1_18 itemRewriter = new BlockItemPackets1_18(this, null); //TODO translatablerewriter
public Protocol1_17_1To1_18() {
super(ClientboundPackets1_17_1.class, ClientboundPackets1_17_1.class, ServerboundPackets1_17.class, ServerboundPackets1_17.class);
super(ClientboundPackets1_18.class, ClientboundPackets1_17_1.class, ServerboundPackets1_17.class, ServerboundPackets1_17.class);
}
@Override
@ -49,14 +50,14 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
itemRewriter.register();
final SoundRewriter soundRewriter = new SoundRewriter(this);
soundRewriter.registerSound(ClientboundPackets1_17_1.SOUND);
soundRewriter.registerSound(ClientboundPackets1_17_1.ENTITY_SOUND);
soundRewriter.registerStopSound(ClientboundPackets1_17_1.STOP_SOUND);
soundRewriter.registerNamedSound(ClientboundPackets1_17_1.NAMED_SOUND);
soundRewriter.registerSound(ClientboundPackets1_18.SOUND);
soundRewriter.registerSound(ClientboundPackets1_18.ENTITY_SOUND);
soundRewriter.registerStopSound(ClientboundPackets1_18.STOP_SOUND);
soundRewriter.registerNamedSound(ClientboundPackets1_18.NAMED_SOUND);
final TagRewriter tagRewriter = new TagRewriter(this);
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:lava_pool_stone_replaceables");
tagRewriter.registerGeneric(ClientboundPackets1_17_1.TAGS);
tagRewriter.registerGeneric(ClientboundPackets1_18.TAGS);
}
@Override

Datei anzeigen

@ -36,6 +36,7 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.IntTag;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type;
import com.viaversion.viaversion.util.MathUtil;
@ -57,24 +58,24 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
protected void registerPackets() {
/*final BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_17_1.DECLARE_RECIPES);
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_18.DECLARE_RECIPES);
registerSetCooldown(ClientboundPackets1_17_1.COOLDOWN);
registerWindowItems(ClientboundPackets1_17_1.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
registerSetSlot(ClientboundPackets1_17_1.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
registerEntityEquipmentArray(ClientboundPackets1_17_1.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
registerTradeList(ClientboundPackets1_17_1.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
registerAdvancements(ClientboundPackets1_17_1.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
registerClickWindow1_17(ServerboundPackets1_17.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
registerSetCooldown(ClientboundPackets1_18.COOLDOWN);
registerWindowItems(ClientboundPackets1_18.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
registerSetSlot(ClientboundPackets1_18.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
registerEntityEquipmentArray(ClientboundPackets1_18.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
registerTradeList(ClientboundPackets1_18.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
registerAdvancements(ClientboundPackets1_18.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
registerClickWindow1_17(ClientboundPackets1_18.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_17_1.ACKNOWLEDGE_PLAYER_DIGGING);
blockRewriter.registerBlockAction(ClientboundPackets1_17_1.BLOCK_ACTION);
blockRewriter.registerEffect(ClientboundPackets1_17_1.EFFECT, 1010, 2001);
blockRewriter.registerBlockChange(ClientboundPackets1_17_1.BLOCK_CHANGE);
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_17_1.MULTI_BLOCK_CHANGE);
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_18.ACKNOWLEDGE_PLAYER_DIGGING);
blockRewriter.registerBlockAction(ClientboundPackets1_18.BLOCK_ACTION);
blockRewriter.registerEffect(ClientboundPackets1_18.EFFECT, 1010, 2001);
blockRewriter.registerBlockChange(ClientboundPackets1_18.BLOCK_CHANGE);
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_18.MULTI_BLOCK_CHANGE);
registerCreativeInvAction(ServerboundPackets1_17.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
protocol.registerServerbound(ServerboundPackets1_17.EDIT_BOOK, new PacketRemapper() {
registerCreativeInvAction(ClientboundPackets1_18.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
protocol.registerServerbound(ClientboundPackets1_18.EDIT_BOOK, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
@ -83,7 +84,7 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
registerSpawnParticle(ClientboundPackets1_17_1.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);*/
protocol.registerClientbound(ClientboundPackets1_17_1.BLOCK_ENTITY_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_18.BLOCK_ENTITY_DATA, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION1_14);
@ -107,7 +108,7 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
}
});
protocol.registerClientbound(ClientboundPackets1_17_1.CHUNK_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_18.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -184,5 +185,7 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
});
}
});
protocol.cancelClientbound(ClientboundPackets1_18.SET_SIMULATION_DISTANCE);
}
}

Datei anzeigen

@ -28,7 +28,7 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.FloatTag;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
import java.util.ArrayList;
@ -40,15 +40,15 @@ public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18
@Override
protected void registerPackets() {
/*registerTrackerWithData(ClientboundPackets1_17_1.SPAWN_ENTITY, Entity1_18Types.FALLING_BLOCK);
registerSpawnTracker(ClientboundPackets1_17_1.SPAWN_MOB);
registerTracker(ClientboundPackets1_17_1.SPAWN_EXPERIENCE_ORB, Entity1_18Types.EXPERIENCE_ORB);
registerTracker(ClientboundPackets1_17_1.SPAWN_PAINTING, Entity1_18Types.PAINTING);
registerTracker(ClientboundPackets1_17_1.SPAWN_PLAYER, Entity1_18Types.PLAYER);
registerMetadataRewriter(ClientboundPackets1_17_1.ENTITY_METADATA, Types1_17.METADATA_LIST);
registerRemoveEntities(ClientboundPackets1_17_1.REMOVE_ENTITIES);*/
/*registerTrackerWithData(ClientboundPackets1_18.SPAWN_ENTITY, Entity1_18Types.FALLING_BLOCK);
registerSpawnTracker(ClientboundPackets1_18.SPAWN_MOB);
registerTracker(ClientboundPackets1_18.SPAWN_EXPERIENCE_ORB, Entity1_18Types.EXPERIENCE_ORB);
registerTracker(ClientboundPackets1_18.SPAWN_PAINTING, Entity1_18Types.PAINTING);
registerTracker(ClientboundPackets1_18.SPAWN_PLAYER, Entity1_18Types.PLAYER);
registerMetadataRewriter(ClientboundPackets1_18.ENTITY_METADATA, Types1_17.METADATA_LIST);
registerRemoveEntities(ClientboundPackets1_18.REMOVE_ENTITIES);*/
protocol.registerClientbound(ClientboundPackets1_17_1.JOIN_GAME, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_18.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // Entity ID
@ -59,6 +59,10 @@ public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18
map(Type.NBT); // Dimension registry
map(Type.NBT); // Current dimension data
map(Type.STRING); // World
map(Type.LONG); // Seed
map(Type.VAR_INT); // Max players
map(Type.VAR_INT); // Chunk radius
read(Type.VAR_INT); // Read simulation distance
//handler(getTrackerHandler(Entity1_17Types.PLAYER, Type.INT)); //TODO
handler(worldDataTrackerHandler(1));
handler(wrapper -> {
@ -84,7 +88,7 @@ public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18
}
});
protocol.registerClientbound(ClientboundPackets1_17_1.RESPAWN, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_18.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.NBT); // Dimension data

Datei anzeigen

@ -3,7 +3,7 @@ metadata.format.version = "1.1"
[versions]
# ViaVersion
viaver = "4.1.0-21w39a-SNAPSHOT"
viaver = "4.1.0-21w40a-SNAPSHOT"
# Common provided
netty = "4.0.20.Final"