Jump to content

[1.13.2] GameSettings pauseOnLostFocus


geekles

Recommended Posts

In my mod, especially for testing, I want to have the client still running in the background regardless if I am actively playing it or I am simply browsing the web and it is running in the background without having the pause menu show up the second I click away. In game settings, there is an option to disable the "pauseOnLostFocus" feature which works during tests within my IntelliJ development environment. However, if I build the mod and actually run it using my client, I find that this feature oddly enough no longer works. The second I click away (alt + tab) the game pauses. I have decompiled the mod I have added into the mod folder to ensure that the built mod is in fact the latest version, therefore it is unclear to me why pauseOnLostFocus would be utilized differently in both environments. 

Link to comment
Share on other sites

Very simple, but here it is. The final line in the constructor is all that it really is.

public class ExperimentalModification {
    public static final String MOD_ID = "experimentalmodification";

    // Directly reference a log4j logger.
    public static final Logger LOGGER = LogManager.getLogger();

    public ExperimentalModification() {
        // Register the setup method for modloading
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
        // Register the enqueueIMC method for modloading
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC);
        // Register the processIMC method for modloading
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC);
        // Register the doClientStuff method for modloading
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);

        // Register ourselves for server and other game events we are interested in
        MinecraftForge.EVENT_BUS.register(this);

        Minecraft.getInstance().gameSettings.pauseOnLostFocus = false;

    }

    private void setup(final FMLCommonSetupEvent event) {
        // some preinit code
    }

    private void doClientStuff(final FMLClientSetupEvent event) {
        // do something that can only be done on the client
        LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings);
    }

    private void enqueueIMC(final InterModEnqueueEvent event) {
        // some example code to dispatch IMC to another mod
        InterModComms.sendTo("experimental", "helloworld", () -> {
            LOGGER.info("Hello world from the MDK");
            return "Hello world";
        });
    }

    private void processIMC(final InterModProcessEvent event) {
        // some example code to receive and process InterModComms from other mods
        LOGGER.info("Got IMC {}", event.getIMCStream().
                map(m -> m.getMessageSupplier().get()).
                collect(Collectors.toList()));
    }
}

 

Link to comment
Share on other sites

I assume it does this differently then say within the development environment? Because I have had no issues while testing it, but the second I install the mod into my actual client and run it, I can't appear to use this setting. 

Edited by geekles
Link to comment
Share on other sites

So I gave what you said a try, and it didn't work, however what you said did make sense so I simply tried changing the gamesetting at a much later time, such as when I join a server, and now it works. I'll probably have to add some sort of minor delay after the FMLClientSetupEvent is triggered. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Yesterday I buy a minecraft server to play with my friends you know... One of my friends send me the list of mods to add and then i start to dowload them, when i add them to the server it start crashing but i don't know about this things because it's my first time buying a minecraft server This is the error: https://paste.ee/p/sJf7B
    • Discovering that a trusted colleague had accessed my Bitcoin account and transferred $30,000 worth of bitcoins was a devastating blow. It shattered the trust I had placed in them and left me feeling vulnerable and betrayed. However, in the face of adversity, I turned to MUYERN TRUST HACKER for assistance in reclaiming control over my finances and holding the perpetrators accountable for their actions. One of the standout features of MUYERN TRUST HACKER was its ability to provide real-time alerts and notifications, keeping me informed every step of the way. With the support of MUYERN TRUST HACKER, I was able to gather irrefutable evidence of the perpetrator's actions and hold them accountable for their crimes. Armed with the information provided by the platform, I pursued legal recourse and ensured that justice was served. The perpetrator faced severe consequences for their actions, including legal penalties and financial restitution. Beyond its role in facilitating the recovery process, MUYERN TRUST HACKER provided me with a sense of empowerment and resilience in the face of adversity. While the experience was undoubtedly challenging, it ultimately served as a testament to the importance of vigilance and the power of technology in safeguarding our digital assets. Thanks to MUYERN TRUST HACKER, I emerged stronger and more resilient, ready to face whatever challenges the future may hold. Mail; muyerntrusted[At] mail-me .c o m
    • Discovering that a trusted colleague had accessed my Bitcoin account and transferred $30,000 worth of bitcoins was a devastating blow. It shattered the trust I had placed in them and left me feeling vulnerable and betrayed. However, in the face of adversity, I turned to MUYERN TRUST HACKER web [ ht tps:// muyerntrusthack.solutions/ ] for assistance in reclaiming control over my finances and holding the perpetrators accountable for their actions. One of the standout features of MUYERN TRUST HACKER was its ability to provide real-time alerts and notifications, keeping me informed every step of the way. With the support of MUYERN TRUST HACKER, I was able to gather irrefutable evidence of the perpetrator's actions and hold them accountable for their crimes. Armed with the information provided by the platform, I pursued legal recourse and ensured that justice was served. The perpetrator faced severe consequences for their actions, including legal penalties and financial restitution. Beyond its role in facilitating the recovery process, MUYERN TRUST HACKER provided me with a sense of empowerment and resilience in the face of adversity. While the experience was undoubtedly challenging, it ultimately served as a testament to the importance of vigilance and the power of technology in safeguarding our digital assets. Thanks to MUYERN TRUST HACKER, I emerged stronger and more resilient, ready to face whatever challenges the future may hold. Mail; muyerntrusted[At] mail-me .c o m  
    • Do you have still this problem? (I have it too so I want to know if you did something with it)  
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.