Cuberite Forum
[Dev Tool] NamedBlocks - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Releases (https://forum.cuberite.org/forum-2.html)
+--- Thread: [Dev Tool] NamedBlocks (/thread-675.html)

Pages: 1 2


[Dev Tool] NamedBlocks - bearbin - 01-09-2013

This function returns block names from ids and metavals.

There is a explanatory README in the zip.


RE: [Dev Tool] NamedBlocks - xoft - 01-09-2013

Why would you need a plugin, when there's a set of API functions doing exactly the same? ItemToString(), ItemTypeToString() also accept cItem objects that represent blocks:
Code:
local TypeDesc = ItemTypeToString(BlockType);  -- returns e.g. "wood" or "torch"; no meta processing

local BlockItem = cItem(BlockType, 1, Meta);
local MetaDesc = ItemToString(BlockItem);  -- returns e.g. "birch wood" or "torch"
local FullDesc = ItemToFullString(BlockItem);  -- returns e.g. "birch wood:1 * 1" or "torch:4 * 1"

Sorry for the multiple edits, I had to look the functions up in the end, couldn't make it from the top of my head.

Also of note: these API calls actually use the items.ini file, so they are kept up-to-date easily with the rest of MCServer.


RE: [Dev Tool] NamedBlocks - bearbin - 01-10-2013

I didn't know about those functions, and I want formatted names with caps - I'm going to be giving these things to users.


RE: [Dev Tool] NamedBlocks - xoft - 01-10-2013

You can format the names in the ini file, then. Only I think it doesn't handle spaces, so you must not use a space in the block name.


RE: [Dev Tool] NamedBlocks - bearbin - 01-10-2013

Doesn't matter, this works fine for meTongue

I want spaces and caps, and for the users not to have to edit the items.ini file.


RE: [Dev Tool] NamedBlocks - xoft - 01-11-2013

You should provide a reverse lookup too, then, so that the names that you give out can be traced back into blocktypes and blockmetas.


RE: [Dev Tool] NamedBlocks - bearbin - 01-11-2013

Yeah I guess so. That would require loads more work. But it would work Smile

Just to check - there are no functions for it already are there?


RE: [Dev Tool] NamedBlocks - xoft - 01-11-2013

There are functions that translate strings returned by ItemToString() et al into blocktypes / cItem: BlockStringToType() and StringToItem()


RE: [Dev Tool] NamedBlocks - bearbin - 01-11-2013

ok i guess i could do it for users... synonyms for blocks etc.]

But are people going to use it. I would but it would be inly a minor feature for BlockLogger and i doubt masses of people will use that feature.


RE: [Dev Tool] NamedBlocks - Taugeshtu - 01-11-2013

Quote:But are people going to use it. I would but it would be inly a minor feature for BlockLogger and i doubt masses of people will use that feature.
I tend to believe similar function exist inside Handy... Doubt if it exist in released version though...
Anyway, I'll add them to handy if they are missing and if you don't mind. Let's make a better dev plugin together!