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

I wanted to know if it is possible to use the onBlockActivated method to change the metadata of a custom block. This is the current contents of onBlockActivated of which I tried:

int test = w.getBlockMetadata(i, j, k);
	if (!w.isRemote){
		w.setBlockMetadataWithNotify(i, j, j, 1, 3);
	}
	return false;

 

Trying to use it to change the block's bound depending on metadata value. It's probably a simple issue to be honest xD

 

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

  • Author

Ok, this works now. Here is a new question I have, how would I make my block's metadata change in a constant time. Like if I wanted it to change every 20 seconds. I already have an idea on how to make it stop at a set metadata as to not constantly increment, but I don't know how to make it change metadata at set times... What I mean is I don't want it to randomly change.

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Probably a better way, but I would create a TileEntity for the block, and then in the updateEntity() method you can time it. updateEntity() is called every tick, and there are 20 ticks in a second.

  • Author

Probably a better way, but I would create a TileEntity for the block, and then in the updateEntity() method you can time it. updateEntity() is called every tick, and there are 20 ticks in a second.

Well, with the amount of blocks I plan to have this attibute, I don't think a tile entity would be a good option sadly :( . So anyone have an idea on how to make a block do what I want it to do, from my post above this replied post?

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

  • Author

Dang, because I was hoping I could make 100 blocks with this similar property. Welp, if needed I could either make less blocks, or just let it be random.

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

  • Author

What about a Tick Handler?

Tick Handler?

 

As a side note? How could I increase the chance of meta change?

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

  • Author

A TickHandler won't help you here.

Ok, so what's an answer to my other question? On how to increase rate of metadata change?

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

  • Author

Well, just do it more often... In your TE onUpdate method.

Ok, but what if I wanted to make a sapling, or plant grow faster by default? Would I have to make a Tile Entity? Or would it be possible to do it as just a block. Would I use random.nextInt() with a greater range, equaling a larger set of numbers to increase chance of growth?

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

  • Author

You can't increase the number of times the random tick happens. So if that is not often enough you need a TileEntity.

Well, I am happy.. Found out there was away to make it seem to be less random without tile entity... just used the world.scheduleBlockUpdate() method. Seems to work exactly how I wanted it. Set it to a 100 tick rate and it took 5 seconds to make the changes. :D

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

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.