1111import org .geysermc .rainbow .RainbowIO ;
1212import org .geysermc .rainbow .client .mixin .SplashRendererAccessor ;
1313import org .geysermc .rainbow .client .render .MinecraftGeometryRenderer ;
14- import org .geysermc .rainbow .client .skull .CustomSkulls ;
1514import org .geysermc .rainbow .mapping .AssetCacheStats ;
1615import org .geysermc .rainbow .mapping .PackStats ;
1716import org .geysermc .rainbow .pack .BedrockPack ;
@@ -29,9 +28,8 @@ public final class PackManager {
2928#### READ THIS FIRST ####
3029What do I do now?
3130
32- In this folder, you'll find 4 important files/folders along with this one:
31+ In this folder, you'll find 3 important files/folders along with this one:
3332
34- - custom-skulls.yml: put this in Geyser's config folder. These are the exported player skulls. The file may already exist in Geyser's config folder, be careful with overwriting it!
3533- custom_mappings: you need to put the files in here in the `custom_mappings` folder in Geyser's config folder. These are the generated Geyser mappings.
3634- pack.zip: put this in the "packs" folder in Geyser's config folder. This is the generated bedrock resourcepack.
3735- lang: put all files in this folder in the "locales/overrides" folder in Geyser's config folder. These are the exported custom translation strings.
@@ -56,23 +54,23 @@ You can also open an issue report over at our issue tracker (https://github.com/
5654 "you are now blinking manually" , "you're eligible for a free hug token! <3" , "don't mind me!" , "hissss" , "Gayser and Floodgayte, my favourite plugins." ,
5755 "meow" , "we'll be done here soon™" , "got anything else to say?" , "we're done now!" , "this will be fixed by v6053" , "expect it to be done within 180 business days!" ,
5856 "any colour you like" , "someone tell Mojang about this" , "you can't unbake baked models, so we'll store the unbaked models" , "soon fully datagen ready" ,
59- "packconverter when" , "codecs ftw" );
57+ "packconverter when" , "codecs ftw" , "skull mappings >>> custom-skulls.yml" ,
58+ "now with the ultimate, greatest custom content ever, which everybody asked for: custom waypoints" , "unable to handle the merge" );
6059 private static final RandomSource RANDOM = RandomSource .create ();
6160
6261 private static final Path EXPORT_DIRECTORY = FabricLoader .getInstance ().getGameDir ().resolve (Rainbow .MOD_ID );
6362 private static final Path PACK_DIRECTORY = Path .of ("pack" );
6463 private static final Path MAPPINGS_DIRECTORY = Path .of ("custom_mappings" );
6564 private static final Path PACK_ZIP_FILE = Path .of ("pack.zip" );
6665 private static final Path PACK_LANG_FOLDER = Path .of ("lang" );
67- private static final Path SKULLS_FILE = Path .of ("custom-skulls.yml" );
6866 private static final Path REPORT_FILE = Path .of ("report.txt" );
6967
7068 private final ClientPackSerializer packSerializer = new ClientPackSerializer ();
71- private Optional <RainbowPack > currentPack = Optional .empty ();
69+ private Optional <BedrockPack > currentPack = Optional .empty ();
7270
7371 public void startPack (String name ) throws IOException {
7472 if (currentPack .isPresent ()) {
75- throw new IllegalStateException ("Already started a pack (" + currentPack .get ().resources . name () + ")" );
73+ throw new IllegalStateException ("Already started a pack (" + currentPack .get ().name () + ")" );
7674 }
7775 packSerializer .prepare (Objects .requireNonNull (Minecraft .getInstance ().level ).registryAccess ());
7876
@@ -84,27 +82,25 @@ public void startPack(String name) throws IOException {
8482 .withGeometryRenderer (MinecraftGeometryRenderer .INSTANCE )
8583 .reportSuccesses ()
8684 .build ();
87- currentPack = Optional .of (new RainbowPack ( pack , new CustomSkulls ()) );
85+ currentPack = Optional .of (pack );
8886 }
8987
90- public void run (Consumer <RainbowPack > consumer ) {
88+ public void run (Consumer <BedrockPack > consumer ) {
9189 currentPack .ifPresent (consumer );
9290 }
9391
94- public void runOrElse (Consumer <RainbowPack > consumer , Runnable runnable ) {
92+ public void runOrElse (Consumer <BedrockPack > consumer , Runnable runnable ) {
9593 currentPack .ifPresentOrElse (consumer , runnable );
9694 }
9795
9896 public Optional <Path > getExportPath () {
99- return currentPack .map (pack -> EXPORT_DIRECTORY .resolve (pack .resources . name ()));
97+ return currentPack .map (pack -> EXPORT_DIRECTORY .resolve (pack .name ()));
10098 }
10199
102100 public boolean finish (Runnable onFinish ) {
103101 currentPack .ifPresent (pack -> {
104- Path skullsPath = EXPORT_DIRECTORY .resolve (pack .resources .name ()).resolve (SKULLS_FILE );
105- Path reportPath = EXPORT_DIRECTORY .resolve (pack .resources .name ()).resolve (REPORT_FILE );
106- pack .resources .save ().thenRun (() -> {
107- RainbowIO .safeIO (() -> Files .writeString (skullsPath , pack .skulls .createConfig ()));
102+ Path reportPath = EXPORT_DIRECTORY .resolve (pack .name ()).resolve (REPORT_FILE );
103+ pack .save ().thenRun (() -> {
108104 RainbowIO .safeIO (() -> Files .writeString (reportPath , createPackSummary (pack , packSerializer )));
109105 onFinish .run ();
110106 });
@@ -114,17 +110,15 @@ public boolean finish(Runnable onFinish) {
114110 return wasPresent ;
115111 }
116112
117- public record RainbowPack (BedrockPack resources , CustomSkulls skulls ) {}
118-
119113 // TODO: clean this up
120- private static String createPackSummary (RainbowPack pack , ClientPackSerializer packSerializer ) {
121- String problems = ((ProblemReporter .Collector ) pack .resources . getReporter ()).getTreeReport ();
114+ private static String createPackSummary (BedrockPack pack , ClientPackSerializer packSerializer ) {
115+ String problems = ((ProblemReporter .Collector ) pack .getReporter ()).getTreeReport ();
122116 if (StringUtil .isBlank (problems )) {
123117 problems = "Well that's odd... there's nothing here!" ;
124118 }
125119
126- long attachables = pack .resources . getBedrockItems ().stream ().filter (item -> item .attachableContext ().attachable ().isPresent ()).count ();
127- PackStats stats = pack .resources . stats ();
120+ long attachables = pack .getBedrockItems ().stream ().filter (item -> item .attachableContext ().attachable ().isPresent ()).count ();
121+ PackStats stats = pack .stats ();
128122 AssetCacheStats cacheStats = stats .cacheStats ();
129123
130124 StringBuilder report = new StringBuilder (REPORT_HEADER );
@@ -134,7 +128,7 @@ private static String createPackSummary(RainbowPack pack, ClientPackSerializer p
134128 report .append ('\n' );
135129 report .append ("\n Version of Rainbow: " ).append (RainbowClient .getVersion ());
136130 report .append ("\n " );
137- report .append ("\n Generated pack: " ).append (pack .resources . name ());
131+ report .append ("\n Generated pack: " ).append (pack .name ());
138132 report .append ("\n Block mappings written: " ).append (stats .blockMappings ());
139133 report .append ("\n Item mappings written: " ).append (stats .itemMappings ());
140134 report .append ("\n " );
@@ -148,9 +142,9 @@ private static String createPackSummary(RainbowPack pack, ClientPackSerializer p
148142 report .append ("\n JSON-files written: " ).append (packSerializer .jsonExported ());
149143 report .append ("\n Textures written: " ).append (packSerializer .texturesExported ());
150144 report .append ("\n " );
151- report .append ("\n Username skulls exported: " ).append (pack .skulls .usernames ());
152- report .append ("\n UUID skulls exported: " ).append (pack .skulls .uuids ());
153- report .append ("\n Static texture skulls exported: " ).append (pack .skulls .textures ());
145+ report .append ("\n Username skulls exported: " ).append ("TODO" ); //.append( pack.skulls.usernames());
146+ report .append ("\n UUID skulls exported: " ).append ("TODO" ); //.append( pack.skulls.uuids());
147+ report .append ("\n Static texture skulls exported: " ).append ("TODO" ); //.append( pack.skulls.textures());
154148 report .append ("\n " );
155149 report .append ("\n -- ASSET CACHE STATS --" );
156150 report .append ("\n Geometry cache: %d written, %d cache hits " .formatted (cacheStats .geometry ().size (), cacheStats .geometry ().hits ()));
0 commit comments