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.

ChexxorDev

Members
  • Joined

  • Last visited

Everything posted by ChexxorDev

  1. I just came across the same topic myself and wanted to leave my solution for anyone in need in the future. Apologies if I shouldn't revive. Note: Using Forge 1.19 as of writing The quickest "two-liner" seems to be possible with a ScheduledExecutorService: ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); executor.schedule(() -> doSomething(), time, TimeUnit.MILLISECONDS); Disclaimer: While I've confirmed that this works, I don't know if there exist strong conventions against using custom thread code, although this is a simple use. My specific use case was to throw a burst of projectiles in sequence after right-clicking only once. If that's relevant, here's a more comprehensive example: // Implementing the Item.use method to throw multiple projectiles over time public InteractionResultHolder<ItemStack> use(Level world, Player player, InteractionHand hand) { ItemStack itemStack = player.getItemInHand(hand); int itemsToThrow = Math.min(itemStack.getCount(), BURST_COUNT); if (!world.isClientSide) { ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); for(int i = 0; i < itemsToThrow; ++i) { executor.schedule(() -> throwItem(world, player, itemStack, randomsource), 200 * i, TimeUnit.MILLISECONDS); } } player.awardStat(Stats.ITEM_USED.get(this), itemsToThrow); if (!player.getAbilities().instabuild) { itemStack.shrink(itemsToThrow); } return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide()); }

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.