Skip to content

Commit d81d8eb

Browse files
committed
better explanation for DISPLAY_NAME and CUSTOM_NAME Keys
closes #2388
1 parent 0d87f86 commit d81d8eb

File tree

1 file changed

+5
-2
lines changed
  • src/main/java/org/spongepowered/api/data

1 file changed

+5
-2
lines changed

src/main/java/org/spongepowered/api/data/Keys.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ public final class Keys {
624624

625625
/**
626626
* The custom name of an {@link Entity}, {@link ItemStack} or {@link BlockEntity}.
627+
* <p>If no custom name is set the dataholder may still have a {@link Keys#DISPLAY_NAME}</p>
627628
*/
628629
public static final Key<Value<Component>> CUSTOM_NAME = Keys.key(ResourceKey.sponge("custom_name"), Component.class);
629630

@@ -678,8 +679,10 @@ public final class Keys {
678679
/**
679680
* The display name of an {@link Entity}, {@link ItemStack} or {@link BlockEntity}.
680681
*
681-
* <p>On an {@link Entity}, this represents a combination of {@link Keys#CUSTOM_NAME} (if set), scoreboard info, and any click data. As such
682-
* this is readonly.</p>
682+
* <p>To change a display name set a {@link Keys#CUSTOM_NAME} instead.</p>
683+
* <p>On an {@link Entity}, this represents a combination of {@link Keys#CUSTOM_NAME} (if set), scoreboard info, and any click data.</p>
684+
* <p>On an {@link ItemStack}, this represents the {@link Keys#CUSTOM_NAME} or if not set the {@link ItemType}s translation.
685+
* <p>On a {@link BlockEntity}, this usually represents the name displayed in its {@link org.spongepowered.api.item.inventory.Container}
683686
*/
684687
public static final Key<Value<Component>> DISPLAY_NAME = Keys.key(ResourceKey.sponge("display_name"), Component.class);
685688

0 commit comments

Comments
 (0)