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

Alright, so in my mod I am implementing a block that disappears for 5 secs then reappears(sorta like the portable hole) does anyone know how to make a Thread that can do this wwithout freezing the game?

The Korecraft Mod

do you a) mean completely disappear (destroyed from world) and then the block is recreated back at that position in 5 seconds or

 

b) disappears but the block is still there just invisible with no collision box.

well, another "waiting" topic :D

 

read this:

http://www.minecraftforge.net/forum/index.php/topic,5964.0.html

^whole topic, there are two approaches to this problem ;)

 

it would be possible to do this via threads, but you'd have to manage synchronization. also spawning thread for each block/group of blocks just to put them to sleep doesn't seem right, when you can do the same with tick handler without overhead from the threads creation.

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

I don't know how to do this with just a block, but if you're willing to have a tile entity then you can simply use the updateEntity() method to increment a timer with every tick. 20 ticks = 1 second, so it would reappear after the timer reached 100. The actual change could be handled with metadata, where 0 is normal and 1 is invisible/non-collidable.

@nerdboy64 that sounds considerably easier to implement than using threads or custom queue/calendar. also using TEs' NBT tags for saves is a nice and easy, definitely better than going over all the threads and signalizing them to stop waiting and to send the main thread remaining time...

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

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.