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

Handle item_name item data for component rewriting

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-06-17 12:58:39 +02:00
Ursprung bba0a3a3a6
Commit e662640377
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
3 geänderte Dateien mit 4 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -69,7 +69,7 @@ import java.util.logging.Logger;
public interface ViaBackwardsPlatform { public interface ViaBackwardsPlatform {
String MINIMUM_VV_VERSION = "5.0.0"; String MINIMUM_VV_VERSION = "5.0.1";
/** /**
* Initialize ViaBackwards. * Initialize ViaBackwards.

Datei anzeigen

@ -67,14 +67,8 @@ public class BackwardsStructuredItemRewriter<C extends ClientboundPacketType, S
if (protocol.getComponentRewriter() != null) { if (protocol.getComponentRewriter() != null) {
// Handle name and lore components // Handle name and lore components
final StructuredData<Tag> customNameData = dataContainer.getNonEmpty(StructuredDataKey.CUSTOM_NAME); updateComponent(connection, item, StructuredDataKey.ITEM_NAME, "item_name");
if (customNameData != null) { updateComponent(connection, item, StructuredDataKey.CUSTOM_NAME, "custom_name");
final Tag originalName = customNameData.value().copy();
protocol.getComponentRewriter().processTag(connection, customNameData.value());
if (!customNameData.value().equals(originalName)) {
saveTag(createCustomTag(item), originalName, "Name");
}
}
final StructuredData<Tag[]> loreData = dataContainer.getNonEmpty(StructuredDataKey.LORE); final StructuredData<Tag[]> loreData = dataContainer.getNonEmpty(StructuredDataKey.LORE);
if (loreData != null) { if (loreData != null) {
@ -115,7 +109,7 @@ public class BackwardsStructuredItemRewriter<C extends ClientboundPacketType, S
// Set custom name - only done if there is no original one // Set custom name - only done if there is no original one
if (!dataContainer.contains(StructuredDataKey.CUSTOM_NAME)) { if (!dataContainer.contains(StructuredDataKey.CUSTOM_NAME)) {
dataContainer.set(StructuredDataKey.CUSTOM_NAME, mappedItem.tagName()); dataContainer.set(StructuredDataKey.CUSTOM_NAME, mappedItem.tagName());
tag.putBoolean(nbtTagName("customName"), true); tag.putBoolean(nbtTagName("added_custom_name"), true);
} }
updateItemComponents(connection, dataContainer, this::handleItemToClient, itemIdRewriter, blockIdRewriter); updateItemComponents(connection, dataContainer, this::handleItemToClient, itemIdRewriter, blockIdRewriter);

Datei anzeigen

@ -4,7 +4,6 @@ rootProject.name = "viabackwards-parent"
dependencyResolutionManagement { dependencyResolutionManagement {
repositories { repositories {
mavenLocal()
maven("https://repo.viaversion.com") maven("https://repo.viaversion.com")
maven("https://repo.papermc.io/repository/maven-public/") maven("https://repo.papermc.io/repository/maven-public/")
mavenCentral() mavenCentral()