Skip to content

Commit

Permalink
Only add custom name to item if none already exist
Browse files Browse the repository at this point in the history
  • Loading branch information
bundabrg committed Feb 17, 2021
1 parent 1d7e06a commit 1676a76
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ public ItemData mapItemDataToUpstream(ItemData item, boolean creativeOnly) {

NbtMap tag = translated.getTag();

if (itemMapperEntry.getUpstream().getCustomName() != null) {
// Rename item if no existing name is set
if (itemMapperEntry.getUpstream().getCustomName() != null && (tag == null || !tag.containsKey("display"))) {
NbtMapBuilder tagBuilder = tag != null ? tag.toBuilder() : NbtMap.builder();

tagBuilder.putCompound("display", NbtMap.builder().putString("Name", itemMapperEntry.getUpstream().getCustomName()).build());
Expand Down

0 comments on commit 1676a76

Please sign in to comment.