Skip to content

Commit 70a5d31

Browse files
committed
fix
1 parent c546c9e commit 70a5d31

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.14.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

src/client/java/top/qwerty770/clientexport/AdvancementTool.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import net.minecraft.resources.ResourceLocation;
1515
import net.minecraft.world.item.ItemStack;
1616
import net.minecraft.world.item.enchantment.Enchantment;
17+
import net.minecraft.world.item.enchantment.ItemEnchantments;
1718
import top.qwerty770.clientexport.mixin.ClientAdvancementsAccessor;
1819

1920
import java.util.HashMap;
@@ -44,13 +45,16 @@ public static JsonElement getJson(AdvancementHolder holder, AdvancementTree tree
4445
}
4546
if (advancement.display().isPresent()) {
4647
ItemStack icon = advancement.display().get().getIcon();
47-
if (icon.getComponents().has(DataComponents.ENCHANTMENTS)) {
48+
if (icon.has(DataComponents.ENCHANTMENTS)) {
4849
// Enchantments are only registered on server side
49-
enchantments = new HashMap<>();
50-
for (Object2IntMap.Entry<Holder<Enchantment>> entry : Objects.requireNonNull(icon.get(DataComponents.ENCHANTMENTS)).entrySet()){
51-
enchantments.put(entry.getKey().getRegisteredName(), entry.getIntValue());
50+
ItemEnchantments enchantmentsComponent = Objects.requireNonNull(icon.get(DataComponents.ENCHANTMENTS));
51+
if (!enchantmentsComponent.isEmpty()) {
52+
enchantments = new HashMap<>();
53+
for (Object2IntMap.Entry<Holder<Enchantment>> entry : enchantmentsComponent.entrySet()) {
54+
enchantments.put(entry.getKey().getRegisteredName(), entry.getIntValue());
55+
}
56+
icon.remove(DataComponents.ENCHANTMENTS);
5257
}
53-
icon.remove(DataComponents.ENCHANTMENTS);
5458
}
5559
builder.display(advancement.display().get());
5660
}
@@ -68,10 +72,10 @@ public static JsonElement getJson(AdvancementHolder holder, AdvancementTree tree
6872
}
6973
try {
7074
JsonObject jsonObject = (JsonObject) Advancement.CODEC.encodeStart(JsonOps.INSTANCE, builder.build(holder.id()).value()).getOrThrow();
71-
if (enchantments != null){
75+
if (enchantments != null) {
7276
JsonObject object = new JsonObject();
7377
enchantments.forEach(object::addProperty);
74-
jsonObject.add("icon_enchantments", object);
78+
jsonObject.add("clientexport:icon_enchantments", object);
7579
}
7680
return jsonObject;
7781
} catch (Exception e) {
@@ -91,7 +95,7 @@ public static JsonElement getJson(AdvancementProgress progress) {
9195
JsonArray remaining = new JsonArray();
9296
progress.getRemainingCriteria().forEach(remaining::add);
9397
result.add("remaining", remaining);
94-
result.addProperty("done_percent", progress.getPercent());
98+
result.addProperty("progress", progress.getPercent());
9599
return result;
96100
} catch (IllegalStateException | IllegalArgumentException e) {
97101
return error(e, "Failed to encode the progress of the advancement {}!", progress.toString());

src/client/java/top/qwerty770/clientexport/ClientExportHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void onInitializeClient() {
2424

2525
@Environment(EnvType.CLIENT)
2626
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher) {
27-
dispatcher.register(ClientCommandManager.literal("clientexport")
27+
var command = dispatcher.register(ClientCommandManager.literal("clientexport")
2828
.executes(context -> {
2929
context.getSource().sendFeedback(Component.literal("Client Export Helper " + version + " running!"));
3030
return 0;
@@ -48,5 +48,6 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
4848
return 1;
4949
}))
5050
);
51+
dispatcher.register(ClientCommandManager.literal("clex").redirect(command));
5152
}
5253
}

src/client/resources/fabric.mod.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"QWERTY770"
99
],
1010
"contact": {
11-
"homepage": "https://github.com/QWERTY770",
12-
"sources": "https://github.com/QWERTY770"
11+
"homepage": "https://github.com/QWERTY770/",
12+
"sources": "https://github.com/QWERTY770/ClientExportHelper"
1313
},
1414
"license": "MIT License",
1515
"environment": "*",
@@ -22,9 +22,9 @@
2222
"clientexport.mixins.json"
2323
],
2424
"depends": {
25-
"fabricloader": ">=0.15.0",
26-
"minecraft": ">=1.20.2",
27-
"java": ">=17",
25+
"fabricloader": ">=0.16.0",
26+
"minecraft": ">=1.20.6",
27+
"java": ">=21",
2828
"fabric-api": "*"
2929
},
3030
"suggests": {

0 commit comments

Comments
 (0)