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:
Ursprung
bba0a3a3a6
Commit
e662640377
@ -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.
|
||||||
|
@ -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);
|
||||||
|
@ -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()
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren