我的世界用坐标形式整理Plethora的物品顺序

--解决plethora获取库存时物品槽乱序的问题
--lua 代码,复制进文件执行即可
--皆以左下角为坐标轴原点

AllContainers = {
        ["names"] = {
            ["equipment"] = "Equipment", --所有实体都有装备栏,只有玩家有末影箱库存,背包库存,饰品栏
            ["enderchest"] = "Ender", 
            ["inventory"] = "Inventory",
            ["baubles"] = "Baubles"
        },
        ["position"] = {
            ["inventory"] = {
                -- 4  x x x x x x x x x
                -- 3  x x x x x x x x x
                -- 2  x x x x x x x x x
                -- 1  x x x x x x x x x
                --    1 2 3 4 5 6 7 8 9
                ["all"]  = 36,
                ["list"] = {
                    [1] = {
                        [1] = 1,
                        [2] = 2,
                        [3] = 3,
                        [4] = 4,
                        [5] = 5,
                        [6] = 6,
                        [7] = 7,
                        [8] = 8,
                        [9] = 9,
                    },
                    [2] = {
                        [1] = 28,
                        [2] = 29,
                        [3] = 30,
                        [4] = 31,
                        [5] = 32,
                        [6] = 33,
                        [7] = 34,
                        [8] = 35,
                        [9] = 36,
                    },
                    [3] = {
                        [1] = 19,
                        [2] = 20,
                        [3] = 21,
                        [4] = 22,
                        [5] = 23,
                        [6] = 24,
                        [7] = 25,
                        [8] = 26,
                        [9] = 27,
                    },
                    [4] = {
                        [1] = 10,
                        [2] = 11,
                        [3] = 12,
                        [4] = 13,
                        [5] = 14,
                        [6] = 15,
                        [7] = 16,
                        [8] = 17,
                        [9] = 18,
                    }
                }
            },
            ["equipment"] = {
                -- 6  x  :hand_main
                -- 5  x  :hand_sub
                -- 4  x  :feet
                -- 3  x  :legs
                -- 2  x  :chest
                -- 1  x  :head
                --    1
                ["all"] = 6,
                ["list"] = {
                    [1] = 1,
                    ["hand_main"] = 1,
                    [2] = 2,
                    ["hand_sub"] = 2,
                    [3] = 3,
                    ["feet"] = 3,
                    [4] = 4,
                    ["legs"] = 4,
                    [5] = 5,
                    ["chest"] = 5,
                    [6] = 6,
                    ["head"] = 6
                }
            },
            ["enderchest"] = {
                -- 3  x x x x x x x x x
                -- 2  x x x x x x x x x
                -- 1  x x x x x x x x x
                --    1 2 3 4 5 6 7 8 9
                ["all"] = 27,
                ["list"] = {
                    [1] = {
                        [1] = 19,
                        [2] = 20,
                        [3] = 21,
                        [4] = 22,
                        [5] = 23,
                        [6] = 24,
                        [7] = 25,
                        [8] = 26,
                        [9] = 27,
                    },
                    [2] = {
                        [1] = 10,
                        [2] = 11,
                        [3] = 12,
                        [4] = 13,
                        [5] = 14,
                        [6] = 15,
                        [7] = 16,
                        [8] = 17,
                        [9] = 18,
                    },
                    [3] = {
                        [1] = 1,
                        [2] = 2,
                        [3] = 3,
                        [4] = 4,
                        [5] = 5,
                        [6] = 6,
                        [7] = 7,
                        [8] = 8,
                        [9] = 9,
                    }
                }
            },
            ["baubles"] = {
                ["all"] = 7,
                ["list"] = {
                    [1] = 1,
                    [2] = 2,
                    [3] = 3,
                    [4] = 4,
                    [5] = 5,
                    [6] = 6,
                    [7] = 7
                }
            }
        }
    }

代码示例


例如,用以下代码丢出9个背包库存在(y,x),即纵向数y格,再横向数x格的物品。

装好神经接口内省模块,先执行上方代码,再执行下方代码。

local manip = peripheral.find("neuralInterface")        --获取所有操作
local inventory = manip.getInventory()                  --获取背包库存
local pos = AllContainers.position.inventory.list       --获取位置转换表
inventory.drop(pos[3][5],9)                             --y = 3 , x = 5
Copyright © 2018-2023 PHP源码网 版权所有
PHP源码网 » 我的世界用坐标形式整理Plethora的物品顺序

提供最优质的资源集合

立即查看 了解详情