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

Hey All,

 

Ive currently made a portal so when a feather is dropped in to the open space the portal appears.

 

only problem is it does it on a random tick.

 

is there any way so it does a update every tick or 2

 

 

Reveal hidden contents

 

 

Thanks in advance

So, I downloaded your code and mucked about with it, and did some searching online and found that scheduling the tick did the trick.  Here is the relevant code:

 

 

Reveal hidden contents

 

 

I altered the code to generate glass so I could tell if it was working or not, but it should work with your portal as well. 

 

Something I don't know is if it checking every tick is a bad idea or not.  You might want to update your code to be smarter about rescheduling the tick, like having blocks only schedule a new tick if there is any cloud block next to it, or having the portal frame check be able to work for any block in the frame, instead of just the corner. 

 

Anyhow, cool idea and it works instantly this way, not needing a surface under it and being able to hang in mid air. :)

  • Author

can u show me where to put it on here please and underline it so i can see thankyou :)

 

Reveal hidden contents

 

  On 1/27/2013 at 10:15 PM, AzureusNation123 said:

can u show me where to put it on here please and underline it so i can see thankyou :)

 

Reveal hidden contents

 

 

Sure, but understanding what is going on is important here.  The updateTick for the block gets called when the block is scheduled for update.  The onBlockAdded call makes sure it is scheduled for update the first time.  Putting it in the updateTick routine makes sure it is called again.

 

You could probably add logic to not do it if a portal was successfully created or if none of the blocks next to the block are of type cloud.

  • Author

and where does the

 

@Override

  public void onBlockAdded(World par1World, int par2, int par3, int par4) {

      par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, 1);

  }

 

go?

Oh, good. :) 

 

I was going to say that it overrides the Block class' onBlockAdded function, so it can go anywhere in the class.  You should take a look at the Block.java class to see what other functions can be overridden.

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.