hotrods20 Posted March 1, 2014 Posted March 1, 2014 I have the problem of wanting to make "efficient" code. I want to set a custom variable on a new plant block. This variable would allow the custom plant to know what it will produce when it is fully grown and broken. The problem is there seems to be no way to set this on the block because there is no way to get the block object itself. Anyone know a way of setting this variable without getting the exact block from the world, with the world, or if I should just code individual crop blocks? Quote http://www.slothygaming.com/img/ota.png[/img] If your grammar is shit and you blatantly don't know what you're doing, I will not help you.
larsgerrits Posted March 1, 2014 Posted March 1, 2014 A block is a static Object, so if you set a variable to one in the world, they all get the same variable. So if you want to make a variable that's unique to each block, you need to make it a TileEntity, or you can make all seperate blocks. Quote Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
hotrods20 Posted March 1, 2014 Author Posted March 1, 2014 Thank you. Makes it easier to figure this out. Quote http://www.slothygaming.com/img/ota.png[/img] If your grammar is shit and you blatantly don't know what you're doing, I will not help you.
TheGreyGhost Posted March 1, 2014 Posted March 1, 2014 Hi A bit of background info on Blocks here http://greyminecraftcoder.blogspot.com.au/2013/07/blocks.html and here http://greyminecraftcoder.blogspot.com.au/2013/10/the-most-important-minecraft-classes_9.html if you have 16 types or less, use metadata. Vanilla wood uses this, for example. oak, birch, etc -TGG Quote
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.