Jump to content

[1.18.2] Any events fired after resources are loaded


Sireous

Recommended Posts

After game is loaded or resource-packs are reloaded debug console fill with some info, ending with:

[20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 4096x2048x4 minecraft:textures/atlas/blocks.png-atlas
[20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 512x256x4 minecraft:textures/atlas/signs.png-atlas
[20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x4 minecraft:textures/atlas/banner_patterns.png-atlas
[20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x4 minecraft:textures/atlas/shield_patterns.png-atlas
[20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 512x512x4 minecraft:textures/atlas/chest.png-atlas
[20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x512x4 minecraft:textures/atlas/beds.png-atlas
[20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x512x4 minecraft:textures/atlas/shulker_boxes.png-atlas
[20:16:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x0 minecraft:textures/atlas/particles.png-atlas
[20:16:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x0 minecraft:textures/atlas/paintings.png-atlas
[20:16:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 256x256x0 minecraft:textures/atlas/mob_effects.png-atlas

I wonder, if there is any event fired after that load or reload happenes?

Link to comment
Share on other sites

RegisterClientReloadListenersEvent

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Well, I've added

FMLJavaModLoadingContext.get().getModEventBus().addListener(
                EventPriority.NORMAL,
                false,
                RegisterClientReloadListenersEvent.class,
                this::a);

into my mod constructor. a is

private void a(RegisterClientReloadListenersEvent event){
        LOGGER.debug("Resources loaded");
    }

And it seems it is not working (I don't see this string in console)

Link to comment
Share on other sites

Works for me, I'm not going to try and debug your random code snippets out of context.

@EventBusSubscriber(modid = MODID, bus = Bus.MOD, value = Dist.CLIENT)
public class ClientForgeModLoadingTest {

    @SubscribeEvent
    public static void reloadListeners(RegisterClientReloadListenersEvent event) {
        LOGGER.info("------------------> HERE");
        event.registerReloadListener(new SimplePreparableReloadListener<Unit>() {

            @Override
            protected Unit prepare(ResourceManager resourceManager, ProfilerFiller profiller) {
                LOGGER.info("------------------> PREPARE");
                return Unit.INSTANCE;
            }

            @Override
            protected void apply(Unit ignored, ResourceManager resourceManager, ProfilerFiller profiller) {
                LOGGER.info("------------------> APPLY");
            }
        });
    }
}

 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

22 minutes ago, warjort said:

I'm not going to try and debug your random code snippets out of context.

Well, nobody was asking for that.

By the way, why are you using class approach and not MinecraftForge.EVENT_BUS.addListener or FMLJavaModLoadingContext.get().getModEventBus().addListener?

Link to comment
Share on other sites

Because the less boilerplate and wiring code I have to write, the less errors I can make. 🙂 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

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



×
×
  • Create New...

Important Information

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