Jump to content

[1.7.10] Changing block metadata on rightclick


Electrobob99

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Selamat datang di IDRkasino salah satu situs slot gacor gampang menang hari ini di Indonesia yang sangat menjajikan. Slot gacor adalah adalah suatu istilah yang digunakan untuk menjelaskan sebuah permainan slot gampang menang di situs slot online. Situs slot gacor IDRkasino ini bisa menjadi populer walaupun terbilang baru karena RTP slot online yang disajikan begitu tinggi. Seiring dengan perkembangan zaman situs slot gacor terbaru ini juga sudah update dari segi teknologi yang menggunakan HTML5, inilah yang membuat grafis permainan terlihat begitu modern, audio lebih jernih, dan user interface yang smooth. Tidak dipungkiri grafis yang kami memiliki sudah menarik banyak sekali pendatang baru yang ingin merasakan terbawa dalam suasana tema permainan mesin slot. Kehadiran slot gacor menjadi angin segar bagi para pecinta judi online, memberikan alternatif permainan yang seru dan menguntungkan. Tak heran jika popularitas slot gacor terus meningkat, menarik minat para pemain baru untuk mencoba peruntungan mereka di situs slot gacor hari ini IDRkasino.
    • Selamat datang di Rajabonanza88 salah satu situs slot gacor gampang menang hari ini di Indonesia yang sangat menjajikan. Slot gacor adalah adalah suatu istilah yang digunakan untuk menjelaskan sebuah permainan slot gampang menang di situs slot online. Situs slot gacor Rajabonanza88 ini bisa menjadi populer walaupun terbilang baru karena RTP slot online yang disajikan begitu tinggi. Seiring dengan perkembangan zaman situs slot gacor terbaru ini juga sudah update dari segi teknologi yang menggunakan HTML5, inilah yang membuat grafis permainan terlihat begitu modern, audio lebih jernih, dan user interface yang smooth. Tidak dipungkiri grafis yang kami memiliki sudah menarik banyak sekali pendatang baru yang ingin merasakan terbawa dalam suasana tema permainan mesin slot. Kehadiran slot gacor menjadi angin segar bagi para pecinta judi online, memberikan alternatif permainan yang seru dan menguntungkan. Tak heran jika popularitas slot gacor terus meningkat, menarik minat para pemain baru untuk mencoba peruntungan mereka di situs slot gacor hari ini Rajabonanza88.
    • A code: public class CommonProxy {     public void registerItemRenderer() {         Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(                 ModItems.YOUR_ITEM,                 0,                 new ModelResourceLocation(ModItems.YOUR_ITEM.getRegistryName(), "inventory")         );         Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(                 ModItems.YOUR_ITEM,                 0,                 new ModelResourceLocation(ModItems.YOUR_ITEM.getRegistryName(), "inventory"),                 new CustomItemRenderer(Minecraft.getMinecraft().getTextureManager(), Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager(), Minecraft.getMinecraft().getItemColors())         );     } }   In YOUR_ITEM you must specify item. If not working try this: public class ModInit {     @Mod.EventHandler     public void init(FMLInitializationEvent event) {         CommonProxy commonProxy = new CommonProxy();         commonProxy.registerItemRenderer();     } }
    • Selamat datang di Rajacasino88 salah satu situs slot gacor gampang menang hari ini di Indonesia yang sangat menjajikan. Slot gacor adalah adalah suatu istilah yang digunakan untuk menjelaskan sebuah permainan slot gampang menang di situs slot online. Situs slot gacor ini bisa menjadi populer walaupun terbilang baru karena RTP slot online yang disajikan begitu tinggi. Seiring dengan perkembangan zaman situs slot gacor terbaru ini juga sudah update dari segi teknologi yang menggunakan HTML5, inilah yang membuat grafis permainan terlihat begitu modern, audio lebih jernih, dan user interface yang smooth. Tidak dipungkiri grafis yang kami memiliki sudah menarik banyak sekali pendatang baru yang ingin merasakan terbawa dalam suasana tema permainan mesin slot. Kehadiran slot gacor menjadi angin segar bagi para pecinta judi online, memberikan alternatif permainan yang seru dan menguntungkan. Tak heran jika popularitas slot gacor terus meningkat, menarik minat para pemain baru untuk mencoba peruntungan mereka di situs slot gacor hari ini Rajacasino88.
    • Dalam mengikuti tren perubahan digital, Bank BRI terus berinovasi untuk memenuhi kebutuhan dan keinginan nasabahnya. Salah satu upaya terbaru yang dilakukan oleh Bank BRI adalah meluncurkan platform permainan online yang menarik, yang
  • Topics

×
×
  • Create New...

Important Information

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