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

When im using BlockEvent.EntityPlaceEvent to detect when block is placed

try {

    Thread.sleep(4000);

    event.getWorld().setBlock(event.getPos(), Blocks.AIR.defaultBlockState(), Constants.BlockFlags.BLOCK_UPDATE);

    LightningBolt bolt = new LightningBolt(EntityType.LIGHTNING_BOLT, event.getEntity().level);

    bolt.moveTo(new Vec3(event.getPos().getX(), event.getPos().getY() - 1, event.getPos().getZ()));

    event.getWorld().addFreshEntity(bolt);

    while (true) {

        Thread.sleep(1000);

        String msg = ChatFormatting.RED+"Hello : )";

        event.getEntity().sendMessage(new TextComponent(msg),event.getEntity().getUUID());

    }

} catch (InterruptedException e) { e.printStackTrace(); }

And the leave the world, game just infinity saving world screen.

Someone know how to make loop without infinity loading screen after leaving?

  • Author
30 minutes ago, diesieben07 said:

You need to count ticks. The game only runs one thread for the main logic. If you sleep there, you're stopping the whole game.

Also: That is not at all how you ever handle exceptions.

Can you send an example of counting ticks function please?

Edited by lGuestll666l

  • Guest locked this topic
Guest
This topic is now closed to further replies.

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.