Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Trying to add a screen before uploading to the world. I did not find examples anywhere, I had to write something of my own. I'm not sure if this approach is correct, I'm not very sure. However, this works more or less. The screen appears but disappears immediately.

And I need to wait for the buttons to be pressed before it disappears. How can I implement this?

 

@Mod.EventBusSubscriber(modid = XCraft.MODID, value = Dist.CLIENT)
public class ListenEntityJoinWorldEvent {
    @SubscribeEvent
    public static void joinEntity(EntityJoinWorldEvent event) {
        if (event.getEntity() instanceof ClientPlayerEntity) {
            Minecraft.getInstance().forceSetScreen(new DemoScreen());
            System.out.println("PlayerEntity join in WORLD");
        }
    }
}

I would be glad if you point out mistakes.

  • Author
29 minutes ago, diesieben07 said:

No need to use forceSetScreen (it really doesn't force anything, no idea why it is called that), just use setScreen.

Then if you want to prevent anything from closing this screen, you need to use GuiOpenEvent.

I do not understand. I started listening to GuiOpenEvent
But what will make it not close?

  • Author
8 minutes ago, diesieben07 said:

Вы читали документацию по GuiOpenEvent?

 

Unfortunately, I have not found a more or less detailed description. Climbing in the GuiOpenEvent itself, I found only a description. That, in general, was clear before.

I quote: This event is called before any Gui will open. If you don't want this to happen, cancel the event. If you want to override this Gui, simply set the gui variable to your own Gui.

That is, I need to redefine the open screen anyway? I found nothing about the other. You said about canceling the closure, and I tried to reproduce it, but I did not find anything I needed. Maybe I misunderstood

  • Author
Just now, diesieben07 said:

События кузницы в целом описаны в документации:  https://mcforge.readthedocs.io/en/latest/events/intro/

@Mod.EventBusSubscriber(modid = XCraft.MODID, value = Dist.CLIENT)
public class ListenGuiOpenEvent{
    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public static void guiOpen(GuiOpenEvent event) {
        if (event.getGui() instanceof DemoScreen) {
            System.out.println("Gui Demo open scene");
        }
    }
}

Oh, I'm sorry, but I'm not talking about that a bit. I calmly added the events themselves. You wrote above about canceling the closure, I thought it was something like a method, most likely I was looking in the wrong place

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.