1
0
mirror of https://github.com/GeyserMC/Rainbow.git synced 2025-12-19 14:59:16 +00:00

Provide more info in pack report

This commit is contained in:
Eclipse
2025-07-02 11:23:04 +00:00
parent d716f06747
commit 4b229a170d
7 changed files with 52 additions and 4 deletions

View File

@@ -11,13 +11,14 @@ import java.util.List;
public final class ItemSuggestionMapper {
private static final ItemSuggestionMapper INSTANCE = new ItemSuggestionMapper();
private List<String> remainingCommands = new ArrayList<>();
private final List<String> remainingCommands = new ArrayList<>();
private boolean waitingOnItem = false;
private boolean waitingOnClear = false;
private int mapped = 0;
private ItemSuggestionMapper() {}
// TODO
public boolean start(List<String> commands) {
if (remainingCommands.isEmpty()) {
remainingCommands.addAll(commands);

View File

@@ -55,7 +55,6 @@ public class PackGeneratorCommand {
.executes(context -> {
if (!PackManager.getInstance().finish()) {
context.getSource().sendError(Component.literal("Errors occurred whilst trying to write the pack to disk!"));
return -1;
}
context.getSource().sendFeedback(Component.literal("Wrote pack to disk"));
return 0;

View File

@@ -49,6 +49,10 @@ public class GeyserMappings {
mappings.put(item, mapping);
}
public int size() {
return mappings.size();
}
public void map(ItemStack stack, ProblemReporter reporter, Consumer<GeyserMapping> mappingConsumer) {
Optional<? extends ResourceLocation> patchedModel = stack.getComponentsPatch().get(DataComponents.ITEM_MODEL);
//noinspection OptionalAssignedToNull - annoying Mojang

View File

@@ -0,0 +1,12 @@
package org.geysermc.packgenerator.mixin;
import net.minecraft.client.gui.components.SplashRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(SplashRenderer.class)
public interface SplashRendererAccessor {
@Accessor
String getSplash();
}

View File

@@ -2,6 +2,7 @@ package org.geysermc.packgenerator.pack;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.SplashRenderer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.ProblemReporter;
import net.minecraft.world.item.ItemStack;
@@ -10,6 +11,7 @@ import org.geysermc.packgenerator.CodecUtil;
import org.geysermc.packgenerator.PackConstants;
import org.geysermc.packgenerator.mapping.attachable.AttachableMapper;
import org.geysermc.packgenerator.mapping.geyser.GeyserMappings;
import org.geysermc.packgenerator.mixin.SplashRendererAccessor;
import org.geysermc.packgenerator.pack.attachable.BedrockAttachable;
import org.jetbrains.annotations.NotNull;
@@ -132,13 +134,38 @@ public class BedrockPack {
}
try {
Files.writeString(exportPath.resolve(REPORT_FILE), reporter.getTreeReport());
Files.writeString(exportPath.resolve(REPORT_FILE), createPackSummary());
} catch (IOException exception) {
// TODO log
}
return success;
}
private String createPackSummary() {
return """
-- PACK GENERATION REPORT --
// %s
Generated pack: %s
Mappings written: %d
Item texture atlas size: %d
Attachables: %d
Textures tried to export: %d
-- PROBLEM REPORT --
%s
""".formatted(randomSummaryComment(), name, mappings.size(), itemTextures.build().size(),
attachables.size(), texturesToExport.size(), reporter.getTreeReport());
}
private static String randomSummaryComment() {
SplashRenderer splash = Minecraft.getInstance().getSplashManager().getSplash();
if (splash == null) {
return "Undefined Undefined :(";
}
return ((SplashRendererAccessor) splash).getSplash();
}
private static Path createPackDirectory(String name) throws IOException {
Path path = EXPORT_DIRECTORY.resolve(name);
CodecUtil.ensureDirectoryExists(path);

View File

@@ -22,6 +22,10 @@ public record BedrockTextures(Map<String, String> textures) {
return builder;
}
public int size() {
return textures.size();
}
public static Builder builder() {
return new Builder();
}

View File

@@ -11,7 +11,8 @@
"EntityRenderDispatcherAccessor",
"SelectItemModelAccessor",
"SelectItemModelMixin",
"SelectItemModelMixin$UnbakedSwitchMixin"
"SelectItemModelMixin$UnbakedSwitchMixin",
"SplashRendererAccessor"
],
"injectors": {
"defaultRequire": 1