Electrobob99 Posted May 26, 2015 Posted May 26, 2015 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 Quote Member of Aerotech Networks, a Multi-Gaming server. Also Currently porting the "Rise of the Automatons" minecraft mod
Electrobob99 Posted May 31, 2015 Author Posted May 31, 2015 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. Quote Member of Aerotech Networks, a Multi-Gaming server. Also Currently porting the "Rise of the Automatons" minecraft mod
TheRealMcrafter Posted May 31, 2015 Posted May 31, 2015 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. Quote
Electrobob99 Posted May 31, 2015 Author Posted May 31, 2015 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? Quote Member of Aerotech Networks, a Multi-Gaming server. Also Currently porting the "Rise of the Automatons" minecraft mod
Electrobob99 Posted May 31, 2015 Author Posted May 31, 2015 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. Quote Member of Aerotech Networks, a Multi-Gaming server. Also Currently porting the "Rise of the Automatons" minecraft mod
Electrobob99 Posted May 31, 2015 Author Posted May 31, 2015 What about a Tick Handler? Tick Handler? As a side note? How could I increase the chance of meta change? Quote Member of Aerotech Networks, a Multi-Gaming server. Also Currently porting the "Rise of the Automatons" minecraft mod
Electrobob99 Posted May 31, 2015 Author Posted May 31, 2015 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? Quote Member of Aerotech Networks, a Multi-Gaming server. Also Currently porting the "Rise of the Automatons" minecraft mod
Electrobob99 Posted May 31, 2015 Author Posted May 31, 2015 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? Quote Member of Aerotech Networks, a Multi-Gaming server. Also Currently porting the "Rise of the Automatons" minecraft mod
Electrobob99 Posted May 31, 2015 Author Posted May 31, 2015 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. Quote Member of Aerotech Networks, a Multi-Gaming server. Also Currently porting the "Rise of the Automatons" minecraft mod
Recommended Posts
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.