mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-11 07:57:33 +00:00
allow setOverrideName to remove name overrides (#643)
This commit is contained in:
1 parent
f3add01e74
commit
07cec30f3e
1 file changed
+8
-2
@@ -3,6 +3,7 @@ package codechicken.nei.api;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -164,8 +165,13 @@ public class API {
|
||||
* Add or replace the name normally shown on the item tooltip
|
||||
*/
|
||||
public static void setOverrideName(ItemStack item, String name) {
|
||||
if (!name.equals(ItemInfo.nameOverrides.get(item))) {
|
||||
ItemInfo.nameOverrides.put(item, name);
|
||||
String existing = ItemInfo.nameOverrides.get(item);
|
||||
if (!Objects.equals(name, existing)) {
|
||||
if (name == null) {
|
||||
ItemInfo.nameOverrides.remove(item);
|
||||
} else {
|
||||
ItemInfo.nameOverrides.put(item, name);
|
||||
}
|
||||
LayoutManager.markItemsDirty();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user