Merge branch '1.21.11' into 26.1

This commit is contained in:
embeddedt 2026-01-09 21:10:16 -05:00
commit 4927b21f3f
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
2 changed files with 24 additions and 6 deletions

View File

@ -5,6 +5,8 @@ import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
import org.embeddedt.modernfix.dynresources.DynamicModelSystem;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.Map;
@ -23,4 +25,13 @@ public class MixinModelBakery {
private <K, U, V> CompletableFuture<Map<K, V>> dynamicallyBake(Map<K, U> input, BiFunction<K, U, V> baker, Executor executor) {
return CompletableFuture.completedFuture(DynamicModelSystem.createDynamicBakedRegistry(input, baker));
}
/**
* @author embeddedt
* @reason We want log4j to print the stacktrace and not just the exception message
*/
@ModifyConstant(method = "lambda$bakeModels$3", constant = @Constant(stringValue = "Unable to bake model: '{}': {}"))
private static String showFullException(String prefix) {
return "Unable to bake model: '{}'";
}
}

View File

@ -177,14 +177,21 @@ public class DynamicModelSystem {
@Override
public Object load(K key) throws Exception {
var unbaked = input.get(key);
if (unbaked != null) {
if (DEBUG_DYNAMIC_MODEL_LOADING) {
ModernFix.LOGGER.info("Baking {}", key);
}
return baker.apply(key, unbaked);
} else {
if (unbaked == null) {
return NULL_BAKED;
}
if (DEBUG_DYNAMIC_MODEL_LOADING) {
ModernFix.LOGGER.info("Baking {}", key);
}
var bakerResult = baker.apply(key, unbaked);
if (bakerResult == null) {
ModernFix.LOGGER.warn("Baker has returned null for {}", key);
return NULL_BAKED;
}
return bakerResult;
}
});
return new DynamicRegistryMap<>(input.keySet(), k -> {