diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-08-11 13:03:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-11 21:03:30 +1000 |
commit | ba69e034794b7a5dc8d950ab4ba2d12370aa509f (patch) | |
tree | 840d97ddc4c67f09f99770a86a5fbbcc5f2349d9 /src/main/java | |
parent | 4cf7ec9f8ee48b7ea22b2d514c3e7ff1be7daf0d (diff) | |
download | NotEnoughUpdates-ba69e034794b7a5dc8d950ab4ba2d12370aa509f.tar.gz NotEnoughUpdates-ba69e034794b7a5dc8d950ab4ba2d12370aa509f.tar.bz2 NotEnoughUpdates-ba69e034794b7a5dc8d950ab4ba2d12370aa509f.zip |
display name (#219)
Diffstat (limited to 'src/main/java')
7 files changed, 39 insertions, 39 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java b/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java index 06321b53..3911396f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java @@ -110,11 +110,11 @@ public class CustomItems { * SHAAAAAAAAAAAAAAAAAAME */ - private static JsonObject create(String internalname, String itemid, String displayname, String... lore) { + private static JsonObject create(String internalname, String itemid, String displayName, String... lore) { JsonObject json = new JsonObject(); json.addProperty("itemid", itemid); json.addProperty("internalname", internalname); - json.addProperty("displayname", EnumChatFormatting.RED + displayname); + json.addProperty("displayname", EnumChatFormatting.RED + displayName); JsonArray jsonlore = new JsonArray(); for (String line : lore) { jsonlore.add(new JsonPrimitive(EnumChatFormatting.GRAY + line)); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index cd0d08b5..9140120a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -207,7 +207,7 @@ public class NEUManager { } public CompletableFuture<Boolean> fetchRepository() { - return CompletableFuture.<Boolean>supplyAsync(() -> { + return CompletableFuture.supplyAsync(() -> { try { JsonObject currentCommitJSON = getJsonFromFile(new File(configLocation, "currentCommit.json")); @@ -781,14 +781,14 @@ public class NEUManager { if (itemMc != null) { itemid = itemMc.getRegistryName(); } - String displayname = display.getString("Name"); + String displayName = display.getString("Name"); String[] info = new String[0]; String clickcommand = ""; JsonObject item = new JsonObject(); item.addProperty("internalname", internalname); item.addProperty("itemid", itemid); - item.addProperty("displayname", displayname); + item.addProperty("displayname", displayName); if (tag != null && tag.hasKey("ExtraAttributes", 10)) { NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes"); @@ -1110,7 +1110,7 @@ public class NEUManager { * json files representing skyblock item data. */ public JsonObject createItemJson( - String internalname, String itemid, String displayname, String[] lore, + String internalname, String itemid, String displayName, String[] lore, String crafttext, String infoType, String[] info, String clickcommand, int damage, NBTTagCompound nbttag ) { @@ -1118,7 +1118,7 @@ public class NEUManager { new JsonObject(), internalname, itemid, - displayname, + displayName, lore, crafttext, infoType, @@ -1130,7 +1130,7 @@ public class NEUManager { } public JsonObject createItemJson( - JsonObject base, String internalname, String itemid, String displayname, String[] lore, + JsonObject base, String internalname, String itemid, String displayName, String[] lore, String crafttext, String infoType, String[] info, String clickcommand, int damage, NBTTagCompound nbttag ) { @@ -1141,7 +1141,7 @@ public class NEUManager { JsonObject json = gson.fromJson(gson.toJson(base, JsonObject.class), JsonObject.class); json.addProperty("internalname", internalname); json.addProperty("itemid", itemid); - json.addProperty("displayname", displayname); + json.addProperty("displayname", displayName); json.addProperty("crafttext", crafttext); json.addProperty("clickcommand", clickcommand); json.addProperty("damage", damage); @@ -1167,14 +1167,14 @@ public class NEUManager { } public boolean writeItemJson( - String internalname, String itemid, String displayname, String[] lore, String crafttext, + String internalname, String itemid, String displayName, String[] lore, String crafttext, String infoType, String[] info, String clickcommand, int damage, NBTTagCompound nbttag ) { return writeItemJson( new JsonObject(), internalname, itemid, - displayname, + displayName, lore, crafttext, infoType, @@ -1186,14 +1186,14 @@ public class NEUManager { } public boolean writeItemJson( - JsonObject base, String internalname, String itemid, String displayname, String[] lore, + JsonObject base, String internalname, String itemid, String displayName, String[] lore, String crafttext, String infoType, String[] info, String clickcommand, int damage, NBTTagCompound nbttag ) { JsonObject json = createItemJson( base, internalname, itemid, - displayname, + displayName, lore, crafttext, infoType, @@ -1486,11 +1486,11 @@ public class NEUManager { if (useReplacements) { replacements = getLoreReplacements(stack.getTagCompound(), -1); - String displayname = json.get("displayname").getAsString(); + String displayName = json.get("displayname").getAsString(); for (Map.Entry<String, String> entry : replacements.entrySet()) { - displayname = displayname.replace("{" + entry.getKey() + "}", entry.getValue()); + displayName = displayName.replace("{" + entry.getKey() + "}", entry.getValue()); } - stack.setStackDisplayName(displayname); + stack.setStackDisplayName(displayName); } if (json.has("lore")) { @@ -1519,7 +1519,7 @@ public class NEUManager { return NotEnoughUpdates.INSTANCE.manager .fetchRepository() .thenCompose(ignored -> NotEnoughUpdates.INSTANCE.manager.reloadRepository()) - .<List<String>>thenApply(ignored -> { + .thenApply(ignored -> { String newCommitHash = NotEnoughUpdates.INSTANCE.manager.latestRepoCommit; String newCommitShortHash = (newCommitHash == null ? "MISSING" : newCommitHash.substring(0, 7)); return Arrays.asList( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java index ff0e5f13..3d18df36 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java @@ -103,8 +103,8 @@ public class NEUItemEditor extends GuiScreen { this.itemId = addTextFieldWithSupplier(itemid, NO_SPACE); options.add(new GuiElementText("Display name: ", Color.WHITE.getRGB())); - String displayname = item.has("displayname") ? item.get("displayname").getAsString() : ""; - this.displayName = addTextFieldWithSupplier(displayname, COLOUR); + String displayName = item.has("displayname") ? item.get("displayname").getAsString() : ""; + this.displayName = addTextFieldWithSupplier(displayName, COLOUR); options.add(new GuiElementText("Lore: ", Color.WHITE.getRGB())); JsonElement loreElement = getItemInfo("lore"); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java index 72a385f1..31480016 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java @@ -1238,22 +1238,22 @@ public class RenderListener { try { JsonObject newNPC = new JsonObject(); - String displayname = lower.getDisplayName().getUnformattedText(); + String displayName = lower.getDisplayName().getUnformattedText(); File file = new File( Minecraft.getMinecraft().mcDataDir.getAbsolutePath(), "config" + File.separator + "notenoughupdates" + File.separator + "repo" + File.separator + "npc" + File.separator + - displayname.toUpperCase().replace(" ", "_") + ".json" + displayName.toUpperCase().replace(" ", "_") + ".json" ); newNPC.add("itemid", new JsonPrimitive("minecraft:skull")); - newNPC.add("displayname", new JsonPrimitive("§9" + displayname + " (NPC)")); + newNPC.add("displayname", new JsonPrimitive("§9" + displayName + " (NPC)")); newNPC.add("nbttag", new JsonPrimitive("TODO")); newNPC.add("damage", new JsonPrimitive(3)); JsonArray newArray = new JsonArray(); newArray.add(new JsonPrimitive("")); newNPC.add("lore", newArray); - newNPC.add("internalname", new JsonPrimitive(displayname.toUpperCase().replace(" ", "_") + "_NPC")); + newNPC.add("internalname", new JsonPrimitive(displayName.toUpperCase().replace(" ", "_") + "_NPC")); newNPC.add("clickcommand", new JsonPrimitive("viewrecipe")); newNPC.add("modver", new JsonPrimitive(NotEnoughUpdates.VERSION)); newNPC.add("infoType", new JsonPrimitive("WIKI_URL")); @@ -1345,7 +1345,7 @@ public class RenderListener { ) { writer.write(gson.toJson(newNPC)); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - EnumChatFormatting.AQUA + "Parsed and saved: " + EnumChatFormatting.WHITE + displayname)); + EnumChatFormatting.AQUA + "Parsed and saved: " + EnumChatFormatting.WHITE + displayName)); } } catch (IOException ignored) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java index 51ec28dd..c323cd2e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java @@ -96,8 +96,8 @@ public class BazaarSacksProfit { String internalName = entry.getKey(); JsonObject object = entry.getValue(); if (object.has("displayname")) { - String displayname = object.get("displayname").getAsString(); - if (displayname.equals(bazaarName)) { + String name = object.get("displayname").getAsString(); + if (name.equals(bazaarName)) { prices.put(internalName, amount); names.put(internalName, bazaarName); continue out; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java index 3bc92a9c..06512fa8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -95,8 +95,8 @@ public abstract class MixinGuiContainer extends GuiScreen { NBTTagCompound tag = eventGui.inventorySlots.inventorySlots.get(22).getStack().getTagCompound(); if (tag.hasKey("SkullOwner") && tag.getCompoundTag("SkullOwner").hasKey("Name")) { String tagName = tag.getCompoundTag("SkullOwner").getString("Name"); - String displayname = Utils.cleanColour(cc.inventorySlots.get(22).getStack().getDisplayName()); - if (tagName.equals(displayname.substring(displayname.length() - tagName.length()))) { + String displayName = Utils.cleanColour(cc.inventorySlots.get(22).getStack().getDisplayName()); + if (tagName.equals(displayName.substring(displayName.length() - tagName.length()))) { ci.cancel(); this.zLevel = 100.0F; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 4d546505..a99e4e7a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -841,15 +841,15 @@ public class Utils { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); } - public static ItemStack createItemStack(Item item, String displayname, String... lore) { - return createItemStack(item, displayname, 0, lore); + public static ItemStack createItemStack(Item item, String displayName, String... lore) { + return createItemStack(item, displayName, 0, lore); } - public static ItemStack createItemStack(Block item, String displayname, String... lore) { - return createItemStack(Item.getItemFromBlock(item), displayname, lore); + public static ItemStack createItemStack(Block item, String displayName, String... lore) { + return createItemStack(Item.getItemFromBlock(item), displayName, lore); } - public static ItemStack createItemStack(Item item, String displayname, int damage, String... lore) { + public static ItemStack createItemStack(Item item, String displayName, int damage, String... lore) { ItemStack stack = new ItemStack(item, 1, damage); NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound display = new NBTTagCompound(); @@ -859,7 +859,7 @@ public class Utils { Lore.appendTag(new NBTTagString(line)); } - display.setString("Name", displayname); + display.setString("Name", displayName); display.setTag("Lore", Lore); tag.setTag("display", display); @@ -1425,12 +1425,12 @@ public class Utils { file.delete(); } - public static char getPrimaryColourCode(String displayname) { + public static char getPrimaryColourCode(String displayName) { int lastColourCode = -99; int currentColour = 0; int[] mostCommon = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - for (int i = 0; i < displayname.length(); i++) { - char c = displayname.charAt(i); + for (int i = 0; i < displayName.length(); i++) { + char c = displayName.charAt(i); if (c == '\u00A7') { lastColourCode = i; } else if (lastColourCode == i - 1) { @@ -1457,8 +1457,8 @@ public class Utils { return "0123456789abcdef".charAt(currentColour); } - public static Color getPrimaryColour(String displayname) { - int colourInt = Minecraft.getMinecraft().fontRendererObj.getColorCode(getPrimaryColourCode(displayname)); + public static Color getPrimaryColour(String displayName) { + int colourInt = Minecraft.getMinecraft().fontRendererObj.getColorCode(getPrimaryColourCode(displayName)); return new Color(colourInt).darker(); } |