Skip to content

Commit

Permalink
Merge pull request #171 from foxwhite25/master
Browse files Browse the repository at this point in the history
二合一样板输入映像(ME)在接口终端中如果主控有自定义名称则使用自定义名称
  • Loading branch information
reobf authored Feb 17, 2025
2 parents 4340247 + 909334b commit 1f5909c
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,15 @@ public String getName() {
return getLocalName();
}
StringBuilder name = new StringBuilder();

name.append(
Optional.ofNullable(m.getMachineCraftingIcon()).map(s->s.getDisplayName()+"(Mapped)")
.orElse(m.getLocalName()==null?"":m.getLocalName()+"(Mapped)"));
String masterName;
if (m instanceof IInterfaceViewable) {
masterName = ((IInterfaceViewable) m).getName();
} else {
masterName = Optional.ofNullable(m.getMachineCraftingIcon()).map(ItemStack::getDisplayName)
.orElse(m.getLocalName()==null?getLocalName():m.getLocalName());
}
name.append(masterName);
name.append("(Mapped)");
if (m.mInventory[m.getCircuitSlot()] != null) {
name.append(" - ");
ItemStack is = m.mInventory[m.getCircuitSlot()];
Expand Down Expand Up @@ -771,7 +776,7 @@ public void setCustomName(String name) {
@Override
public boolean hasCustomName() {

return customName != null && (!customName.equals(""));
return customName != null && (!customName.isEmpty());
}

public boolean isInputEmpty(T master) {
Expand Down

0 comments on commit 1f5909c

Please sign in to comment.