11package dev .dfonline .codeclient .hypercube .actiondump ;
22
3+ import com .ibm .icu .text .CaseMap ;
34import dev .dfonline .codeclient .Utility ;
45import dev .dfonline .codeclient .data .DFItem ;
56import dev .dfonline .codeclient .data .ItemData ;
1920import net .minecraft .util .Formatting ;
2021import net .minecraft .util .Identifier ;
2122import net .minecraft .util .Util ;
23+ import org .apache .commons .lang3 .text .WordUtils ;
2224import org .jetbrains .annotations .Nullable ;
2325
2426import java .util .ArrayList ;
2527import java .util .List ;
28+ import java .util .Locale ;
2629
2730public class Icon {
2831 private static final TextColor GOLD = TextColor .fromFormatting (Formatting .GOLD );
@@ -78,33 +81,7 @@ public ItemStack getItem() {
7881 addToLore (lore , "Chest Parameters:" );
7982 boolean hasOptional = false ;
8083 for (Argument arg : arguments ) {
81- int i = 0 ;
82- if (arg .text != null ) addToLore (lore , arg .text );
83- if (arg .description != null && description .length != 0 ) for (String line : arg .description ) {
84- Type type = Type .valueOf (arg .type );
85- if (i == 0 ) {
86- MutableText text = Text .empty ().formatted (Formatting .GRAY ).styled (s -> s .withItalic (false ));
87- MutableText typeText = Text .literal (type .display ).setStyle (Text .empty ().getStyle ().withColor (type .color ).withItalic (false ));
88- if (arg .plural ) typeText .append ("(s)" );
89- text .append (typeText );
90- if (arg .optional ) {
91- text .append (Text .literal ("*" ).formatted (Formatting .WHITE ));
92- hasOptional = true ;
93- }
94- text .append (Text .literal (" - " ).formatted (Formatting .DARK_GRAY ));
95- text .append (Utility .textFromString (line ).formatted (Formatting .GRAY ));
96- lore .add (text );
97- } else lore .add (Utility .textFromString (line ).formatted (Formatting .GRAY ));
98- i ++;
99- }
100- if (arg .notes != null ) for (String [] lines : arg .notes ) {
101- i = 0 ;
102- if (lines != null ) for (String line : lines ) {
103- if (i == 0 ) addToLore (lore , "§9⏵ §7" + line );
104- else addToLore (lore , "§7" + line );
105- i ++;
106- }
107- }
84+ lore .addAll (arg .getLore ());
10885 }
10986 if (tags != null && tags != 0 ) {
11087 lore .add (Text .literal ("# " ).formatted (Formatting .DARK_AQUA ).styled (s -> s .withItalic (false )).append (Text .literal (tags + " Tag" + (tags != 1 ? "s" : "" )).formatted (Formatting .GRAY )));
@@ -149,17 +126,16 @@ public ItemStack getItem() {
149126 if (cancelledAutomatically ) addToLore (lore , "§4∅ §cCancelled automatically" );
150127 else addToLore (lore , "§4∅ §cCancellable" );
151128 }
152- if (requireTokens ) {
153- addToLore (lore ,"" );
129+ if (requireTokens ) {
130+ addToLore (lore , "" );
154131 lore .add (Text .literal ("Unlock with Tokens" ).withColor (0xffd42a ));
155132 }
156- if (requiredRank != null ) {
157- if (requireTokens ) {
133+ if (requiredRank != null ) {
134+ if (requireTokens ) {
158135 lore .add (Text .literal ("OR" ).withColor (0xff55aa ));
159136 lore .add (Text .literal ("Unlock with " + requiredRank .name ).withColor (requiredRank .color .getRgb ()));
160- }
161- else {
162- addToLore (lore ,"" );
137+ } else {
138+ addToLore (lore , "" );
163139 lore .add (Text .literal (requiredRank .name + " Exclusive" ).setStyle (Style .EMPTY .withColor (requiredRank .color .getRgb ()).withItalic (false )));
164140 }
165141 }
@@ -185,8 +161,8 @@ private void addToLore(ArrayList<Text> lore, String text) {
185161 public List <ArgumentGroup > getArgGroups () {
186162 var groups = new ArrayList <ArgumentGroup >();
187163 var group = new ArrayList <Argument >();
188- for (var arg : arguments ) {
189- if (!arg .isSplitter ()) group .add (arg );
164+ for (var arg : arguments ) {
165+ if (!arg .isSplitter ()) group .add (arg );
190166 else {
191167 groups .add (new ArgumentGroup (group ));
192168 group = new ArrayList <>();
@@ -200,6 +176,7 @@ public enum Type {
200176 TEXT (TextColor .fromFormatting (Formatting .AQUA ), "String" , Items .STRING , dev .dfonline .codeclient .hypercube .item .Text ::new ),
201177 COMPONENT (TextColor .fromRgb (0x7fd42a ), "Styled Text" , Items .BOOK , Component ::new ),
202178 NUMBER (TextColor .fromFormatting (Formatting .RED ), "Number" , Items .SLIME_BALL , Number ::new ),
179+ BYTE (TextColor .fromFormatting (Formatting .RED ), "Byte" , Items .SLIME_BALL , Number ::new ),
203180 LOCATION (TextColor .fromFormatting (Formatting .GREEN ), "Location" , Items .PAPER , Location ::new ),
204181 VECTOR (TextColor .fromRgb (0x2AFFAA ), "Vector" , Items .PRISMARINE_SHARD , Vector ::new ),
205182 SOUND (TextColor .fromFormatting (Formatting .BLUE ), "Sound" , Items .NAUTILUS_SHELL , Sound ::new ),
@@ -216,18 +193,19 @@ public enum Type {
216193 BLOCK_TAG (TextColor .fromFormatting (Formatting .AQUA ), "Block Tag" , Items .CHAIN_COMMAND_BLOCK , dev .dfonline .codeclient .hypercube .item .Text ::new ),
217194 LIST (TextColor .fromFormatting (Formatting .DARK_GREEN ), "List" , Items .SKULL_BANNER_PATTERN ), // Ender chest or empty banner pattern
218195 DICT (TextColor .fromRgb (0x55AAFF ), "Dictionary" , Items .KNOWLEDGE_BOOK ), // Knowledge book or chest minecart
219- NONE (TextColor .fromRgb (0x808080 ), "None" , Items .AIR ),
196+ NONE (TextColor .fromRgb (0x808080 ), "None" , Items .AIR )
220197 ;
221198
222199 public final TextColor color ;
223200 public final String display ;
224201 private final ItemStack icon ;
225- @ Nullable public final Icon .Type .getVarItem getVarItem ;
202+ @ Nullable
203+ public final Icon .Type .getVarItem getVarItem ;
226204
227205 Type (TextColor color , String display , Item icon ) {
228206 this .color = color ;
229207 this .display = display ;
230- var item = icon .getDefaultStack ();
208+ ItemStack item = icon .getDefaultStack ();
231209 this .icon = item ;
232210 getVarItem = null ;
233211 }
@@ -249,14 +227,15 @@ public ItemStack getIcon() {
249227 }
250228
251229 public enum RequiredRank {
252- Noble ("Noble" ,TextColor .fromRgb (0x7fff7f )),
253- Emperor ("Emperor" ,TextColor .fromRgb (0x55aaff )),
254- Mythic ("Mythic" ,TextColor .fromRgb (0xd42ad4 )),
255- Overlord ("Overlord" ,TextColor .fromFormatting (Formatting .RED )),
256- Dev ("" ,TextColor .fromRgb (0 ));
230+ Noble ("Noble" , TextColor .fromRgb (0x7fff7f )),
231+ Emperor ("Emperor" , TextColor .fromRgb (0x55aaff )),
232+ Mythic ("Mythic" , TextColor .fromRgb (0xd42ad4 )),
233+ Overlord ("Overlord" , TextColor .fromFormatting (Formatting .RED )),
234+ Dev ("" , TextColor .fromRgb (0 ));
257235
258236 public final String name ;
259237 public final TextColor color ;
238+
260239 RequiredRank (String name , TextColor color ) {
261240 this .name = name ;
262241 this .color = color ;
@@ -267,8 +246,8 @@ public record ArgumentGroup(List<Argument> arguments) {
267246 public List <ArgumentPossibilities > getPossibilities () {
268247 var groups = new ArrayList <ArgumentPossibilities >();
269248 var group = new ArrayList <Argument >();
270- for (var arg : arguments ) {
271- if (!arg .isOr ()) group .add (arg );
249+ for (var arg : arguments ) {
250+ if (!arg .isOr ()) group .add (arg );
272251 else {
273252 groups .add (new ArgumentPossibilities (group ));
274253 group = new ArrayList <>();
0 commit comments