- Lua 100%
Luanti Mod Storage Drawers
Version 0.6.5, License: MIT
Description
This mod adds simple item storages showing the item on the front.
Supported Items
By default only stack-able items that don't contain metadata can be stored in drawers.
You can override this by setting the potentially dangerous Store unstackable items setting.
Using Drawers
With an item selected in your hot-bar, point at a drawer and use (default right click) the item to place the stack in the drawer. If there isn't enough space for the full stack then any remainder will be left in your inventory.
Punch (default left click) a drawer to remove a stack of the item.
If you punch or use while sneaking (default shift) you will take or put 1 item.
If you have nothing selected in your hot-bar then right clicking on a drawer with an item in it will move all stacks of that item in your inventory in to the drawer.
You can add a new item in to a drawer and move all other stacks of it in to the drawer by having the new item selected in your hot-bar and triggering use twice.
A drawer can store the equivalent of 32, 36 for MineClone 2, or 28 for overlay style draws in Mineclonia, stacks of an item. For multi-draw drawers this is split evenly between the draws.
You can increase the storage limit of a drawers and change what they can do by adding up Drawer Upgrades. Each drawer can have up to 5 upgrades.
If highlight full draws is enabled then when a draw is full it will have particles displayed in front of it. When the draw is no longer full then the particles will be removed.
Drawer Upgrades
Storage Capacity Increase
These upgrades allow increasing the number of items that can be stored in a drawer.
They are cumulative, so 2 steel upgrades in a drawer will triple the storage of the drawer.
They apply to all draws in a multi draw drawer.
| Level | Crafting Material | Percentage Increase | Images |
|---|---|---|---|
| Steel/Iron | Steel or Iron Ingots | 100 | |
| Gold | Gold Ingots | 200 | |
| Obsidian | Obsidian | 300 | |
| Diamond | Diamonds | 700 | |
| Mithril/Emerald | Mithril Ingots or Emeralds | 1200 | |
Note that Mithril requires the moreores mod to be active.
Public access
If you are using an area protection mod then your drawers may be in an area where other players cannot use them.
These upgrades allow you to override these restrictions and allow other players to put, take, or put and take items.
| Type | Crafting Material | Image |
|---|---|---|
| Take | Copper Ingot | |
| Put | Copper Ingot | |
| Take & Put | Copper Ingot | |
Remember Item
When a drawer is emptied it will forget what was in it and any item can be placed in it.
This upgrade will allow drawers to remember what was in them and prevent other items from replacing it if it becomes empty.
To store a different item in the drawer you have to remove the memory upgrade from the drawer.
Digging Drawers
Drawers can be dug normally on the top, bottom, back and sides. On the front drawers can only be dug on the outer frame.
Drawer Trims
A drawer trim is a solid block that looks similar to drawer but without the handles, edging, or functionality of a draw.
You use drawer trims when you want to connect other drawers to a drawer controller but either don't want a drawer in the position or the block would not be accessible.
e.g. If you wanted drawers on the other side of a wall to be connected to a controller, or if a drawer in the location would break up your design.
Here is an image showing a spruce tree trim being used as part of a column to connect the drawers on the right to the drawer controller on the left. The other blocks in the column are normal spruce tree blocks.
Using Drawer Controllers
Drawer Controllers can insert items automatically into a network of drawers.
An item will only be automatically added to one drawer in the network. If there isn't a drawer with the item in it then the item will be placed in an empty drawer if there is one. If the drawers an item is in is full then no more of that item can be placed until one of the drawers with the item has some items removed or it's storage limit increased.
You can manually add the item to more drawers in the network and the controller will store items in that drawer.
Place the controller and drawers next to each other, so they are connected and the drawer controller will sort the items automatically. If you want to connect drawers, but you don't want to place another drawer, use Drawer Trims to connect them.
Drawers must be within 14 nodes of a controller to be connected.
A drawer can be in the network of multiple controllers.
You add items by using the controller, which will display a form with one inventory space. You can move stacks of items in to this and they will be moved to drawers if possible. If they can't be placed in drawers then they will be returned to your inventory.
The form will stay open until you close it, so you can move many stacks in one interaction.
Using Hoppers
The hopper mod
Hopper Input to Drawer Controllers
If you are using the hopper mod then you can inject items in to a drawer controller by placing a hopper above or beside a drawer controller.
Items that cannot be stored will not be taken.
If you are using the hopper fork by FaceDeer then you can use a sorter between the hopper and the drawer controller. Set it so the big arrow points to the controller and the small arrow to chest or chute and configure the sorter to not filter. This will put any rejected items out the small spout.
Interacting with Drawers
This is not supported as drawers do not have inventories, so the hopper code won't work, and the hopper mod does not support setting a trigger or callback function, so the drawers mod can't control the interaction the way it does with Mineclonia.
Mineclonia
If you are playing the Mineclonia game then you can use hoppers to push and pull items to and from drawers and drawer controllers.
Using Hoppers with Drawers
If you place a hopper under a drawer then the hopper will pull a single item at a time from the drawer.
If the drawer has multiple draws then the hopper will pull one item from each of the draws.
If you place a hopper pointing towards a draw the hopper will push a single item at a time in to the drawer.
Using Hoppers with Drawer Controllers
Input Hoppers
A hopper placed on the top or vertical surfaces of a controller will push items in to the controller.
Unsupported items and items that have filled their drawer will not be pulled from the hopper; the hopper can become stuck if too many of them build up.
Up to a full stack will be moved at a time, breaking the typical one item at a time practice for hoppers.
Output Hoppers
If you place a hopper below a controller then any items that cannot be placed in a drawer by the controller will be moved to the output hopper.
This allows unsupported and overflowing items to bypass the controller and be routed to chests or other containers.
Up to a full stack will be moved at a time, breaking the typical one item at a time practice for hoppers.
Here is a screenshot of hoppers being used in Mineclonia.
Items were all placed in the top chest, the hopper pulled them out and fed them to the controller. All items that didn't have their own draw, and any items that could not be stored in drawers, were pushed through the lower hopper to the lower chest.
Note how just the corners touching the controller or another drawer allows the drawer to be in the network.
Overlaid Drawers
Drawers supports creating drawers based on other blocks. The textures from the block are used by the drawer and an overlay is applied to add handles and shadows.
The cons of this approach are:
- the drawers do not look as good as drawers with individually crafted textures
- sometimes you can have too much of a good thing
The pros are:
- you can get a lot of different drawers easily
- the style of drawers matches the style of the game
- the style of drawers matches updates to the style of the game
- the style of the drawers is affected by texture packs
Supplied overlaid draws
This mod contains overlaid draws for some games. If the generate overlay draws setting is enabled and you are playing a supported game, then these draws will be available to you.
Asuna
For Asuna 1 set of drawers are created for 32 wood blocks and 3 sets of drawers are created for 33 trees. You also get the 5 woods from the default mod.
Each set of drawers includes 1, 2, and 4 draw drawers and a trim.
This image shows the base material with the 3 drawer sizes on top of that, and then the trim on the top of the stack.
That is 207 drawers!
No, you can't have enough variety!
Mineclonia
For each wood registered with mcl_trees.register_wood you will get up to 5 new
drawer styles, each with 1, 2, and 4 draw variants. So up to 15 new drawers per
wood.
- tree
- wood
- bark
- stripped
- stripped bark
Not all woods have all of those options, if they don't have one then the drawer will not generate.
Additionally drawers of size, 1, 2, and 4, will be generated for the following materials.
- mcl_amethyst:amethyst_block
- mcl_amethyst:calcite
- mcl_amethyst:tinted_glass
- mcl_copper:block_oxidized
- mcl_copper:block
- mcl_core:diamondblock
- mcl_core:emeraldblock
- mcl_core:goldblock
- mcl_core:ironblock
- mcl_core:packed_ice
- mcl_core:stone
Here is a screenshot of the overlay drawers generated for Mineclonia with no external mod added woods.
That is 51 materials, 3 sizes each, for 153 different draws!
Settings
Here is a list of settings and what they do.
drawers_disable_1x1
If enabled then single draw drawers will not exist.
This setting defaults off.
drawers_disable_1x2
If enabled then 2 draw drawers will not exist.
This setting defaults off.
drawers_disable_2x2
If enabled then 4 draw drawers will not exist.
This setting defaults off.
drawers_generate_overlay_draws
Enables generation of game specific drawers using the images from existing blocks overlaid with images to add borders, edging and handles.
These drawers are in addition to the default drawers, which, to avoid breaking existing worlds, remain unchanged.
Note that this setting only affects generation of overlay draws contained in this mod. Other mods can still generate these types of draws by calling the API.
See Supplied overlaid draws for details of supplied overlay draws.
This setting defaults on.
drawers_generate_overlay_trims
If enabled then ever overlay draw will have a matching Drawer Trim.
This setting defaults on.
drawers_allow_unstackables
Normally items that cannot stack are not allowed in drawers. Enabling this will allow them to be stored. This will probably break certain items, so use this with caution.
Items that have metadata or have suffered any wear still can't be stored.
This setting defaults off.
drawers_highlight_full_draws
If enabled full draws will have particles in front of them. This is to make it easier to find full draws.
If there are a lot of full draws then this may become a performance issue.
Full draw particles looks like this:
This setting defaults on.
drawers_show_storage_messages
If enabled then when an item is blocked from being stored a message will be shown saying why
This setting defaults off.
Dependencies
This mod requires Luanti 5.10.0 and the xcompat mod.
Complimentary Mods
- I Have Hands allows you to pick up and walk around with a drawer ... even a fully upgraded one.
- Pipeworks allows pushing items in to drawer controllers.
- Digilines allows telling drawer controller to push items to pipelines.
- Tech Age allows pushing items in to drawer controllers.
- More Ores allows crafting Mithril upgrade.
Creating your own drawers
See the API Docs for the public interface details.
Lunati Settings
Drawers uses entities for storing items, each draw has one entity, so a 2x2
drawer has 4 entities. A large number of draws in an area can cause the number
of entities to exceed the default setting of 256. If you are approaching this
limit then you may need to increase the server's max_objects_per_block
setting.
If you see warnings from Luanti about large numbers of objects then you are likely coming close to, or have exceeded, this setting and will need to increase it.
To change this you need to edit minetest.conf and add or edit the
max_objects_per_block setting. You will need to restart the server for it to
take effect.
To-Do
- Add usable 1x1 drawer
- Add a drawer controller for auto-sorting items into a drawer-network
- Add half-sized drawers
- Add 2x2 and 1x2 drawers
- Support pipeworks
- Support hoppers
- For the hopper mod: supports input to drawer controllers. Further support requires changes in the hopper mod.
- Fully supported in Mineclonia
- Make drawers upgradable
- Add drawers in all wood types
- Make them digilines compatible
- Add support for all woods in Asuna
Won't Do
- Add duct tape to transport drawers
- Use the I Have Hands mod or similar.
- Add compacting drawers for auto-crafting blocks/ingots/fragments
- There are other mods that allow this kind of automation.
- Add a key (or something similar) for locking the item (so the item is also
displayed at count 0)
- Use an area protection mod. There is an upgrade to make the private drawer public.
Bug reports and suggestions
You can report bugs and suggest ideas on GitHub, alternatively you can also email me.
Credits
Thanks to:
- Justin Aquadro (@jaquadro), developer of the original Minecraft Mod (also licensed under MIT 😃) — Textures and Ideas
- Mango Tango <mtango688@gmail.com> (@mtango688), creator of the Minetest Mod "Caches" — I reused some code by you. :)
Links
Known Issues
- Mineclone 2 based games have the wrong size for the base number of stacks. They have 36, but the small chest only has 27.
- The drawer full particle was clearly made by someone who is graphics challenged!
- The rotation used for the node displayed on the draw is a bit off.
- The drawer overlays were clearly made by someone who is graphics challenged!