3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-26 00:00:33 +01:00
Informative commit message I know
Dieser Commit ist enthalten in:
Nassim Jahnke 2024-06-14 00:58:32 +02:00
Ursprung 65d829065a
Commit bb927b31f7
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
3 geänderte Dateien mit 9 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -90,7 +90,7 @@ public class BackwardsStructuredItemRewriter<C extends ClientboundPacketType, S
item.setIdentifier(mappingData.getNewItemId(item.identifier()));
}
updateItemComponents(connection, dataContainer, this::handleItemToClient, mappingData != null ? mappingData::getNewItemId : null);
updateItemComponents(connection, dataContainer, this::handleItemToClient, mappingData != null ? mappingData::getNewItemId : null, mappingData != null ? mappingData::getNewBlockId : null);
return item;
}
@ -110,7 +110,7 @@ public class BackwardsStructuredItemRewriter<C extends ClientboundPacketType, S
tag.putBoolean(nbtTagName("customName"), true);
}
updateItemComponents(connection, dataContainer, this::handleItemToClient, mappingData::getNewItemId);
updateItemComponents(connection, dataContainer, this::handleItemToClient, mappingData::getNewItemId, mappingData::getNewBlockId);
return item;
}
@ -144,7 +144,7 @@ public class BackwardsStructuredItemRewriter<C extends ClientboundPacketType, S
}
restoreTextComponents(item);
updateItemComponents(connection, dataContainer, this::handleItemToServer, mappingData != null ? mappingData::getOldItemId : null);
updateItemComponents(connection, dataContainer, this::handleItemToServer, mappingData != null ? mappingData::getOldItemId : null, mappingData != null ? mappingData::getOldBlockId : null);
return item;
}

Datei anzeigen

@ -40,6 +40,7 @@ import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntFunction;
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.packet.ServerboundPacket1_20_3;
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.packet.ServerboundPackets1_20_3;
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.rewriter.RecipeRewriter1_20_3;
@ -353,6 +354,11 @@ public final class BlockItemPacketRewriter1_20_5 extends BackwardsStructuredItem
return oldItem;
}
@Override
protected void updateItemComponents(final UserConnection connection, final StructuredDataContainer container, final ItemHandler itemHandler, @Nullable final Int2IntFunction idRewriter, @Nullable final Int2IntFunction blockIdRewriter) {
// Items and data within components are handled in this protocol
}
@Override
public Item handleItemToServer(final UserConnection connection, @Nullable final Item item) {
if (item == null) {

Datei anzeigen

@ -127,7 +127,6 @@ public final class BlockItemPacketRewriter1_21 extends BackwardsStructuredItemRe
final StructuredDataContainer data = item.dataContainer();
data.setIdLookup(protocol, true);
data.replaceKey(StructuredDataKey.FOOD1_21, StructuredDataKey.FOOD1_20_5);
// Enchantments
final EnchantmentsPaintingsStorage storage = connection.get(EnchantmentsPaintingsStorage.class);
@ -163,8 +162,6 @@ public final class BlockItemPacketRewriter1_21 extends BackwardsStructuredItemRe
final StructuredDataContainer dataContainer = item.dataContainer();
dataContainer.setIdLookup(protocol, false);
dataContainer.replaceKey(StructuredDataKey.FOOD1_20_5, StructuredDataKey.FOOD1_21);
// Rewrite enchantments
final EnchantmentsPaintingsStorage storage = connection.get(EnchantmentsPaintingsStorage.class);
rewriteEnchantmentToServer(storage, item, StructuredDataKey.ENCHANTMENTS);