Change Itemstack Amount

Post Reply
User avatar
Wilderness
Member
Posts: 38
Joined: Sat Mar 18, 2023 02:12
GitHub: Wilderness7272
In-game: Wilderness7272+Last_Laugh

Change Itemstack Amount

by Wilderness » Post

As default is, the max items in a itemstack is 99, but how do I change it to, let's say, 64, or 128?
I'm a complete noob and don't even know where to start.

User avatar
Blockhead
Member
Posts: 1622
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Change Itemstack Amount

by Blockhead » Post

There are two approaches to be used here. The first is to override the default maximum stack size, and the second is to override specific item types that are different from the default.

There is a setting in the menu under Client and Server -> Server Gameplay -> Default stack size (technical name default_stack_max). By setting that to true you can change it from 99 to whatever you want.

After doing that, you may find some items in your inventory have custom maximum stack sizes. If you want to change those, you need a small Lua mod. The init.lua would look like this to change e.g. screwdrivers from Minetest Game to be stackable:

Code: Select all

-- Be aware that tools that are stacked don't show stack numbers, but you
-- can still split the stack with right-click!
local default_stack_max = tonumber(minetest.settings:get("default_stack_max")) or 99

minetest.override_item("screwdriver:screwdriver", {
    -- replaceable with any constant e.g.
    -- stack_max = default_stack_max = 2
    stack_max = default_stack_max
})
The above is available as a full mod here, under CC0 (public domain).
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

Post Reply

Who is online

Users browsing this forum: LMD and 7 guests