Jump to content

Recommended Posts

Posted

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)

Posted

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

Posted

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.

Posted

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.

Posted

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". ;-)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...