Exemple #1
0
        public void PushMinecraftBlocksDataBlockType(RealStatePtr L, Minecraft.BlocksData.BlockType val)
        {
            if (MinecraftBlocksDataBlockType_TypeID == -1)
            {
                bool is_first;
                MinecraftBlocksDataBlockType_TypeID = getTypeId(L, typeof(Minecraft.BlocksData.BlockType), out is_first);

                if (MinecraftBlocksDataBlockType_EnumRef == -1)
                {
                    Utils.LoadCSTable(L, typeof(Minecraft.BlocksData.BlockType));
                    MinecraftBlocksDataBlockType_EnumRef = LuaAPI.luaL_ref(L, LuaIndexes.LUA_REGISTRYINDEX);
                }
            }

            if (LuaAPI.xlua_tryget_cachedud(L, (int)val, MinecraftBlocksDataBlockType_EnumRef) == 1)
            {
                return;
            }

            IntPtr buff = LuaAPI.xlua_pushstruct(L, 4, MinecraftBlocksDataBlockType_TypeID);

            if (!CopyByValue.Pack(buff, 0, (int)val))
            {
                throw new Exception("pack fail fail for Minecraft.BlocksData.BlockType ,value=" + val);
            }

            LuaAPI.lua_getref(L, MinecraftBlocksDataBlockType_EnumRef);
            LuaAPI.lua_pushvalue(L, -2);
            LuaAPI.xlua_rawseti(L, -2, (int)val);
            LuaAPI.lua_pop(L, 1);
        }
Exemple #2
0
        static int _m_GetBlockType(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Minecraft.WorldManager gen_to_be_invoked = (Minecraft.WorldManager)translator.FastGetCSObj(L, 1);



                {
                    int _x = LuaAPI.xlua_tointeger(L, 2);
                    int _y = LuaAPI.xlua_tointeger(L, 3);
                    int _z = LuaAPI.xlua_tointeger(L, 4);

                    Minecraft.BlocksData.BlockType gen_ret = gen_to_be_invoked.GetBlockType(_x, _y, _z);
                    translator.PushMinecraftBlocksDataBlockType(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Exemple #3
0
        public void UpdateMinecraftBlocksDataBlockType(RealStatePtr L, int index, Minecraft.BlocksData.BlockType val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != MinecraftBlocksDataBlockType_TypeID)
                {
                    throw new Exception("invalid userdata for Minecraft.BlocksData.BlockType");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!CopyByValue.Pack(buff, 0, (int)val))
                {
                    throw new Exception("pack fail for Minecraft.BlocksData.BlockType ,value=" + val);
                }
            }

            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }
Exemple #4
0
        public void Get(RealStatePtr L, int index, out Minecraft.BlocksData.BlockType val)
        {
            LuaTypes type = LuaAPI.lua_type(L, index);

            if (type == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != MinecraftBlocksDataBlockType_TypeID)
                {
                    throw new Exception("invalid userdata for Minecraft.BlocksData.BlockType");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                int    e;
                if (!CopyByValue.UnPack(buff, 0, out e))
                {
                    throw new Exception("unpack fail for Minecraft.BlocksData.BlockType");
                }
                val = (Minecraft.BlocksData.BlockType)e;
            }
            else
            {
                val = (Minecraft.BlocksData.BlockType)objectCasters.GetCaster(typeof(Minecraft.BlocksData.BlockType))(L, index, null);
            }
        }