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

Remove translatable handler from 1.13/1.14 item handling

Lore and name weren't actually components in those versions
Fixes #207
Dieser Commit ist enthalten in:
KennyTV 2020-06-03 08:48:18 +02:00
Ursprung 38ed381094
Commit 3d50c36ce3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
6 geänderte Dateien mit 25 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -63,7 +63,7 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol {
translatableRewriter.registerTitle(0x4B, 0x48);
translatableRewriter.registerPlayerList(0x4E, 0x4A);
(blockItemPackets = new BlockItemPackets1_13(this, translatableRewriter)).register();
(blockItemPackets = new BlockItemPackets1_13(this)).register();
new EntityPackets1_13(this).register();
new PlayerPacket1_13(this).register();
new SoundPackets1_13(this).register();

Datei anzeigen

@ -13,7 +13,6 @@ package nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.packets;
import com.google.common.primitives.Ints;
import nl.matsv.viabackwards.ViaBackwards;
import nl.matsv.viabackwards.api.rewriters.EnchantmentRewriter;
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2To1_13;
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.block_entity_handlers.FlowerPotHandler;
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data.BackwardsMappings;
@ -40,17 +39,28 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import us.myles.viaversion.libs.opennbt.conversion.ConverterRegistry;
import us.myles.viaversion.libs.opennbt.tag.builtin.*;
import us.myles.viaversion.libs.opennbt.tag.builtin.ByteTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.IntTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.ShortTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.StringTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.Tag;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.ItemRewriter<Protocol1_12_2To1_13> {
private final Map<String, String> enchantmentMappings = new HashMap<>();
private final String NBT_TAG_NAME;
public BlockItemPackets1_13(Protocol1_12_2To1_13 protocol, TranslatableRewriter translatableRewriter) {
super(protocol, translatableRewriter, id -> BackwardsMappings.itemMappings.getMappedItem(id));
public BlockItemPackets1_13(Protocol1_12_2To1_13 protocol) {
super(protocol, null, id -> BackwardsMappings.itemMappings.getMappedItem(id));
NBT_TAG_NAME = "ViaBackwards|" + protocol.getClass().getSimpleName() + "|Part2";
}

Datei anzeigen

@ -38,7 +38,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
translatableRewriter.registerTitle(0x4F, 0x4B);
translatableRewriter.registerPing();
blockItemPackets = new BlockItemPackets1_14(this, translatableRewriter);
blockItemPackets = new BlockItemPackets1_14(this);
blockItemPackets.register();
entityPackets = new EntityPackets1_14(this);
entityPackets.register();

Datei anzeigen

@ -5,7 +5,6 @@ import nl.matsv.viabackwards.ViaBackwards;
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
import nl.matsv.viabackwards.api.rewriters.EnchantmentRewriter;
import nl.matsv.viabackwards.api.rewriters.RecipeRewriter;
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.Protocol1_13_2To1_14;
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.data.BackwardsMappings;
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.data.RecipeRewriter1_14;
@ -48,8 +47,8 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
private EnchantmentRewriter enchantmentRewriter;
public BlockItemPackets1_14(Protocol1_13_2To1_14 protocol, TranslatableRewriter translatableRewriter) {
super(protocol, translatableRewriter, BlockItemPackets1_14::getOldItemId, BlockItemPackets1_14::getNewItemId, id -> BackwardsMappings.itemMappings.getMappedItem(id));
public BlockItemPackets1_14(Protocol1_13_2To1_14 protocol) {
super(protocol, null, BlockItemPackets1_14::getOldItemId, BlockItemPackets1_14::getNewItemId, id -> BackwardsMappings.itemMappings.getMappedItem(id));
}
@Override

Datei anzeigen

@ -28,9 +28,6 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol {
protected void registerPackets() {
executeAsyncAfterLoaded(Protocol1_15To1_14_4.class, BackwardsMappings::init);
(blockItemPackets = new BlockItemPackets1_15(this)).register();
new EntityPackets1_15(this).register();
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
translatableRewriter.registerBossBar(0x0D, 0x0C);
translatableRewriter.registerChatMessage(0x0F, 0x0E);
@ -41,6 +38,9 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol {
translatableRewriter.registerTitle(0x50, 0x4F);
translatableRewriter.registerPing();
(blockItemPackets = new BlockItemPackets1_15(this, translatableRewriter)).register();
new EntityPackets1_15(this).register();
SoundRewriter soundRewriter = new SoundRewriter(this,
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
soundRewriter.registerSound(0x52, 0x51);

Datei anzeigen

@ -1,6 +1,7 @@
package nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.packets;
import nl.matsv.viabackwards.ViaBackwards;
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.Protocol1_14_4To1_15;
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.BackwardsMappings;
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.ParticleMapping;
@ -22,8 +23,8 @@ import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
public class BlockItemPackets1_15 extends nl.matsv.viabackwards.api.rewriters.ItemRewriter<Protocol1_14_4To1_15> {
public BlockItemPackets1_15(Protocol1_14_4To1_15 protocol) {
super(protocol, null, BlockItemPackets1_15::getOldItemId, BlockItemPackets1_15::getNewItemId, id -> BackwardsMappings.itemMappings.getMappedItem(id));
public BlockItemPackets1_15(Protocol1_14_4To1_15 protocol, TranslatableRewriter translatableRewriter) {
super(protocol, translatableRewriter, BlockItemPackets1_15::getOldItemId, BlockItemPackets1_15::getNewItemId, id -> BackwardsMappings.itemMappings.getMappedItem(id));
}
@Override
@ -94,7 +95,6 @@ public class BlockItemPackets1_15 extends nl.matsv.viabackwards.api.rewriters.It
// Entity Equipment Packet
itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, 0x47, 0x46);
// Click window packet
itemRewriter.registerClickWindow(Type.FLAT_VAR_INT_ITEM, 0x09, 0x09);