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

Items all show up, but blocks don't. The block is definitely being registered, and so is its model (I know because I finally got it to stop giving block model errors by renaming the file), but it just won't appear in my creative tab. I'm probably just overlooking something stupid again, but I can't figure out what.

 

Registry

	public static Block quickSilverOre;

	public static Block[] blocks = new Block[]
	{
			quickSilverOre = new BloodBlock("quickSilverOre", Material.ROCK).setTool("pickaxe", 2)
	};
	public static void load()
	{
		for (Block block : blocks)
		{
			GameRegistry.register(block);
		}
	}
	public static void registerRenderers()
	{
		int i = Main.MODID.length() + 1;

		for (Block block : blocks)
		{
			Main.proxy.registerBlockRenderer(block, 0, block.getRegistryName().toString().substring(i));
		}
	}

 

Main

	@EventHandler
	public void preInit(FMLPreInitializationEvent event)
	{
		Registry.load();
		proxy.init();
	}

 

ClientProxy

	@Override
	public void init()
	{
		Registry.registerRenderers();
	}

	@Override
	public void registerBlockRenderer(Block item, int meta, String name)
	{
		ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(item), meta,
				new ModelResourceLocation(Main.MODID + ":" + name, "inventory"));
	}

 

And JSONs (I don't know if these are even relevant to the problem, but it saves the trouble of asking)

// BlockState
{
  "variants": {
    "normal": {
      "model": "bloodborne:quicksilverore"
    }
  }
}

// Model
{
  "parent": "block/cube_all",
  "textures": {
    "all": "bloodborne:blocks/quickilverore"
  }
}

// Item
{
  "parent": "bloodborne:block/quicksilverore"
}

 

Indeed, only "items" can appear in inventories such as creative tabs, even if those items look like blocks and get replaced by blocks when "placed" (used against a solid surface) in the world. That's why we have item-blocks, which are items used to represent blocks.

 

From the point of view of a player, a world-block, a floating broken block itemStack entity and an inventory itemStack of item-blocks are all "blocks". However, from a programming standpoint, each is a distinct class of objects with differing storage. It's the programming that replaces one with another when certain actions are taken.

 

The floaters are blessedly automatic, so if we've made itemBlocks for inventory, then we don't need to do any more, but we are still on the hook to declare the itemBlock for each block type that is to appear in inventory. In rare cases, such as when I made a device that gave off smoke blocks, I deliberately withheld the itemBlock (making it unobtanium like air, water and lava).

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.