限定加载Compat
This commit is contained in:
parent
a9a936eff6
commit
0e737be16a
|
|
@ -33,7 +33,7 @@ mod_name=3944Realms 's Lib Mod
|
||||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=MIT
|
mod_license=MIT
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=0.3.4
|
mod_version=0.3.5
|
||||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||||
# This should match the base package used for the mod sources.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package top.r3944realms.lib39.core.compat;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent;
|
||||||
|
|
@ -213,20 +214,20 @@ public abstract class CompatManager {
|
||||||
// 根据配置调用对应的 ICompat 方法
|
// 根据配置调用对应的 ICompat 方法
|
||||||
if (config.dists != null) {
|
if (config.dists != null) {
|
||||||
switch (config.dists) {
|
switch (config.dists) {
|
||||||
case CLIENT -> {
|
case CLIENT -> DistExecutor.unsafeRunWhenOn(Dist.CLIENT,() -> () -> {
|
||||||
if (config.bus == Mod.EventBusSubscriber.Bus.FORGE) {
|
if (config.bus == Mod.EventBusSubscriber.Bus.FORGE) {
|
||||||
compat.addClientGameListener(gameEventBus);
|
compat.addClientGameListener(gameEventBus);
|
||||||
} else {
|
} else {
|
||||||
compat.addClientModListener(modEventBus);
|
compat.addClientModListener(modEventBus);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
case DEDICATED_SERVER -> {
|
case DEDICATED_SERVER -> DistExecutor.unsafeRunWhenOn(Dist.DEDICATED_SERVER,() -> () -> {
|
||||||
if (config.bus == Mod.EventBusSubscriber.Bus.FORGE) {
|
if (config.bus == Mod.EventBusSubscriber.Bus.FORGE) {
|
||||||
compat.addServerGameListener(gameEventBus);
|
compat.addClientGameListener(gameEventBus);
|
||||||
} else {
|
} else {
|
||||||
compat.addServerModListener(modEventBus);
|
compat.addClientModListener(modEventBus);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 通用监听器
|
// 通用监听器
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user