Merge remote-tracking branch 'origin/1.20' into 1.21.1
This commit is contained in:
commit
6706656623
|
|
@ -1,6 +1,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||||
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
|
id "dev.architectury.loom" version "1.9-SNAPSHOT" apply false
|
||||||
id "maven-publish"
|
id "maven-publish"
|
||||||
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
|
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
|
||||||
id 'com.palantir.git-version' version '1.0.0'
|
id 'com.palantir.git-version' version '1.0.0'
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package org.embeddedt.modernfix.common.mixin.bugfix.chunk_deadlock;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.level.gameevent.GameEvent;
|
||||||
|
import org.embeddedt.modernfix.ModernFix;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
@Mixin(Entity.class)
|
||||||
|
public class EntityMixin {
|
||||||
|
/**
|
||||||
|
* @author embeddedt
|
||||||
|
* @reason When an entity is added to the world via the worldgen load path (ChunkMap#postLoadProtoChunk calling
|
||||||
|
* ServerLevel#addWorldGenChunkEntities), attempts to add a passenger result in a deadlock when the sculk event
|
||||||
|
* tries to raytrace blocks. To fix this, we skip firing the sculk event if the chunk the entity is within is not
|
||||||
|
* loaded.
|
||||||
|
*/
|
||||||
|
@WrapWithCondition(method = "addPassenger", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;gameEvent(Lnet/minecraft/core/Holder;Lnet/minecraft/world/entity/Entity;)V"))
|
||||||
|
private boolean onlyAddIfSelfChunkLoaded(Entity instance, Holder<GameEvent> gameEvent, Entity entity) {
|
||||||
|
var chunkPos = instance.chunkPosition();
|
||||||
|
if (instance.level() instanceof ServerLevel serverLevel && serverLevel.getChunkSource().getChunkNow(chunkPos.x, chunkPos.z) == null) {
|
||||||
|
ModernFix.LOGGER.warn("Skipped emitting ENTITY_MOUNT game event for entity {} as it would cause deadlock", instance.toString());
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,6 @@ import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
|
||||||
import net.fabricmc.loader.impl.gui.FabricGuiEntry;
|
import net.fabricmc.loader.impl.gui.FabricGuiEntry;
|
||||||
import net.fabricmc.loader.impl.gui.FabricStatusTree;
|
import net.fabricmc.loader.impl.gui.FabricStatusTree;
|
||||||
import org.embeddedt.modernfix.core.ModernFixMixinPlugin;
|
import org.embeddedt.modernfix.core.ModernFixMixinPlugin;
|
||||||
import org.embeddedt.modernfix.fabric.mappings.MappingsClearer;
|
|
||||||
import org.embeddedt.modernfix.spark.SparkLaunchProfiler;
|
import org.embeddedt.modernfix.spark.SparkLaunchProfiler;
|
||||||
import org.embeddedt.modernfix.util.CommonModUtil;
|
import org.embeddedt.modernfix.util.CommonModUtil;
|
||||||
|
|
||||||
|
|
@ -19,9 +18,6 @@ public class ModernFixPreLaunchFabric implements PreLaunchEntrypoint {
|
||||||
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.spark_profile_launch.OnFabric")) {
|
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.spark_profile_launch.OnFabric")) {
|
||||||
CommonModUtil.runWithoutCrash(() -> SparkLaunchProfiler.start("launch"), "Failed to start profiler");
|
CommonModUtil.runWithoutCrash(() -> SparkLaunchProfiler.start("launch"), "Failed to start profiler");
|
||||||
}
|
}
|
||||||
if(ModernFixMixinPlugin.instance.isOptionEnabled("perf.clear_fabric_mapping_tables.MappingsClearer")) {
|
|
||||||
MappingsClearer.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prevent launching with Continuity when dynamic resources is on
|
// Prevent launching with Continuity when dynamic resources is on
|
||||||
if(false && ModernFixMixinPlugin.instance.isOptionEnabled("perf.dynamic_resources.ContinuityCheck")
|
if(false && ModernFixMixinPlugin.instance.isOptionEnabled("perf.dynamic_resources.ContinuityCheck")
|
||||||
|
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
package org.embeddedt.modernfix.fabric.mappings;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
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
|
|
||||||
// later. We force init it now because then we can store less in memory.
|
|
||||||
// Comparing heap dumps on 0.14.23 suggests a savings of 20MB by doing it our way, since many mods will
|
|
||||||
// end up needing the mapping resolver.
|
|
||||||
// This will need to be revisited when https://github.com/FabricMC/fabric-loader/pull/812 is merged.
|
|
||||||
FabricLoader.getInstance().getMappingResolver();
|
|
||||||
|
|
||||||
// clear notch->intermediary mappings
|
|
||||||
MappingConfiguration config = FabricLauncherBase.getLauncher().getMappingConfiguration();
|
|
||||||
Field mappingsField = MappingConfiguration.class.getDeclaredField("mappings");
|
|
||||||
mappingsField.setAccessible(true);
|
|
||||||
//mappingsField.set(config, TinyMappingFactory.EMPTY_TREE);
|
|
||||||
|
|
||||||
// clear useless intermediary->intermediary mappings
|
|
||||||
MappingResolver resolver = FabricLoader.getInstance().getMappingResolver();
|
|
||||||
Class<?> targetResolverClz = Class.forName("net.fabricmc.loader.impl.MappingResolverImpl");
|
|
||||||
if(targetResolverClz.isAssignableFrom(resolver.getClass())) {
|
|
||||||
// hopefully still Loader 0.14.x, proceed
|
|
||||||
Class<?> namespaceDataClz = Class.forName("net.fabricmc.loader.impl.MappingResolverImpl$NamespaceData");
|
|
||||||
Constructor<?> constructor = namespaceDataClz.getDeclaredConstructor();
|
|
||||||
constructor.setAccessible(true);
|
|
||||||
Object theData = constructor.newInstance();
|
|
||||||
Field mapField = resolver.getClass().getDeclaredField("namespaceDataMap");
|
|
||||||
mapField.setAccessible(true);
|
|
||||||
Map<String, Object> theMap = (Map<String, Object>)mapField.get(resolver);
|
|
||||||
theMap.replace("intermediary", theData);
|
|
||||||
}
|
|
||||||
}, "Failed to clear mappings");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"minecraft": ">=1.16.2",
|
"minecraft": ">=1.16.2",
|
||||||
"fabricloader": ">=0.15.0"
|
"fabricloader": ">=0.16.10"
|
||||||
},
|
},
|
||||||
"breaks": {
|
"breaks": {
|
||||||
"dashloader": "<5.0.0-beta.1"
|
"dashloader": "<5.0.0-beta.1"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
org.gradle.jvmargs=-Xmx2G
|
org.gradle.jvmargs=-Xmx2G
|
||||||
|
|
||||||
junit_version=5.10.0-M1
|
junit_version=5.10.0-M1
|
||||||
mixinextras_version=0.3.2
|
mixinextras_version=0.4.1
|
||||||
|
|
||||||
mod_id=modernfix
|
mod_id=modernfix
|
||||||
minecraft_version=1.21.1
|
minecraft_version=1.21.1
|
||||||
|
|
@ -19,7 +19,7 @@ kubejs_version=1902.6.0-build.142
|
||||||
rhino_version=1902.2.2-build.268
|
rhino_version=1902.2.2-build.268
|
||||||
supported_minecraft_versions=1.21.1
|
supported_minecraft_versions=1.21.1
|
||||||
|
|
||||||
fabric_loader_version=0.15.11
|
fabric_loader_version=0.16.10
|
||||||
fabric_api_version=0.102.1+1.21.1
|
fabric_api_version=0.102.1+1.21.1
|
||||||
|
|
||||||
continuity_version=3.0.0-beta.4+1.20.2
|
continuity_version=3.0.0-beta.4+1.20.2
|
||||||
|
|
@ -29,7 +29,7 @@ diagonal_fences_version=4558828
|
||||||
|
|
||||||
spark_version=5759671
|
spark_version=5759671
|
||||||
|
|
||||||
use_fabric_api_at_runtime=false
|
use_fabric_api_at_runtime=true
|
||||||
|
|
||||||
# Look up maven coordinates when changing shadow_version
|
# Look up maven coordinates when changing shadow_version
|
||||||
shadow_version=7.1.2
|
shadow_version=7.1.2
|
||||||
|
|
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user