Pilchard123 Posted May 6, 2012 Posted May 6, 2012 Is there a way to do that? All of the recipe tutorials I've seen use the in-code name of the block, but none use its ID. I'm looking for something like ModLoader.ItemWithID(int ID)
jakj Posted May 7, 2012 Posted May 7, 2012 Block.blocksList and Item.itemsList are the arrays which contain all references to blocks and items in the game, and are what is checked when the ID from a block or itemstack is used. Remember that itemsList would be shifted up by 256 because the first 256 IDs are shared by blocks (because a block on the ground and a block in your inventory have the same ID).
Pilchard123 Posted May 7, 2012 Author Posted May 7, 2012 Thank you kindly. I'll make some more spaghetti then.
jakj Posted May 7, 2012 Posted May 7, 2012 Thank you kindly. I'll make some more spaghetti then. Did I just pull into Non Sequitur station? O_O
Pilchard123 Posted May 7, 2012 Author Posted May 7, 2012 You've not seen my code, have you. It's not quite in Notch's league, but it's not the most readable you'll come across either.
jakj Posted May 7, 2012 Posted May 7, 2012 You've not seen my code, have you. It's not quite in Notch's league, but it's not the most readable you'll come across either. Oh dear.
Pilchard123 Posted May 7, 2012 Author Posted May 7, 2012 I've just got into a few bad habits because of an exam that I have to do. The code we've been given to work on is ugly as anything you've ever seen and we can't just strip it all out and start from scratch, which would be so much easier and more efficient. My usual style is (I think/hope) pretty good. It should be okay in a month or two after I've been able to weed out any clingy bits of awful.
jakj Posted May 7, 2012 Posted May 7, 2012 Well, my style is so spread-out and deliberate that it gives a lot of people (including my professors, back when I went to university) a case of hives, so if you ever find yourself trying to make your code more readable and structured, my code would be a good reference point to say "if it looks like this, you have gone way too far; back up a bit". ;-)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now