Posted July 8, 201411 yr Hey I downloaded the api so I could look through a web browser however there's no 'search' feature What I'm trying todo is register all blocks with a prefix (in a sense making a bunch of new blocks that equals the quantity of Minecraft's current blocks. I thought maybe if I we're to swim around the api I could find it - shamefully not. (So in a sense I'm looking for an array with all the blocks - or at least trying to make one without writing the array out) Could someone point to roughly where I could look? Thanks.
July 8, 201411 yr Author This might be a ''go learn java'' question, but how do I call all the block names in that class?
July 8, 201411 yr Author String[] vanillaBlocks = {"Brick", "Stone", "Stone_Brick" //All vanilla blocks prefer if I didn't have to write them out}; for(int i = 0; i < vanillaBlocks.length; i++){ allLarge = new LargeColumnProperties(Material.rock).setBlockName("ModelColumn" + vanillaBlocks[i]).setHardness(20.0F).setResistance(1.0F); GameRegistry.registerBlock(allLarge, "ModelColumn" + vanillaBlocks[i]); GameRegistry.registerTileEntity(TileEntityBlock.class, "ModelColumn" + vanillaBlocks[i]); }
July 8, 201411 yr Iterator it = Block.blockRegistry.iterator(); ArrayList<String> vanillaBlocks = new ArrayList<String>(); while (it.hasNext()) { Block b = (Block)it.next(); vanillaBlocks.add(b.getLocalizedName()); } System.out.println(vanillaBlocks.toString());
July 8, 201411 yr Author Iterator it = Block.blockRegistry.iterator(); ArrayList<String> vanillaBlocks = new ArrayList<String>(); while (it.hasNext()) { Block b = (Block)it.next(); vanillaBlocks.add(b.getLocalizedName()); } String[] blocks = (String[])vanillaBlocks.toArray(); for(int i = 0; i < blocks.length; i++){ allLarge = new LargeColumnProperties(Material.rock).setBlockName("ModelColumn" + blocks[i]).setHardness(20.0F).setResistance(1.0F); GameRegistry.registerBlock(allLarge, "ModelColumn" + blocks[i]); GameRegistry.registerTileEntity(TileEntityBlock.class, "ModelColumn" + blocks[i]); } That's not quite right is it? I would have thought I would need another loop to turn it into an array? BTW the for loop does not accept arraylist - so it does have to be an array. I suppose it doesn't like how the array list can be ''added to'' while an array if fixed?
July 8, 201411 yr Author Iterator it = Block.blockRegistry.iterator(); Now regardless of our previous posts I have spotted a problem that spits out a lot of duplicate blocks.. and some blocks aren't even blocks, they're items such as: "redstone dust" - I'm starting to think I'm going to have to write these out by hand - because excluding the ones I don't want will be just as hard. Maybe I should have specified I was looking for; full shaped blocks that are placeable? this would be easier if the api docs had a search feature haha
July 8, 201411 yr Author OOOO!! Okay I've found a location with the majority of the blocks I want; in the building blocks tab! Its easy enough to get rid of all ''slab'' and ''stair'' and ''wall'' blocks (I know how todo that) - okay I think I'm set
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.