3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-27 00:22:53 +01:00
Dieser Commit ist enthalten in:
Nassim Jahnke 2023-12-18 19:22:46 +01:00
Ursprung 4fe53f5ab8
Commit ba725df33e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
14 geänderte Dateien mit 438 neuen und 46 gelöschten Zeilen

Datei anzeigen

@ -52,6 +52,7 @@ import com.viaversion.viabackwards.protocol.protocol1_19_3to1_19_4.Protocol1_19_
import com.viaversion.viabackwards.protocol.protocol1_19_4to1_20.Protocol1_19_4To1_20;
import com.viaversion.viabackwards.protocol.protocol1_19to1_19_1.Protocol1_19To1_19_1;
import com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.Protocol1_20_2To1_20_3;
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.Protocol1_20_3To1_20_5;
import com.viaversion.viabackwards.protocol.protocol1_20to1_20_2.Protocol1_20To1_20_2;
import com.viaversion.viabackwards.protocol.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2To1_9_3_4;
import com.viaversion.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
@ -67,7 +68,7 @@ import java.util.logging.Logger;
public interface ViaBackwardsPlatform {
String MINIMUM_VV_VERSION = "4.9.3";
String MINIMUM_VV_VERSION = "4.10.0";
/**
* Initialize ViaBackwards.
@ -136,6 +137,7 @@ public interface ViaBackwardsPlatform {
protocolManager.registerProtocol(new Protocol1_19_4To1_20(), ProtocolVersion.v1_19_4, ProtocolVersion.v1_20);
protocolManager.registerProtocol(new Protocol1_20To1_20_2(), ProtocolVersion.v1_20, ProtocolVersion.v1_20_2);
protocolManager.registerProtocol(new Protocol1_20_2To1_20_3(), ProtocolVersion.v1_20_2, ProtocolVersion.v1_20_3);
protocolManager.registerProtocol(new Protocol1_20_3To1_20_5(), ProtocolVersion.v1_20_3, ProtocolVersion.v1_20_5);
}
/**
@ -149,7 +151,7 @@ public interface ViaBackwardsPlatform {
String vvVersion = Via.getPlatform().getPluginVersion();
if (vvVersion != null && new Version(vvVersion).compareTo(new Version(MINIMUM_VV_VERSION + "--")) < 0) {
getLogger().severe("================================");
getLogger().severe("YOUR VIAVERSION IS OUTDATED");
getLogger().severe("YOUR VIAVERSION IS OUTDATED (you are running " + vvVersion + ")");
getLogger().severe("PLEASE USE VIAVERSION " + MINIMUM_VV_VERSION + " OR NEWER");
getLogger().severe("LINK: https://ci.viaversion.com/");
getLogger().severe("VIABACKWARDS WILL NOW DISABLE");

Datei anzeigen

@ -199,11 +199,36 @@ public abstract class EntityRewriterBase<C extends ClientboundPacketType, T exte
} else if (type == particleType) {
rewriteParticle(meta.value());
} else if (type == optionalComponentType || type == componentType) {
JsonElement text = meta.value();
if (text != null) {
protocol.getTranslatableRewriter().processText(text);
}
});
}
public void registerMetaTypeHandler1_20_3(
@Nullable MetaType itemType,
@Nullable MetaType blockStateType,
@Nullable MetaType optionalBlockStateType,
@Nullable MetaType particleType,
@Nullable MetaType componentType,
@Nullable MetaType optionalComponentType
) {
filter().handler((event, meta) -> {
MetaType type = meta.metaType();
if (type == itemType) {
protocol.getItemRewriter().handleItemToClient(meta.value());
} else if (type == blockStateType) {
int data = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
} else if (type == optionalBlockStateType) {
int data = meta.value();
if (data != 0) {
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
}
} else if (type == particleType) {
rewriteParticle(meta.value());
} else if (type == optionalComponentType || type == componentType) {
protocol.getTranslatableRewriter().processTag(meta.value());
}
});
}

Datei anzeigen

@ -32,12 +32,12 @@ public class BackwardsMappings extends com.viaversion.viabackwards.api.data.Back
@Override
protected void loadExtras(final CompoundTag data) {
super.loadExtras(data);
for (Map.Entry<String, String> entry : Protocol1_16To1_15_2.MAPPINGS.getAttributeMappings().entrySet()) {
for (Map.Entry<String, String> entry : Protocol1_16To1_15_2.MAPPINGS.attributeIdentifierMappings().entrySet()) {
attributeMappings.put(entry.getValue(), entry.getKey());
}
}
public Map<String, String> getAttributeMappings() {
public Map<String, String> attributeIdentifierMappings() {
return attributeMappings;
}
}

Datei anzeigen

@ -190,7 +190,7 @@ public class EntityPackets1_16 extends EntityRewriter<ClientboundPackets1_16, Pr
int size = wrapper.passthrough(Type.INT);
for (int i = 0; i < size; i++) {
String attributeIdentifier = wrapper.read(Type.STRING);
String oldKey = protocol.getMappingData().getAttributeMappings().get(attributeIdentifier);
String oldKey = protocol.getMappingData().attributeIdentifierMappings().get(attributeIdentifier);
wrapper.write(Type.STRING, oldKey != null ? oldKey : Key.stripMinecraftNamespace(attributeIdentifier));
wrapper.passthrough(Type.DOUBLE);

Datei anzeigen

@ -0,0 +1,113 @@
/*
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
* Copyright (C) 2023 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;
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.TranslatableRewriter;
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.viaversion.api.connection.UserConnection;
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.ServerboundPacketType;
import com.viaversion.viaversion.api.protocol.packet.State;
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.rewriter.ComponentRewriter.ReadType;
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
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 static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.20.5", "1.20.3", Protocol1_20_5To1_20_3.class);
private final EntityPacketRewriter1_20_5 entityRewriter = new EntityPacketRewriter1_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);
public Protocol1_20_3To1_20_5() {
super(ClientboundPackets1_20_3.class, ClientboundPackets1_20_3.class, ServerboundPackets1_20_3.class, ServerboundPackets1_20_3.class);
}
@Override
protected void registerPackets() {
super.registerPackets();
final TagRewriter<ClientboundPackets1_20_3> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS);
tagRewriter.registerGeneric(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.UPDATE_TAGS);
final SoundRewriter<ClientboundPackets1_20_3> soundRewriter = new SoundRewriter<>(this);
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND);
soundRewriter.registerSound(ClientboundPackets1_20_3.ENTITY_SOUND);
soundRewriter.registerStopSound(ClientboundPackets1_20_3.STOP_SOUND);
new StatisticsRewriter<>(this).register(ClientboundPackets1_20_3.STATISTICS);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.ACTIONBAR);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.TITLE_TEXT);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.TITLE_SUBTITLE);
translatableRewriter.registerBossBar(ClientboundPackets1_20_3.BOSSBAR);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.DISCONNECT);
translatableRewriter.registerTabList(ClientboundPackets1_20_3.TAB_LIST);
translatableRewriter.registerCombatKill1_20(ClientboundPackets1_20_3.COMBAT_KILL);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.SYSTEM_CHAT);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.DISGUISED_CHAT);
translatableRewriter.registerPing();
}
@Override
public void init(final UserConnection user) {
addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_20_5.PLAYER));
}
@Override
public BackwardsMappings getMappingData() {
return MAPPINGS;
}
@Override
public EntityPacketRewriter1_20_5 getEntityRewriter() {
return entityRewriter;
}
@Override
public BlockItemPacketRewriter1_20_5 getItemRewriter() {
return itemRewriter;
}
@Override
public TranslatableRewriter<ClientboundPackets1_20_3> getTranslatableRewriter() {
return translatableRewriter;
}
@Override
protected ClientboundPacketType clientboundFinishConfigurationPacket() {
return ClientboundConfigurationPackets1_20_3.FINISH_CONFIGURATION;
}
@Override
protected ServerboundPacketType serverboundFinishConfigurationPacket() {
return ServerboundConfigurationPackets1_20_2.FINISH_CONFIGURATION;
}
}

Datei anzeigen

@ -0,0 +1,58 @@
/*
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
* Copyright (C) 2023 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.rewriter;
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.viaversion.api.type.Type;
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.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.rewriter.BlockRewriter;
public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<ClientboundPackets1_20_3, ServerboundPackets1_20_3, Protocol1_20_3To1_20_5> {
public BlockItemPacketRewriter1_20_5(final Protocol1_20_3To1_20_5 protocol) {
super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY);
}
@Override
public void registerPackets() {
final BlockRewriter<ClientboundPackets1_20_3> blockRewriter = BlockRewriter.for1_20_2(protocol);
blockRewriter.registerBlockAction(ClientboundPackets1_20_3.BLOCK_ACTION);
blockRewriter.registerBlockChange(ClientboundPackets1_20_3.BLOCK_CHANGE);
blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_3.MULTI_BLOCK_CHANGE);
blockRewriter.registerEffect(ClientboundPackets1_20_3.EFFECT, 1010, 2001);
blockRewriter.registerChunkData1_19(ClientboundPackets1_20_3.CHUNK_DATA, ChunkType1_20_2::new);
blockRewriter.registerBlockEntityData(ClientboundPackets1_20_3.BLOCK_ENTITY_DATA);
registerSetCooldown(ClientboundPackets1_20_3.COOLDOWN);
registerWindowItems1_17_1(ClientboundPackets1_20_3.WINDOW_ITEMS);
registerSetSlot1_17_1(ClientboundPackets1_20_3.SET_SLOT);
registerAdvancements1_20_3(ClientboundPackets1_20_3.ADVANCEMENTS);
registerEntityEquipmentArray(ClientboundPackets1_20_3.ENTITY_EQUIPMENT);
registerClickWindow1_17_1(ServerboundPackets1_20_3.CLICK_WINDOW);
registerTradeList1_19(ClientboundPackets1_20_3.TRADE_LIST);
registerCreativeInvAction(ServerboundPackets1_20_3.CREATIVE_INVENTORY_ACTION);
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_3.WINDOW_PROPERTY);
registerSpawnParticle1_19(ClientboundPackets1_20_3.SPAWN_PARTICLE);
new RecipeRewriter1_20_3<>(protocol).register(ClientboundPackets1_20_3.DECLARE_RECIPES);
}
}

Datei anzeigen

@ -0,0 +1,167 @@
/*
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
* Copyright (C) 2023 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.rewriter;
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.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
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_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;
public final class EntityPacketRewriter1_20_5 extends EntityRewriter<ClientboundPackets1_20_3, Protocol1_20_3To1_20_5> {
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);
}
@Override
public void registerPackets() {
registerTrackerWithData1_19(ClientboundPackets1_20_3.SPAWN_ENTITY, EntityTypes1_20_5.FALLING_BLOCK);
registerMetadataRewriter(ClientboundPackets1_20_3.ENTITY_METADATA, Types1_20_5.METADATA_LIST, Types1_20_3.METADATA_LIST);
registerRemoveEntities(ClientboundPackets1_20_3.REMOVE_ENTITIES);
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.REGISTRY_DATA, new PacketHandlers() {
@Override
protected void register() {
map(Type.COMPOUND_TAG); // Registry data
handler(configurationDimensionDataHandler()); // Caches dimensions to access data like height later
handler(configurationBiomeSizeTracker()); // Tracks the amount of biomes sent for chunk data
}
});
protocol.registerClientbound(ClientboundPackets1_20_3.JOIN_GAME, new PacketHandlers() {
@Override
public void register() {
map(Type.INT); // Entity id
map(Type.BOOLEAN); // Hardcore
map(Type.STRING_ARRAY); // World List
map(Type.VAR_INT); // Max players
map(Type.VAR_INT); // View distance
map(Type.VAR_INT); // Simulation distance
map(Type.BOOLEAN); // Reduced debug info
map(Type.BOOLEAN); // Show death screen
map(Type.BOOLEAN); // Limited crafting
map(Type.STRING); // Dimension key
map(Type.STRING); // World
handler(worldDataTrackerHandlerByKey()); // Tracks world height and name for chunk data and entity (un)tracking
}
});
protocol.registerClientbound(ClientboundPackets1_20_3.RESPAWN, new PacketHandlers() {
@Override
public void register() {
map(Type.STRING); // Dimension
map(Type.STRING); // World
handler(worldDataTrackerHandlerByKey()); // Tracks world height and name for chunk data and entity (un)tracking
}
});
protocol.registerClientbound(ClientboundPackets1_20_3.ENTITY_EFFECT, wrapper -> {
wrapper.passthrough(Type.VAR_INT); // Entity ID
wrapper.passthrough(Type.VAR_INT); // Effect ID
wrapper.passthrough(Type.BYTE); // Amplifier
wrapper.passthrough(Type.VAR_INT); // Duration
wrapper.passthrough(Type.BYTE); // Flags
wrapper.write(Type.OPTIONAL_COMPOUND_TAG, null); // Add empty factor data
});
protocol.registerClientbound(ClientboundPackets1_20_3.ENTITY_PROPERTIES, wrapper -> {
wrapper.passthrough(Type.VAR_INT); // Entity ID
final int size = wrapper.passthrough(Type.VAR_INT);
int newSize = size;
for (int i = 0; i < size; i++) {
// From a registry int ID to a string
final int id = protocol.getMappingData().getAttributeMappings().getNewId(wrapper.read(Type.VAR_INT));
if (id == -1) {
// Remove new attributes from the list
newSize--;
wrapper.read(Type.DOUBLE); // Base
final int modifierSize = wrapper.read(Type.VAR_INT);
for (int j = 0; j < modifierSize; j++) {
wrapper.read(Type.UUID); // ID
wrapper.read(Type.DOUBLE); // Amount
wrapper.read(Type.BYTE); // Operation
}
continue;
}
final String attribute = AttributeMappings.attribute(id);
wrapper.write(Type.STRING, attribute);
wrapper.passthrough(Type.DOUBLE); // Base
final int modifierSize = wrapper.passthrough(Type.VAR_INT);
for (int j = 0; j < modifierSize; j++) {
wrapper.passthrough(Type.UUID); // ID
wrapper.passthrough(Type.DOUBLE); // Amount
wrapper.passthrough(Type.BYTE); // Operation
}
}
wrapper.set(Type.VAR_INT, 1, newSize);
});
}
@Override
protected void registerRewrites() {
filter().handler((event, meta) -> {
int id = meta.metaType().typeId();
if (id >= Types1_20_5.META_TYPES.armadilloState.typeId()) {
id--;
}
meta.setMetaType(Types1_20_3.META_TYPES.byId(id));
});
registerMetaTypeHandler1_20_3(
Types1_20_3.META_TYPES.itemType,
Types1_20_3.META_TYPES.blockStateType,
Types1_20_3.META_TYPES.optionalBlockStateType,
Types1_20_3.META_TYPES.particleType,
Types1_20_3.META_TYPES.componentType,
Types1_20_3.META_TYPES.optionalComponentType
);
filter().filterFamily(EntityTypes1_20_5.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
});
filter().type(EntityTypes1_20_5.ARMADILLO).removeIndex(17); // State
}
@Override
public void onMappingDataLoaded() {
mapTypes();
mapEntityTypeWithData(EntityTypes1_20_5.ARMADILLO, EntityTypes1_20_5.COW).tagName();
}
@Override
public EntityType typeFromId(final int type) {
return EntityTypes1_20_5.getTypeFromId(type);
}
}

Datei anzeigen

@ -1,4 +1,29 @@
{
"1.20.5": {
"attribute.name.generic.block_interaction_range": "Block Interaction Range",
"attribute.name.generic.entity_interaction_range": "Entity Interaction Range",
"attribute.name.generic.scale": "Scale",
"attribute.name.generic.step_height": "Step Height",
"entity.minecraft.armadillo": "Armadillo",
"item.minecraft.armadillo_scute": "Armadillo Scute",
"item.minecraft.armadillo_spawn_egg": "Armadillo Spawn Egg",
"item.minecraft.turtle_scute": "Turtle Scute",
"item.minecraft.wolf_armor": "Wolf Armor",
"subtitles.entity.armadillo.ambient": "Armadillo grunts",
"subtitles.entity.armadillo.brush": "Armadillo brushes",
"subtitles.entity.armadillo.death": "Armadillo dies",
"subtitles.entity.armadillo.eat": "Armadillo eats",
"subtitles.entity.armadillo.hurt": "Armadillo hurts",
"subtitles.entity.armadillo.land": "Armadillo lands",
"subtitles.entity.armadillo.roll": "Armadillo rolls up",
"subtitles.entity.armadillo.scute_drop": "Scute drops",
"subtitles.entity.armadillo.unroll": "Armadillo unrolls",
"subtitles.entity.breeze.charge": "Breeze charges",
"subtitles.entity.breeze.deflect": "Breeze deflects",
"subtitles.entity.breeze.whirl": "Breeze whirls",
"subtitles.item.armor.equip_wolf": "Wolf armor straps",
"subtitles.item.armor.unequip_wolf": "Wolf armor slips off"
},
"1.20.3": {
"accessibility.onboarding.accessibility.button": "Accessibility Settings...",
"argument.style.invalid": "Invalid style: %s",

Datei anzeigen

@ -1,7 +1,7 @@
projectVersion=4.9.2-SNAPSHOT
projectVersion=4.10.0-23w51b-SNAPSHOT
# Smile emoji
mcVersions=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
mcVersionRange=1.10-1.20.3
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
mcVersionRange=1.10-1.20.4
waterfallVersion=1.20
velocityVersion=3.2

Datei anzeigen

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

Datei anzeigen

@ -24,38 +24,38 @@ import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
import com.viaversion.viabackwards.template.protocol.rewriter.BlockItemPacketRewriter1_99;
import com.viaversion.viabackwards.template.protocol.rewriter.EntityPacketRewriter1_99;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
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.ServerboundPacketType;
import com.viaversion.viaversion.api.protocol.packet.State;
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.Protocol1_20_3To1_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.rewriter.ComponentRewriter.ReadType;
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter;
import org.checkerframework.checker.nullness.qual.Nullable;
// Placeholders to replace (in the entire package):
// Protocol1_98To_99, EntityPacketRewriter1_99, BlockItemPacketRewriter1_99
// Protocol1_20_3To1_20_2 (the ViaVersion protocol class the mappings depend on)
// Protocol1_20_5To1_20_3 (the ViaVersion protocol class the mappings depend on)
// ClientboundPackets1_20_3
// ServerboundPackets1_20_3
// ClientboundConfigurationPackets1_20_3
// ServerboundConfigurationPackets1_20_2
// EntityTypes1_20_3 (UNMAPPED type)
// EntityTypes1_20_5 (UNMAPPED type)
// 1.99, 1.98
public final class Protocol1_98To_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_3, ClientboundPackets1_20_3, ServerboundPackets1_20_3, ServerboundPackets1_20_3> {
// 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_3To1_20_2.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 BlockItemPacketRewriter1_99 itemRewriter = new BlockItemPacketRewriter1_99(this);
private final TranslatableRewriter<ClientboundPackets1_20_3> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT);
public Protocol1_98To_99() {
public Protocol1_98To1_99() {
super(ClientboundPackets1_20_3.class, ClientboundPackets1_20_3.class, ServerboundPackets1_20_3.class, ServerboundPackets1_20_3.class);
}
@ -65,6 +65,7 @@ public final class Protocol1_98To_99 extends BackwardsProtocol<ClientboundPacket
final TagRewriter<ClientboundPackets1_20_3> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS);
tagRewriter.registerGeneric(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.UPDATE_TAGS);
final SoundRewriter<ClientboundPackets1_20_3> soundRewriter = new SoundRewriter<>(this);
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND);
@ -85,11 +86,13 @@ public final class Protocol1_98To_99 extends BackwardsProtocol<ClientboundPacket
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.SYSTEM_CHAT);
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.DISGUISED_CHAT);
translatableRewriter.registerPing();
// TODO Attributes
}
@Override
public void init(final UserConnection user) {
addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_20_3.PLAYER));
addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_20_5.PLAYER));
}
@Override
@ -107,7 +110,7 @@ public final class Protocol1_98To_99 extends BackwardsProtocol<ClientboundPacket
return itemRewriter;
}
@Nullable
@Override
public TranslatableRewriter<ClientboundPackets1_20_3> getTranslatableRewriter() {
return translatableRewriter;
}

Datei anzeigen

@ -18,7 +18,7 @@
package com.viaversion.viabackwards.template.protocol.rewriter;
import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
import com.viaversion.viabackwards.template.protocol.Protocol1_98To_99;
import com.viaversion.viabackwards.template.protocol.Protocol1_98To1_99;
import com.viaversion.viaversion.api.type.Type;
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;
@ -29,9 +29,9 @@ import com.viaversion.viaversion.rewriter.BlockRewriter;
// To replace if needed:
// ChunkType1_20_2
// RecipeRewriter1_20_3
public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundPackets1_20_3, ServerboundPackets1_20_3, Protocol1_98To_99> {
public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundPackets1_20_3, ServerboundPackets1_20_3, Protocol1_98To1_99> {
public BlockItemPacketRewriter1_99(final Protocol1_98To_99 protocol) {
public BlockItemPacketRewriter1_99(final Protocol1_98To1_99 protocol) {
super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY);
}

Datei anzeigen

@ -18,29 +18,29 @@
package com.viaversion.viabackwards.template.protocol.rewriter;
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
import com.viaversion.viabackwards.template.protocol.Protocol1_98To_99;
import com.viaversion.viabackwards.template.protocol.Protocol1_98To1_99;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
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_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;
// Replace if needed
// Types1_OLD
// Types1_20_3
public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPackets1_20_3, Protocol1_98To_99> {
// Types1_20_5
public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPackets1_20_3, Protocol1_98To1_99> {
public EntityPacketRewriter1_99(final Protocol1_98To_99 protocol) {
super(protocol, Types1_20_3.META_TYPES.optionalComponentType, Types1_20_3.META_TYPES.booleanType);
public EntityPacketRewriter1_99(final Protocol1_98To1_99 protocol) {
super(protocol, Types1_20_5.META_TYPES.optionalComponentType, Types1_20_5.META_TYPES.booleanType);
}
@Override
public void registerPackets() {
registerTrackerWithData1_19(ClientboundPackets1_20_3.SPAWN_ENTITY, EntityTypes1_20_3.FALLING_BLOCK);
registerMetadataRewriter(ClientboundPackets1_20_3.ENTITY_METADATA, /*Types1_OLD.METADATA_LIST, */Types1_20_3.METADATA_LIST); // Specify old and new metadata list if changed
registerTrackerWithData1_19(ClientboundPackets1_20_3.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
registerRemoveEntities(ClientboundPackets1_20_3.REMOVE_ENTITIES);
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.REGISTRY_DATA, new PacketHandlers() {
@ -93,23 +93,22 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
meta.setMetaType(Types1_20_3.META_TYPES.byId(id));
});*/
//TODO Component needs to handle tags
registerMetaTypeHandler(
Types1_20_3.META_TYPES.itemType,
Types1_20_3.META_TYPES.blockStateType,
Types1_20_3.META_TYPES.optionalBlockStateType,
Types1_20_3.META_TYPES.particleType,
Types1_20_3.META_TYPES.componentType,
Types1_20_3.META_TYPES.optionalComponentType
registerMetaTypeHandler1_20_3(
Types1_20_5.META_TYPES.itemType,
Types1_20_5.META_TYPES.blockStateType,
Types1_20_5.META_TYPES.optionalBlockStateType,
Types1_20_5.META_TYPES.particleType,
Types1_20_5.META_TYPES.componentType,
Types1_20_5.META_TYPES.optionalComponentType
);
filter().filterFamily(EntityTypes1_20_3.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
filter().filterFamily(EntityTypes1_20_5.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
});
// Remove metadata of new entity type
// filter().type(Entity1_xTypes.SNIFFER).removeIndex(newIndex);
// filter().type(EntityTypes1_20_5.SNIFFER).removeIndex(newIndex);
}
@Override
@ -117,11 +116,11 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
// If types changed, uncomment to map them
// mapTypes();
// mapEntityTypeWithData(EntityTypes1_20_3.SNIFFER, EntityTypes1_20_3.RAVAGER).tagName();
// mapEntityTypeWithData(EntityTypes1_20_5.SNIFFER, EntityTypes1_20_5.RAVAGER).tagName();
}
@Override
public EntityType typeFromId(final int type) {
return EntityTypes1_20_3.getTypeFromId(type);
return EntityTypes1_20_5.getTypeFromId(type);
}
}