Skip to content

Commit

Permalink
More icon stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeRNG committed Mar 6, 2023
1 parent 8642eb4 commit 6ea5d24
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions src/main/java/dev/dfonline/codeclient/actiondump/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ public class Item {
public String[] description;
public String[] example;
public String[] worksWith;
public String[][] additionalInfo;
public String requiredRank;
public String requireTokens;
public String requireRankAndTokens;
public boolean advanced;
public Boolean cancellable;
public Boolean cancelledAutomatically;
public String loadedItem;

public ItemStack getItem() {
Expand All @@ -28,19 +31,34 @@ public ItemStack getItem() {
NbtCompound nbt = new NbtCompound();
NbtCompound display = new NbtCompound();
NbtList lore = new NbtList();

for (String line: description) {
addToLore(lore,line);
// lore.add(NbtString.of("{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"gray\",\"text\":\"%s\"}],\"text\":\"\"}".formatted(line)));
addToLore(lore, "§7" + line);
}
if(example != null && example.length != 0) {
lore.add(NbtString.of("{\"text\":\"\"}"));
// lore.add(NbtString.of("{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Example:\"}],\"text\":\"\"}"));
addToLore(lore,"");
addToLore(lore,"Example:");
for (String line: example) {
// CodeClient.LOGGER.info(NbtString.escape(line));
addToLore(lore,line);
// lore.add(NbtString.of("{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"gray\",\"text\":\"%s\"}],\"text\":\"\"}".formatted(.replace("\"","\\\""))));
addToLore(lore, "§7" + line);
}
}
if(additionalInfo != null && additionalInfo.length != 0) {
addToLore(lore,"");
addToLore(lore,"§9Additional Info:");
for(String[] group : additionalInfo) {
int i = 0;
for(String line: group) {
if(i == 0) addToLore(lore, "§b» §7" + line);
else addToLore(lore, "§7" + line);
i++;
}
}
}
if(cancellable != null && cancellable) {
addToLore(lore,"");
if(cancelledAutomatically) addToLore(lore, "§4∅ §cCancelled automatically");
else addToLore(lore, "§4∅ §cCancellable");
}
display.put("Lore",lore);
nbt.put("display",display);
nbt.put("HideFlags", NbtInt.of(127));
Expand Down

0 comments on commit 6ea5d24

Please sign in to comment.