I am confused. What are craftitems, nodes and noneitems?

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

I am confused. What are craftitems, nodes and noneitems?

by burli » Sat Mar 26, 2016 18:00

Hi, I made a copy of minetest game to play with some settings. I add to mods/default/init.lua this

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.craftitemdef_default.stack_max=16
minetest.nodedef_default.stack_max=17
minetest.noneitemdef_default.stack_max=18


Then I tried this

Image

Can someone explain me the difference between craftitem, node and noneitem? Where is the difference between a boat and a fence? And why can I still stack 99 dyes? Is the empty bucket the only noneitem?

Edit: sorry, empty buckets can be stacked to 99
Attachments
screenshot_20160326_184407.jpg
screenshot_20160326_184407.jpg (38.79 KiB) Viewed 754 times
 

User avatar
Napiophelios
Member
 
Posts: 752
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: I am confused. What are craftitems, nodes and noneitems?

by Napiophelios » Sat Mar 26, 2016 18:29

Craft items are non-node items that generally cant be placed but often have uses,
they tend to be craft recipe requirements for nodes

Nodes are items that can be placed and generally used to build with or decorate,
like cobble, wood planks, etc.

Noneitems are unknown items I think.

Edit: oops misunderstood what you were asking.

A fence is a node and I think boat is an entity
Last edited by Napiophelios on Sat Mar 26, 2016 20:07, edited 1 time in total.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: I am confused. What are craftitems, nodes and noneitems?

by rubenwardy » Sat Mar 26, 2016 18:50

Please note that this is a default, and can be overridden in the mod Def.
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: I am confused. What are craftitems, nodes and noneitems?

by Wuzzy » Sat Mar 26, 2016 19:05

Please read this: http://dev.minetest.net/Terminology

But I think this page is not so good, so I explain in my own terms:

item: Anything you can store in an inventory. Includes nodes, tools, craftitems (this is important to know!). Items have a default (!) stack size of 99, unless for tools which can never be stacked. All items can potentionally be used as part of crafting recipes.
node: An item you can place in the world, like a block. These are very important, they make the “blocks” in the world. Read the Lua documentation to learn more about nodes. Example: Cobblestone
- craftitem: Usually this is an item you can only use in inventory. There may or may not some additional uses. Craftitems are often used (as the name suggests) in crafting recipes, but more functionality can still be added. Example: Flour
- tool: An item you can use in some way when you wield it. You can punch or rightclick to do something. Tools also include weapons. Tools also have the special property of being able to be worn out by using it, so tools are commonly used for mining tools. Tools have a stack size of 1 and as far I know it can't be changed (probably because Minetest needs to keep track of the wear level for each tool). Example: Wooden Pickaxe
- noneitem: I have never heard of this term before. Where did you hear that?


In my experience craftitems and tools can be very similar, they can almost be used interchangably. Because both of them can have special behaviour by using attack key or rightclick. Craftitems are probably a bit more flexible but they can't have wear levels. My recommendation is this: If you don't need to track wear, use a craftitem, but if you need wear, use a tool. Also, as far I know mining can only be done by tools, not by craftitems, but I have not checked that.
Technically, the boat is a craftitem. (As long it is in your inventory. If you placed it, the boat you see in the world is an entity). The fence is, as already pointed out, a node.

All buckets are craftitems. This allows to use a stack size of 99 for the empty bucket. Filled buckets have a stack size of 1, set manually. They don't need to be tools since they don't wear out and are also not “really” used for mining.

I am surprised that dyes are still at 99. Dyes are craftitems, so they should be limited to 16, I guess. The dye definition does NOT, I repeat, NOT set stack_max explicitly.

On the other hand, I don't understand why your code:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
    minetest.craftitemdef_default.stack_max=16
    minetest.nodedef_default.stack_max=17
    minetest.noneitemdef_default.stack_max=18

works at all. It works for me as well, but craftitemdef_default is not documented in lua_api.txt. Where did you find out of minetest.craftitemdef_default and the others?


EDIT: The 99 dyes thing is probably because it has no dependencies, it does not even depend on default. So maybe dye is loaded first and therefore does not “notice” your additional code in the default mod. If you add the same code into the dyes mod, the stack size is limited to 16, which is the expected result. :-)
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: I am confused. What are craftitems, nodes and noneitems?

by burli » Sat Mar 26, 2016 19:40

Thx so far. Will take a closer look.

Wuzzy: got this from an other question in Herman

viewtopic.php?f=21&t=14252#p211526
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: I am confused. What are craftitems, nodes and noneitems?

by azekill_DIABLO » Thu Mar 31, 2016 09:46

i think noneitem is weapon.....
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
Napiophelios
Member
 
Posts: 752
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: I am confused. What are craftitems, nodes and noneitems?

by Napiophelios » Thu Mar 31, 2016 20:10

azekill_DIABLO wrote:i think noneitem is weapon.....


https://github.com/minetest/minetest/bl ... m.lua#L631

core.noneitemdef_default = { -- This is used for the hand and unknown items
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: I am confused. What are craftitems, nodes and noneitems?

by azekill_DIABLO » Sun Apr 03, 2016 12:27

ah sorry i didn't said anything :)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 


Return to Minetest General

Who is online

Users browsing this forum: No registered users and 13 guests

cron