Merge 1.20.4 into 1.20.5

This commit is contained in:
embeddedt 2024-01-30 15:48:16 -05:00
commit 25f13a9701
4 changed files with 22 additions and 5 deletions

View File

@ -1,7 +1,6 @@
package org.embeddedt.modernfix.fabric.mappings;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.MappingResolver;
import net.fabricmc.loader.api.*;
import net.fabricmc.loader.impl.launch.FabricLauncherBase;
import net.fabricmc.loader.impl.launch.MappingConfiguration;
import org.embeddedt.modernfix.util.CommonModUtil;
@ -9,18 +8,36 @@ import org.embeddedt.modernfix.util.CommonModUtil;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.Optional;
/**
* Designed for Fabric Loader 0.14.x, probably has issues on other versions. The entire thing is wrapped in a try-catch
* so it should never cause crashes, just fail to work.
*/
public class MappingsClearer {
private static final Version LOADER_015;
static {
try {
LOADER_015 = Version.parse("0.15.0");
} catch (VersionParsingException e) {
throw new RuntimeException(e);
}
}
@SuppressWarnings("unchecked")
public static void clear() {
// TODO: Port this to Fabric Loader 0.15
if(true) //FabricLoader.getInstance().isDevelopmentEnvironment())
return; // never do this in dev
Optional<Version> loaderVersion = FabricLoader.getInstance().getModContainer("fabricloader").map(m -> m.getMetadata().getVersion());
if(!loaderVersion.isPresent() || LOADER_015.compareTo(loaderVersion.get()) < 0) {
// Fabric Loader is probably too new, abort
return;
}
CommonModUtil.runWithoutCrash(() -> {
// For now, force the mapping resolver to be initialized. Fabric Loader 0.14.23 stops initializing it early,
// which means that we actually need to keep the TinyMappingFactory tree around for initialization to work

View File

@ -7,7 +7,7 @@ mixinextras_version=0.3.2
mod_id=modernfix
minecraft_version=24w04a
enabled_platforms=fabric
forge_version=20.4.70-beta
forge_version=20.4.132-beta
# parchment_version=2023.07.09
refined_storage_version=4392788
jei_version=16.0.0.28

View File

@ -34,7 +34,7 @@ public class ForgeHooksClientMixin {
Method acceptEv = ObfuscationReflectionHelper.findMethod(ModContainer.class, "acceptEvent", Event.class);
ModList.get().forEachModContainer((id, mc) -> {
Map<ResourceLocation, BakedModel> newRegistry = helper.wrapRegistry(id);
ModelEvent.ModifyBakingResult postedEvent = new ModelEvent.ModifyBakingResult(newRegistry, bakeEvent.getModelBakery());
ModelEvent.ModifyBakingResult postedEvent = new ModelEvent.ModifyBakingResult(newRegistry, bakeEvent.getTextureGetter(), bakeEvent.getModelBakery());
Stopwatch timer = Stopwatch.createStarted();
try {
acceptEv.invoke(mc, postedEvent);

View File

@ -47,7 +47,7 @@ modId = "neoforge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
type = "required" #mandatory
# The version range of the dependency
versionRange = "[20.4.70-beta,)" #mandatory
versionRange = "[20.4.132-beta,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering = "NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER