Jump to content

Recommended Posts

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

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.