Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hey I downloaded the api so I could look through a web browser however there's no 'search' feature xD

 

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.

  • Author

This might be a ''go learn java'' question, but how do I call all the block names in that class?

  • 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]);
    	}

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());

  • 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?

  • Author

Iterator it = Block.blockRegistry.iterator();

 

Now regardless of our previous posts I have spotted a problem :o

 

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

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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.