Skip to content

Commit

Permalink
A little bit of lore
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeRNG committed Mar 4, 2023
1 parent b40a886 commit adf6cf3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/dev/dfonline/codeclient/actiondump/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import dev.dfonline.codeclient.CodeClient;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtInt;
import net.minecraft.nbt.NbtList;
import net.minecraft.nbt.NbtString;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
Expand All @@ -24,7 +28,20 @@ public class Item {

public ItemStack getItem() {
ItemStack item = Registry.ITEM.get(new Identifier(material.toLowerCase())).getDefaultStack();

NbtCompound nbt = new NbtCompound();
NbtCompound display = new NbtCompound();
NbtList lore = new NbtList();
for (String line: description) {
lore.add(NbtString.of("{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"gray\",\"text\":\"%s\"}],\"text\":\"\"}".formatted(line)));
}
display.put("Lore",lore);
nbt.put("display",display);
nbt.put("HideFlags", NbtInt.of(127));
item.setNbt(nbt);

item.setCustomName(Text.literal("§b" + name));

return item;
}
}

0 comments on commit adf6cf3

Please sign in to comment.