|
2 | 2 |
|
3 | 3 | import com.llamalad7.mixinextras.injector.wrapoperation.Operation; |
4 | 4 | import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; |
5 | | -import com.mojang.serialization.DataResult; |
6 | 5 | import io.github.misode.packtest.LoadDiagnostics; |
7 | 6 | import net.minecraft.resources.ResourceLocation; |
8 | | -import net.minecraft.tags.TagFile; |
9 | 7 | import net.minecraft.tags.TagLoader; |
10 | 8 | import org.slf4j.Logger; |
11 | 9 | import org.spongepowered.asm.mixin.Final; |
12 | 10 | import org.spongepowered.asm.mixin.Mixin; |
13 | 11 | import org.spongepowered.asm.mixin.Shadow; |
14 | 12 | import org.spongepowered.asm.mixin.injection.At; |
15 | 13 |
|
16 | | -import java.util.function.Consumer; |
17 | | - |
18 | 14 | /** |
19 | 15 | * Catch tag errors and removes stacktrace. |
20 | | - * Removes the duplicate data result error. |
21 | 16 | */ |
22 | 17 | @Mixin(TagLoader.class) |
23 | 18 | public class TagLoaderMixin { |
24 | 19 | @Shadow |
25 | 20 | @Final |
26 | 21 | private static Logger LOGGER; |
27 | 22 |
|
28 | | - @WrapOperation(method = "load", at = @At(value = "INVOKE", target = "Lcom/mojang/serialization/DataResult;getOrThrow(ZLjava/util/function/Consumer;)Ljava/lang/Object;", remap = false)) |
29 | | - private static Object removeDuplicateError(DataResult<Object> dataResult, boolean allowPartial, Consumer<String> onError, Operation<TagFile> original) { |
30 | | - return dataResult.getOrThrow(allowPartial, (error) -> {}); |
31 | | - } |
32 | | - |
33 | 23 | @WrapOperation(method = "load", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;[Ljava/lang/Object;)V", remap = false)) |
34 | 24 | private static void catchTagError(Logger logger, String message, Object[] args, Operation<Void> original) { |
35 | 25 | String error = ((Exception)args[3]).getMessage().replaceFirst("^[A-Za-z0-9.]+Exception: ", ""); |
|
0 commit comments