Adds portable things to MineClone (crafting table, ender chest, enchanting table)

Crafting Storage


How do I install this?


A mod that adds portable things to MineClone (crafting table, ender chest, enchanting table)

GitHub repo

Forum post

I plan to add these items:

  • [x] Portable Crafting Table

  • [x] Portable Ender Chest (see warning below)

  • [x] Portable Enchanting Table (Upgradable by crafting with bookshelves, downgradable by crafting too)

I was originally going to add things like portable furnaces, portable anvils, things like that... but after looking at the code for a backpack mod, I decided I don't know enough about Minetest (yet) to deal with detached inventories.


MineClone checks whether you're near an ender chest every time you try to put things into one. This means that normally, portable ender chests will not let you insert/remove items. The only way to fix that is to go into MineClone's code and add a line. In your Minetest directory, open games/mineclone2/mods/ITEMS/mcl_chests/init.lua in a text editor. Around line 1060 (as of MineClone 0.82.0), there should be code that looks like this (you can also use the find tool and search for "register_allow"):

minetest.register_allow_player_inventory_action(function(player, action, inv, info)
    if inv:get_location().type == "player" and (
           action == "move" and (info.from_list == "enderchest" or info.to_list == "enderchest")
        or action == "put"  and  info.listname  == "enderchest"
        or action == "take" and  info.listname  == "enderchest"
    ) then
        local def = player:get_wielded_item():get_definition()

        if not minetest.find_node_near(player:get_pos(), def and def.range or ItemStack():get_definition().range, "mcl_chests:ender_chest_small", true) then
            return 0

This is the code that checks for an ender chest near the player. Add the following line where the blank line is:

if player:get_wielded_item():get_name() == "portability:ender_chest" then return end

This makes it so that if the player is holding a portable ender chest, it will skip that check. This will not affect anything else, and even if the mod is disabled or deleted, everything will be fine. The only effect I've found is this: if an ender chest is opened by a player holding an "unknown item" portable ender chest (in other words, if the mod is removed but someone had one in their inventory) and someone broke the ender chest, it would still be possible for the player to insert/remove items from the ender chest until they closed the formspec. Basically not a problem.



Do you recommend this mod?

  • Looks nice

    For some context: the check is there to prevent hackers from accessing the enderchest inventory without and actual echest. Regarding detached inventories I recommend taking a look at mcl_entity_invs that basically manages "ad-hoc" inventories for entities like chest minecarts and saves the content in a table in the entity.