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:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"EntityRenderDispatcherAccessor",
|
||||
"SelectItemModelAccessor",
|
||||
"SelectItemModelMixin",
|
||||
"SelectItemModelMixin$UnbakedSwitchMixin"
|
||||
"SelectItemModelMixin$UnbakedSwitchMixin",
|
||||
"SplashRendererAccessor"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
||||
Reference in New Issue
Block a user