Ensure configurability of faster singleplayer load works
This commit is contained in:
parent
a4ce490963
commit
2b7d79f4a7
|
|
@ -23,6 +23,8 @@ import net.minecraftforge.eventbus.api.EventPriority;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent;
|
import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent;
|
||||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||||
|
import org.embeddedt.modernfix.core.ModernFixMixinPlugin;
|
||||||
|
import org.embeddedt.modernfix.core.config.ModernFixEarlyConfig;
|
||||||
import org.embeddedt.modernfix.screen.DeferredLevelLoadingScreen;
|
import org.embeddedt.modernfix.screen.DeferredLevelLoadingScreen;
|
||||||
|
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
|
|
@ -70,7 +72,7 @@ public class ModernFixClient {
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {
|
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {
|
||||||
if(!hasFirstPlayerJoined && integratedWorldLoadListener != null) {
|
if(!hasFirstPlayerJoined && ModernFixMixinPlugin.instance.isOptionEnabled("perf.faster_singleplayer_load.ClientEvents")) {
|
||||||
hasFirstPlayerJoined = true;
|
hasFirstPlayerJoined = true;
|
||||||
MinecraftServer server = ServerLifecycleHooks.getCurrentServer();
|
MinecraftServer server = ServerLifecycleHooks.getCurrentServer();
|
||||||
if(server instanceof IntegratedServer) {
|
if(server instanceof IntegratedServer) {
|
||||||
|
|
@ -81,7 +83,7 @@ public class ModernFixClient {
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||||
public void onWorldShow(GuiOpenEvent event) {
|
public void onWorldShow(GuiOpenEvent event) {
|
||||||
if(ServerLifecycleHooks.getCurrentServer() instanceof IntegratedServer && integratedWorldLoadListener != null) {
|
if(ServerLifecycleHooks.getCurrentServer() instanceof IntegratedServer && ModernFixMixinPlugin.instance.isOptionEnabled("perf.faster_singleplayer_load.ClientEvents")) {
|
||||||
if(event.getGui() == null && Minecraft.getInstance().level != null) {
|
if(event.getGui() == null && Minecraft.getInstance().level != null) {
|
||||||
/* this means the world is being displayed, check if 441 initialized */
|
/* this means the world is being displayed, check if 441 initialized */
|
||||||
ServerChunkCache provider = ServerLifecycleHooks.getCurrentServer().overworld().getChunkSource();
|
ServerChunkCache provider = ServerLifecycleHooks.getCurrentServer().overworld().getChunkSource();
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,10 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
|
||||||
|
|
||||||
private final Logger logger = LogManager.getLogger("ModernFix");
|
private final Logger logger = LogManager.getLogger("ModernFix");
|
||||||
public static ModernFixEarlyConfig config = null;
|
public static ModernFixEarlyConfig config = null;
|
||||||
|
public static ModernFixMixinPlugin instance;
|
||||||
|
|
||||||
public ModernFixMixinPlugin() {
|
public ModernFixMixinPlugin() {
|
||||||
|
instance = this;
|
||||||
try {
|
try {
|
||||||
config = ModernFixEarlyConfig.load(new File("./config/modernfix-mixins.properties"));
|
config = ModernFixEarlyConfig.load(new File("./config/modernfix-mixins.properties"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user